Wrong library address in Mac os x

3,041 views
Skip to first unread message

Boris Belousov

unread,
Sep 2, 2015, 11:10:16 AM9/2/15
to SNOPT
Dear SNOPT-team,

I obtained the libraries for mac os x and tried to compile an example for cpp. I got the following error on catmixa.cpp

./catmixa
dyld: Library not loaded: /Users/elwong/software/snopt7/lib/libsnopt7_cpp.dylib
Referenced from: /Users/b4be1/local/src/snopt/cppexamples/./catmixa
Reason: image not found
Trace/BPT trap: 5

It seems the library address was hard coded somewhere, as it looks for the library in a wrong folder. Could you advise me what to do? I tried to compile the cpp interface myself, it doesn't help. So I suspect it is in the fortran library.

Warm regards,
Boris

Elizabeth Wong

unread,
Sep 2, 2015, 4:40:46 PM9/2/15
to SNOPT
Hi Boris,

At the terminal, set the environment variable DYLD_LIBRARY_PATH to the location of the libraries.  That should fix the issue.

--Elizabeth

Boris Belousov

unread,
Sep 3, 2015, 2:37:21 AM9/3/15
to SNOPT
Hello Elizabeth,

thank you very much! It fixed the problem. I've got a new one however. I hope it'll be as easy to fix. libsnopt7.dylib searches for libgfortran.3.dylib in a wrong directory:

Library not loaded: /opt/local/lib/libgcc/libgfortran.3.dylib
 
Referenced from: /Users/b4be1/local/lib/libsnopt7.dylib

I am using homebrew and the fortran library is located at

/usr/local/lib/gcc/5


There is no /opt folder on my Mac at all. How could I point libsnopt7 to the right place? I tried adding /usr/local/lib to DYLD_LIBRARY_PATH, but it didn't help :(

Warm regards,
Boris

Boris Belousov

unread,
Sep 3, 2015, 5:16:27 AM9/3/15
to SNOPT
I managed to get it to work by creating a symlink from /opt/local/lib/libgcc to /usr/local/lib/gcc/5. If there is a more elegant solution, I would be glad to know it. I am not feeling good about creating extra directories in / :p

shg...@gmail.com

unread,
Jan 21, 2018, 5:48:47 PM1/21/18
to SNOPT
Dear SNOPT-team,

I am having a problem similar to Boris's first one two years ago. I have been trying to install SNOPT on my MacBook (macOS High Sierra), and 'make install' seems to be working (a bunch of files like libsnopt7.la are created in my /usr/local/snopt7/lib folder). However, 'make check' fails because the library files are not correctly referenced. I set DYLD_LIBRARY_PATH so

> echo $DYLD_LIBRARY_PATH

/usr/local/snopt7/lib

However,

> make check

if [ ! -d ./mod ]; then mkdir ./mod; fi
if [ ! -d ./src ]; then mkdir ./src; fi
/bin/sh ./libtool --mode=install --quiet /usr/bin/install -c ./lib/libsnopt7.la /usr/local/snopt7/lib
/bin/sh ./libtool --mode=finish --quiet /usr/local/snopt7/lib
/bin/sh ./libtool --mode=install --quiet /usr/bin/install -c ./lib/libsqopt7.la /usr/local/snopt7/lib
/bin/sh ./libtool --mode=finish --quiet /usr/local/snopt7/lib
if [ ! -d ./examples ]; then mkdir ./examples; fi
Checking the installation. This may take a while...
dyld: Library not loaded: /Volumes/MacintoshHD2/saunders/SOLVERS/snopt7/lib/libsnopt7.0.dylib
Referenced from: /usr/local/snopt7/examples/./sntoya
Reason: image not found
./check: line 3: 3218 Abort trap: 6 ./sntoya
dyld: Library not loaded: /Volumes/MacintoshHD2/saunders/SOLVERS/snopt7/lib/libsnopt7.0.dylib
Referenced from: /usr/local/snopt7/examples/./sntoyb
Reason: image not found
./check: line 4: 3220 Abort trap: 6 ./sntoyb
...
... (same messages for other examples)
...

Your assistance would be greatly appreciated. Thank you!

Best regards,
Shumpei

Elizabeth Wong

unread,
Jan 21, 2018, 6:33:23 PM1/21/18
to shg...@gmail.com, SNOPT
Hi Shumpei,

Are you working with Michael Saunders?  I only ask because I can see library paths with his name in it :-)

I would try to do a 'make distclean' and re-configure SNOPT.  Did you copy SNOPT from some other location where it had been previously compiled?  That's the only reason I can think of why the examples are looking for libraries in /Volumes/MacintoshHD2/saunders...(in which case, make distclean should clear them out).  If that doesn't work, it would be helpful if you can provide the config.log file (you can email it to me directly).

--Elizabeth


Elizabeth Wong | project scientist
Dept. of Mathematics | UC San Diego
http://ccom.ucsd.edu/~elwong




--
You received this message because you are subscribed to the Google Groups "SNOPT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snopt+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

shg...@gmail.com

unread,
Jan 21, 2018, 6:44:07 PM1/21/18
to SNOPT
Thank you for your quick turnaround. It worked!! I can run the examples so I believe I'm ready to code and run. I'm using SNOPT distributed in a Stanford class, which may be the reason why the path contains Prof Saunders' name in it.

Best regards,
Shumpei

2018年1月21日日曜日 15時33分23秒 UTC-8 Elizabeth Wong:
> To unsubscribe from this group and stop receiving emails from it, send an email to snopt+un...@googlegroups.com.

ahmed...@gmail.com

unread,
Mar 5, 2020, 2:01:12 PM3/5/20
to SNOPT
I have the same issue and can't find a solution.

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/scipy/sparse/linalg/isolve/_iterative.cpython-36m-darwin.so, 2): Library not loaded: /usr/local/opt/gcc/lib/gcc/8/libgfortran.5.dylib
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/scipy/sparse/linalg/isolve/_iterative.cpython-36m-darwin.so
  Reason: image not found

macos Catalina - PyCharm

SNOPT

unread,
Mar 5, 2020, 4:08:34 PM3/5/20
to SNOPT
It's not really the same issue as above, and I'm not sure it's related to SNOPT.

>> Library not loaded: /usr/local/opt/gcc/lib/gcc/8/
libgfortran.5.dylib

Do you have the GNU fortran compiler installed?

Reply all
Reply to author
Forward
0 new messages