bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't execute file from command line


From: Bob Proulx
Subject: Re: Can't execute file from command line
Date: Sat, 3 Jan 2009 16:01:39 -0700
User-agent: Mutt/1.5.13 (2006-08-11)

men8th wrote:
> And now run into a brick wall. The IDE starts OK but then complains that it
> can't run a file called CC (i.e. the C compiler presumably)

"CC" would be the normal name for a legacy C++ compiler.  The AT&T C++
compiler was always named CC.  GNU calls the gcc version "g++".

> I've opened up a terminal and cd'd to the install directory. Typing ./CC
> gives the following...
> 
> tim@GGEOM:/usr/local/SunStudio12ml-linux-x86-200709-ii/sunstudio12/prod/bin$
> ./CC
> bash: ./CC: No such file or directory
> 
> However, the file clearly is there. Here is an extract of ls -l
> 
> -rwxr-xr-x 1 root root 323213 2008-12-31 10:28 cc
> -rwxr-xr-x 1 root root 409427 2008-12-31 10:28 CC
> -rwxr-xr-x 1 root root 603271 2008-12-31 10:28 CCadmin
> -rwxr-xr-x 1 root root 4991543 2008-12-31 10:28 ccfe
> -rwxr-xr-x 1 root root 590760 2008-12-31 10:28 CClink
> -rwxr-xr-x 1 root root 138971 2008-12-31 10:28 c++filt
> 
> Can anyone suggest anything. Do you need any further info.

This is actually a complicated topic because it follows what happens
when "#!" lines are executed.  There isn't enough information to know
yet but I think it is because the "./CC" file has a #! line that
doesn't point to a valid interpreter.

Is that a script or an executable?

  file CC

If executable does it match your machine architecture?  (e.g. amd64 on
an x86-64 machine, i686 on an x86 machine and so forth.)

If a script what is the #! line?  Is the interpreter path a valid
interpreter path?  I think this is most likely the problem.  If it
points to an invalid interpreter path then the error you will see will
be the no such file or directory message when trying to invoke the
interpreter path of the script.

Note that modern versions of bash report this error directly.
For a script file with #!/does/not/exist the following would be seen.
This is from my Debian Etch system.

  bash: ./foo: /does/not/exist: bad interpreter: No such file or directory

But older versions and other shells didn't used to report the error
this way and would often confuse people.  Therefore if this is the
problem ("if" because I could guess completely wrong here) then I
think it indicates that you are using an older version of bash.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]