I am using g++ 3.3 on os X 10.3.9. I have created my own library
using
ar ruv *.o files
After this I try to compile a test program using,
g++ -pg -O -Wno-deprecated -ansi -pedantic -o test test.C
-DANSI_HEADERS -D_G_HAVE_BOOL -I. -I/ALLINCLUDEDIRS -lmylib -llpsolve51
-lm -L.
And the compilation works fine.
But when i try to run the executable ./test, I get the following error
message:
dyld: ./test_grid can't open library: liblpsolve51.dylib (No such file
or directory, errno = 2)
Trace/BPT trap
The library liblpsolve.dylib is NOT located in the current directory. I tried checking the value of LD_LIBRARY_PATH using echo$LD_LIBRARY_PATH, but nothing showed up.
It seems that LD_LIBRARY_PATH is not set, and moreover I am not even sure if it is used on darwin? On posting to a newsgroup, I was told that I need DYLD_LIBRARY_PATH instead. On doing echo $DYLD_LIBRARY_PATH I do not see any paths. Isn't a default value set for them already?
How can I resolve this problem?
thanks,
amit.
Mac Os Dyld_library_path Windows 7
Mac Os High Sierra
Macos Dyld_library_path Sip
@xhienne: un/setting DYLDLIBRARYPATH to anything in the launchd.plist and wrapper by any method fails. Also, I don't want to prepend '/opt/local/lib' to the path as there are system libraries I must use over the MacPorts ones (httpd loads /usr/lib/libiconv.2.dylib, so PHP must use the same). I read some articles discouraging of the use of DYLDLIBRARYPATH, as the the path of dynamic library should be fixed using -installname, @rpath, and @loaderpath. In terms of making a program that runs both on Linux and Mac OS X, DYLDLIBRARYPATH of Mac OS X does exactly what LDLIBRARYPATH of Linux. Simba Drivers Couchbase ODBC Installation Guide Mac OS X Installation Setting the DYLDLIBRARYPATH Environment Variable Setting the DYLDLIBRARYPATH Environment Variable For example, if ODBC driver manager libraries are installed in /usr/local/lib. Oct 01, 2015 In the latest release off OS-X using the DYLDLIBRARYPATH is not possible unless System Integrity Protection (SIP) is disabled. Meaning that setting the DYLDLIBRARYPATH will have no effects on spawned sub shells and therefore using the node client is no longer possible unless one turns off (SIP) as explained here.