Can't execute file from command line
Hi I'm trying to install Sun Studio 12. I have followed the instructions given here: http://ubuntuforums.org/showthread.php?t=554514 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) I've opened up a terminal and cd'd to the install directory. Typing ./CC gives the following... t...@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. Thanks in advance, Tim -- View this message in context: http://www.nabble.com/Can%27t-execute-file-from-command-line-tp21268563p21268563.html Sent from the Gnu - Bash mailing list archive at Nabble.com.
Re: Can't execute file from command line
men8th wrote: > t...@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 The problem could be that CC is a script, and the interpreter on its #! line does not exist. (Or it could be an ELF binary, and the ELF dynamic loader specified in the binary doesn't exist.) This can happen if the script has CRLF (carriage return + line feed) line endings instead of just LF. The carriage return character is treated as part of the interpreter filename. Removing the carriage returns would fix that. The problem is unlikely to be in bash itself, so if the above suggestion doesn't help, you're more likely to find the answer in a forum for Sun Studio than for bash. paul
Re: Can't execute file from command line
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... > > t...@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