Cannot execute binary file - Mono program

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

Cannot execute binary file - Mono program

Postby donoreo » Wed Feb 04, 2009 1:56 pm

I am stuck on the firs project from Paul's coding academy! I am getting the error above. I cannot run the program from a command prompt. It runs fine in MonoDevelop. Permissions are fine. Googling turns up a lot of the same problem with scripts, but not much that helps me. Ideas?
I cannot deny anything that I did not say.
User avatar
donoreo
LXF regular
 
Posts: 788
Joined: Mon Apr 11, 2005 1:49 pm
Location: Toronto, Ontario, Canada

RE: Cannot execute binary file - Mono program

Postby M-Saunders » Wed Feb 04, 2009 2:07 pm

Are you trying to run the program with ./progname? You might need to try mono progname.

M
User avatar
M-Saunders
LXF regular
 
Posts: 2893
Joined: Mon Apr 11, 2005 12:14 pm

RE: Cannot execute binary file - Mono program

Postby donoreo » Wed Feb 04, 2009 2:10 pm

Hmmmm yes, it apparently does need that. Paul's tutorial did not mention it, just ./progname . I may just be the first person working on it with all the time I have being unemployed still :( Thanks.
I cannot deny anything that I did not say.
User avatar
donoreo
LXF regular
 
Posts: 788
Joined: Mon Apr 11, 2005 1:49 pm
Location: Toronto, Ontario, Canada

RE: Cannot execute binary file - Mono program

Postby Hudzilla » Wed Feb 04, 2009 2:22 pm

Hey!

Yes, you probably need to use "mono ToDoList.exe". I didn't mention it because on Ubuntu ./ToDoList.exe works fine :)

I'll add it.


Paul
User avatar
Hudzilla
Site admin
 
Posts: 265
Joined: Mon Apr 04, 2005 11:52 am
Location: LXF Towers

RE: Cannot execute binary file - Mono program

Postby Ram » Wed Feb 04, 2009 3:58 pm

./ works fine on 8.10 but I've found with 8.04 (Dell Mini 9 version) I have to use mono ?.exe

One question if I can highjack this tread, var contents = File.ReadAllText does work for me, gives an error on build. Works if I change it to string contents. This is with 8.04 as above, not had time to try it on 8.10 yet so is this a quirk of 8.04 ?

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
User avatar
Ram
LXF regular
 
Posts: 1679
Joined: Thu Apr 07, 2005 9:44 pm
Location: Guisborough

RE: Cannot execute binary file - Mono program

Postby donoreo » Wed Feb 04, 2009 4:05 pm

I am using Suse 11.1.
I cannot deny anything that I did not say.
User avatar
donoreo
LXF regular
 
Posts: 788
Joined: Mon Apr 11, 2005 1:49 pm
Location: Toronto, Ontario, Canada

RE: Cannot execute binary file - Mono program

Postby ollie » Wed Feb 04, 2009 11:37 pm

Is the location of "mono" part of your PATH variable with the correct permissions to access?

See Setting your Path.
User avatar
ollie
Moderator
 
Posts: 2749
Joined: Mon Jul 25, 2005 11:26 am
Location: Bathurst NSW Australia

RE: Cannot execute binary file - Mono program

Postby Ram » Thu Feb 05, 2009 8:29 am

Cheers for that Ollie, I'll check my PATH on the Mini 9

As for the issue with var, just setup up vbox running 8:10 and no error.

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
User avatar
Ram
LXF regular
 
Posts: 1679
Joined: Thu Apr 07, 2005 9:44 pm
Location: Guisborough

Re: RE: Cannot execute binary file - Mono program

Postby tj-blues » Sun Apr 25, 2010 12:40 am

ollie wrote:Is the location of "mono" part of your PATH variable with the correct permissions to access?

See Setting your Path.


PATH has not much to do with it. Your post confused me for a while so I checked: and yes, mono is installed in /usr/bin directory. But, think, it got to be in PATH because it's sufficient to call "mono program" and not "./mono program".

But still the question is valid - how to make it work without need of issuing "mono" before programname?
cheers
tj-blues
 
Posts: 3
Joined: Sat Apr 24, 2010 11:46 pm
Location: Mississauga, ON, Canada

Re: RE: Cannot execute binary file - Mono program

Postby LeoP » Wed Jun 09, 2010 12:28 pm

tj-blues wrote:But still the question is valid - how to make it work without need of issuing "mono" before programname?


Most distros will install binfmt-support with mono, but many will chose not to enable it: Try
Code: Select all
sudo update-binfmts --display

and see, if it has an entry like "cli (disabled):". If yes, then
Code: Select all
sudo update-binfmts --enable cli

is your friend.
LeoP
 
Posts: 1
Joined: Wed Jun 09, 2010 12:23 pm

Re: RE: Cannot execute binary file - Mono program

Postby Ram » Wed Jun 09, 2010 4:54 pm

tj-blues wrote:
ollie wrote:Is the location of "mono" part of your PATH variable with the correct permissions to access?

See Setting your Path.


PATH has not much to do with it. Your post confused me for a while so I checked: and yes, mono is installed in /usr/bin directory. But, think, it got to be in PATH because it's sufficient to call "mono program" and not "./mono program".

But still the question is valid - how to make it work without need of issuing "mono" before programname?
cheers


tj, if your path is correct then you run it like ./prog.exe as you would with a sh script - no need to ref mono.

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
User avatar
Ram
LXF regular
 
Posts: 1679
Joined: Thu Apr 07, 2005 9:44 pm
Location: Guisborough

Re: RE: Cannot execute binary file - Mono program

Postby tj-blues » Sat Jun 19, 2010 2:29 am

Ram wrote:tj, if your path is correct then you run it like ./prog.exe as you would with a sh script - no need to ref mono.


As I said before - correct PATH will only point system to /usr/bin directory. It doesn't give any references how the system has to deal with ".exe" file.
I run Suse 11.1 and every time I want to execute C# program I need to type "mono" first.
tj-blues
 
Posts: 3
Joined: Sat Apr 24, 2010 11:46 pm
Location: Mississauga, ON, Canada

Postby Ram » Sat Jun 19, 2010 5:10 pm

Hi tj,

You confused me with ./ before mono " it's sufficient to call "mono program" and not "./mono program". "

Anyway have a read of the Registering .exe as non-native binaries (Linux only) section.

Ram

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
User avatar
Ram
LXF regular
 
Posts: 1679
Joined: Thu Apr 07, 2005 9:44 pm
Location: Guisborough

Postby tj-blues » Sat Jun 19, 2010 8:49 pm

Ram wrote:Hi tj,

You confused me with ./ before mono " it's sufficient to call "mono program" and not "./mono program". "

Anyway have a read of the Registering .exe as non-native binaries (Linux only) section.

Ram


Thanks a lot - this should help. But I think I wont use it because I run other .exe files for ex. with Wine.

cheers
tj-blues
 
Posts: 3
Joined: Sat Apr 24, 2010 11:46 pm
Location: Mississauga, ON, Canada


Return to Programming

Who is online

Users browsing this forum: No registered users and 3 guests