Table of Contents
error trying to exec 'f951': execvp: No such file or directory error trying to exec 'cc1': execvp: No such file or directory
I was trying to compile a program today on OS X Lion using gfortran, but to my disappointment I got these errors every time. I am not really familiar with this kind of stuff, so I wasn’t sure where to look at first. Even when trying to compile a simple
The internet wasn’t very useful either. Google gave me barely anything :-(
The solution #
First I removed xcode, with the idea to reinstall it later:
sudo /Developer/Library/uninstall-devtools -mode=all
After that I dug into my
/usr/bin folders and removed any reference to
gfortran, which are all part of the gcc package.
I also removed all references to
* can be
g++, etc). This comes with xcode, not really sure what this is used for. And finally I removed the
libgcc/ folder and all
libgfortran-related files in
I rebooted for good measure.
Next I got Xcode 4 from the Appstore (for OS X 10.6 and lower, it’s available on the Mac Dev Center and installed it. Again I went into my
/usr/bin/ and removed the symlink xcode made to their (incomplete, it misses gfortran)
I downloaded and installed
gcc-lion.tar.gz from HPC and installed using:
After that, everything seemed to work! There is without doubt a faster way to fix it, but after trying to fix it for a few hours, I’m glad it now works! :-)
What else? #
If gcc gives an error that looks something like this:
ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status,
an explanation can be found here. Basically, the
lstdc++ parameter has to be given, so it uses the correct library. Alternativey,
clang++ can be used directly.
Useful links: #
Original post on web.archive.org.