0

I installed the gcc 6.7 compiler with fink and I can now compile Fortran code, but not execute it. On runtime there is the following error:

dyld: Library not loaded: /sw/lib/gcc5/lib/libgfortran.3.dylib

and even after running 'fink selfupdate' this persists.

'which gfortran' returns '/sw/bin/gfortran'

and

'which gcc' returns '/usr/bin/gcc'

I suspect there is a problem with linking the libraries. How could I resolve this?

  • 1
    The error message mentions gcc5 and not gcc6. Why? Do you have multiple versions with gfortran? – Vladimir F Героям слава Nov 21 '17 at 12:50
  • Is your environment set up properly for fink? See their [doc](http://www.finkproject.org/doc/users-guide/install.php?phpLang=en#setup). Also, what is the output of `echo $DYLD_LIBRARY_PATH`? – Pierre de Buyl Nov 21 '17 at 13:09
  • I've got gfortran 6 and 7 on this machine so I suppose there's the problem, there is no 5 on here at all. The output of 'echo $DYLD_LIBRARY_PATH' is empty – Quincy van den Berg Nov 21 '17 at 13:24
  • Sorry, did not see your reply. Normally, fink will have installed the proper libgfortran along with gfortran. If you type "gfortran" and hit the tab key twice for autocompletion, you should see longer names with the version numbers included ("gfortran-7", for instance). Can you try with that one? – Pierre de Buyl Nov 21 '17 at 22:10

1 Answers1

0

I resolved it eventually, thank you for your help. The problem was that gfortran was set to use version 5.5 by default. Higher versions were installed under gfortran-fsf-6 and gfortran-fsf-7 and their corresponding libraries were located in /sw/lib/gcc6 and /sw/lib/gcc7 (there was no /gcc5 present).

When I compile with

gfotran-fsf-6 "programname.f"

then everything is linked correctly.