LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problem running executable (https://www.linuxquestions.org/questions/linux-newbie-8/problem-running-executable-534777/)

kostis 03-05-2007 11:22 AM

problem running executable
 
I have compiled a Fortran file and created an executable file.x

It should run just by entering file.x to the terminal in that directory
(ive done it in another linux machine)

Instead i get bash:file.x:command not found

I tried also the commands:
./file.x
sh file.x
chmod +x file.x

Do U think i should add this directory somewhere?
How?
It sounds like a stupid question but what should I do??

Thanx for your patience.

b0uncer 03-05-2007 11:43 AM

Usually to get a program run with bash (which you seem to be running), you do these things:

- make sure the file is chmod'ed executable using
Code:

chmod +x file.x
- just run it; typing file.x may not (read: usually won't) run the file, because the directory isn't probably listed in the $PATH environment variable and those directories listed there are the ones where bash looks for the given command. Running works either using a full path or shortening it with the dot-file method:
Code:

/path/to/file.x
./file.x

the latter works, of course, only if the file is in the current working directory. With full path the file should run, if it's just chmod'ed executable first (only needed once). One more thing that might affect is if the place where the file resides isn't marked executable (for example if the filesystem is mounted with the noexec option, executables can't be run afaik; could be for directories too).

kostis 03-05-2007 11:57 AM

When i try ./file.x I get
bash:./file.x:cannot execute binary file

with the command chmod +x im sure it is executable

other suggestions?

pixellany 03-05-2007 01:01 PM

Try ls -l to make sure it is actually executable (by you)

kostis 03-05-2007 02:16 PM

i get the following:
-rwxr-xr-x 1 kostis users 286352 2007-03-05 18:49 file.x
and it has a different color from all the other objects in the directory
that means it is actually executable right??

What could be the problem then??

pixellany 03-05-2007 02:22 PM

Any possibility that it is not really executable? I think that the error message has to do with permissions, but I don't know what bash does when the file is not actually an executable binary.

Also, just to eleminate variables, you might try running it as root.

kostis 03-05-2007 03:40 PM

I also tried to run it as superuser and i still get
-bash: /home/kostis/MYPROJECT/CODE/1d/run/file.x: cannot execute binary file

the file is executable for sure since it runs on a remote computer without any changes,
and i think executable files should run everywhere right?
do u think distribution has something to do

any other suggestions??

rocket357 03-05-2007 03:41 PM

What is the remote computer running?

kostis 03-05-2007 04:21 PM

its a university computer UNIX cluster
the computer uses Fedora while I use SUSE

but my file.x is recognized as executable

dasy2k1 03-06-2007 03:26 AM

that may be your problem,

what type of processor are you using and waht type is the UNIX cluster using?

eg a program compiled on a SPARC processer (likley if the UNIX cluster hardware came form Sun microsystems)
will not run on a x86 (most desktop PC) based machine.
and somthing compiled on an x86 processor wont run on a sparc (or a PPC, siliconTech or any other flavour of processor )

edit: are you sure that the uni cluster is running fedora (linux) or coudl it be running any of the propiartry UNIXes like solaris

kostis 03-07-2007 06:07 AM

Well the truth is that i dont know how to see this (can U tell me how?)
when i log in with ssh i get the following message:
Compaq Tru64 UNIX V5.1B (Rev. 2650);

Its just a simple and small .f90 file

Do u think there might be a solution to this??

Thanx

timmeke 03-07-2007 08:38 AM

The indication "Tru64" suggests that it's actually a 64-bit machine. If the program was compiled on that platform, and you only have a 32-bit machine (ie x86 based), you'll need to recompile it on your machine.

Try running both "uname -a" and "cat /etc/*release /etc/*version" on both your machine and the remote cluster (logged in through ssh) and post the outcome.

kostis 03-07-2007 01:33 PM

the remote gives:
OSF1 gemma V5.1 2650 alpha

while mine gives:
Linux linux 2.6.13-15-default #1 Tue Sep 13 14:56:15 UTC 2005 i686 i686 i386 GNU/Linux
LSB_VERSION="core-2.0-noarch:core-3.0-noarch:core-2.0-ia32:core-3.0-ia32"
SUSE LINUX 10.0 (i586)
VERSION = 10.0

looks different uh??
What can I do??

rocket357 03-07-2007 06:31 PM

If you have the source code, you can recompile on the local machine (might have to make a few tweaks, but it shouldn't be too hard).

dasy2k1 03-08-2007 03:57 AM

it seems that the UNIX cluster is using alpha processors
thease are nothing like the generic X86 procsesors taht most desktop maschines have...


the only real option is to recompile,

do you have the soucre code for the program (or can you get it?)


All times are GMT -5. The time now is 12:48 AM.