LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-05-2007, 11:22 AM   #1
kostis
LQ Newbie
 
Registered: Mar 2006
Distribution: SUSE 10.0
Posts: 28

Rep: Reputation: 15
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.
 
Old 03-05-2007, 11:43 AM   #2
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
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).
 
Old 03-05-2007, 11:57 AM   #3
kostis
LQ Newbie
 
Registered: Mar 2006
Distribution: SUSE 10.0
Posts: 28

Original Poster
Rep: Reputation: 15
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?

Last edited by kostis; 03-05-2007 at 11:59 AM.
 
Old 03-05-2007, 01:01 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Try ls -l to make sure it is actually executable (by you)
 
Old 03-05-2007, 02:16 PM   #5
kostis
LQ Newbie
 
Registered: Mar 2006
Distribution: SUSE 10.0
Posts: 28

Original Poster
Rep: Reputation: 15
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??
 
Old 03-05-2007, 02:22 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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.
 
Old 03-05-2007, 03:40 PM   #7
kostis
LQ Newbie
 
Registered: Mar 2006
Distribution: SUSE 10.0
Posts: 28

Original Poster
Rep: Reputation: 15
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??
 
Old 03-05-2007, 03:41 PM   #8
rocket357
Member
 
Registered: Mar 2007
Location: 127.0.0.1
Distribution: OpenBSD-CURRENT
Posts: 485
Blog Entries: 187

Rep: Reputation: 74
What is the remote computer running?
 
Old 03-05-2007, 04:21 PM   #9
kostis
LQ Newbie
 
Registered: Mar 2006
Distribution: SUSE 10.0
Posts: 28

Original Poster
Rep: Reputation: 15
its a university computer UNIX cluster
the computer uses Fedora while I use SUSE

but my file.x is recognized as executable
 
Old 03-06-2007, 03:26 AM   #10
dasy2k1
Member
 
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Manjaro
Posts: 963

Rep: Reputation: 36
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

Last edited by dasy2k1; 03-06-2007 at 03:28 AM.
 
Old 03-07-2007, 06:07 AM   #11
kostis
LQ Newbie
 
Registered: Mar 2006
Distribution: SUSE 10.0
Posts: 28

Original Poster
Rep: Reputation: 15
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
 
Old 03-07-2007, 08:38 AM   #12
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
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.
 
Old 03-07-2007, 01:33 PM   #13
kostis
LQ Newbie
 
Registered: Mar 2006
Distribution: SUSE 10.0
Posts: 28

Original Poster
Rep: Reputation: 15
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??
 
Old 03-07-2007, 06:31 PM   #14
rocket357
Member
 
Registered: Mar 2007
Location: 127.0.0.1
Distribution: OpenBSD-CURRENT
Posts: 485
Blog Entries: 187

Rep: Reputation: 74
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).
 
Old 03-08-2007, 03:57 AM   #15
dasy2k1
Member
 
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Manjaro
Posts: 963

Rep: Reputation: 36
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?)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
running executable in C++ code psIpher Programming 2 11-25-2005 01:44 PM
Running a Java executable class from another executable class LUB997 Programming 22 07-24-2005 04:57 AM
Running an executable. wesleyarchbell Linux - Software 4 05-03-2005 03:50 AM
running an executable wogga Linux - Software 8 06-12-2004 04:21 AM
running an executable aznamvet Linux - Software 5 06-10-2004 07:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration