gfortran: error trying to exec 'f951': execvp: No such file or directory

Giuliano Pezzolo Giacaglia picture Giuliano Pezzolo Giacaglia · Nov 8, 2012 · Viewed 14.8k times · Source

I'm trying to compile a code found on the internet. Actually I'm trying to compile the code found at http://www.cs.berkeley.edu/~fowlkes/BSE/.

I tried to install gfortran and all the other libraries that are needed for compiling it in my MAC. But when I run the command make I get the following error:

$ make
(cd trlan && make -f Makefile.gcc)
gfortran -O3 -ffixed-line-length-132 -c dsort2.f
gfortran: error trying to exec 'f951': execvp: No such file or directory
make[1]: *** [dsort2.o] Error 1
make: *** [trlan/libtrlan.a] Error 2

I believed that the error is related to the version of my c++ compiler, that is not compatible with gfortran.

When I run the command gcc --version:

$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

And when I run the command gfortran --version:

$ gfortran --version
GNU Fortran (GCC) 4.8.0 20120930 (experimental)

The Makefile under the directory that I'm running the command make is here: https://www.dropbox.com/s/q7mxvhnqg62ioum/Makefile.gcc

The Makefile under the directory trlan is here: https://www.dropbox.com/s/jydwpkg3f1upbgf/Makefile.gcc

Anyone has an idea of how to solve this problem or how to find tools that can help me solve it?

I'm trying this: http://eftrunk.blogspot.com/2011/11/how-to-fix-error-trying-to-exec-f951.html

Answer

wessel picture wessel · Oct 2, 2015

The simplest solution I found (perhaps not cleanest), is to statically link f951 in the path to the binary of gfortran:

find /usr/local/ -name f951

which for me returned:

/usr/local/gfortran/libexec/gcc/x86_64-apple-darwin11/4.6.2/f951
/usr/local/gfortran/libexec/gcc/x86_64-apple-darwin14/5.1.0/f951

so I put a link to the one that fits my system most closely in /usr/local/bin:

sudo ln -s /usr/local/gfortran/libexec/gcc/x86_64-apple-darwin14/5.1.0/f951 /usr/local/bin/.

And now gfortran works again. No need to uninstall XCode or any other exaggerated workload.