2

I'm trying to build a simple Fortran program using a Makefile and the Intel Fortran compiler and to link it against BLAS and LAPACK eventually. If I build the program from the command line using

ifort xxx.f90 -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib

then the building succeeds without issues. However, when I try the same but in a Makefile, namely

runme:
    ifort -c ./src/debug/main_debug.f90
    ifort -o runme *.o -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
    rm -f *.o *.mod

The linker is not able to find the System library.

ipo: warning #11109: unable to find -lSystem in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd
ipo: warning #11109: unable to find -lpthread in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libpthread.tbd

This is on MacOS 12.2.1.

Tiberiu
  • 43
  • 6
  • 1
    Does this answer your question? [GFortran error: ld: library not found for -lSystem when trying to compile](https://stackoverflow.com/questions/56156520/gfortran-error-ld-library-not-found-for-lsystem-when-trying-to-compile) – veryreverie Mar 14 '22 at 16:33
  • Unfortunately, no. I appended the `LIBRARY_PATH` variable by the suggested `"$LIBRARY_PATH:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"` but now I get twice the warnings. Also, gfortran has no issue with finding the System library. – Tiberiu Mar 14 '22 at 22:18
  • You should definitely show your Makefile. – Vladimir F Героям слава Mar 15 '22 at 09:08
  • Is the final executable created or not? What you show are just warnings. Are there also some errors? – Vladimir F Героям слава Mar 15 '22 at 12:30
  • If it runs fine on the command line but fails in a Makefile, my guess is that you have an alias for `ifort`. This alias wouldn't be called in a Makefile, but would be called by an interactive shell. – veryreverie Mar 15 '22 at 13:38
  • @VladimirF the final executable is indeed created. No, I only get those two warnings – Tiberiu Mar 15 '22 at 14:08
  • @veryreverie I ran the command `alias` at the terminal and it returned nothing. The shell does initialize itself with the `setvars.sh` script that comes with the oneAPI environment. – Tiberiu Mar 15 '22 at 14:15
  • So do those warnings actually matter for anything? – Vladimir F Героям слава Mar 15 '22 at 14:34
  • @VladimirFГероямслава I'd prefer if there would be no warnings/errors issues upon compilation. – Tiberiu Mar 16 '22 at 10:21

0 Answers0