Sample Header Ad - 728x90

dyld: Library not loaded, even though path is specified in Makefile

3 votes
0 answers
3205 views
I have a Fortran program which I run on my macOS 10.12.6. The code is compiled using a Makefile, in which all the libraries included have their path included as well. For one of the libraries (and only one) my executable can't seem to be able to find it. My code compiles correctly but I get this runtime error at the beginning of the program: dyld: Library not loaded: libslatec.so Referenced from: path_to_PWD/exe/executable Reason: image not found Here's how I am adding my library: LIB_SLATEC = -L$(HOME)/usr/lib/slatec/lib -lslatec If I do ls $HOME/usr/lib/slatec/lib I get: libslatec.so. Running otool -L path_to_exe | grep slatec I get: libslatec.so (compatibility version 0.0.0, current version 0.0.0). I see that there is no path specified there. If I copy the library into my $PWD the code runs as expected. I have also tried adding the library path to LD_LIBRARY_PATH but that did not change anything. Any idea what the problem is?
Asked by solalito (203 rep)
Dec 4, 2017, 07:46 AM
Last activity: Dec 22, 2017, 11:58 AM