I have a program I'm compiling that requires a new version of Curl. Mac default Curl is in /usr/bin and /usr/lib. I have compiled a newer version of curl and compiled using:
gcc mypgm.c -I ./curl-7.58.0/include/curl -I ./cJSON-master -L ./cJSON-master/build ./libcjson.1.7.1.dylib ./libcurl.4.dylib -o mypgm
When I run mypgm I get the error:
Incompatible library version: mypgm requires version 10.0.0 or later, but libcurl.4.dylib provides version 7.0.0
Running otool
I found that the libcurl in my build dir is correct, but it seems to be wanting to use the /usr/lib version, which can't be deleted (without disable SIP, delete, reenable, which I don't want to do in case some future version reinstalls).
So my question is two-fold.
- I want to know if it is possible like with
$PATH
to change the way macOS finds libraries (I read something aboutLD_LIBRARY_PATH
andDYLD_LIBRARY_PATH
being ignored), and - How should I redo the
gcc
line to static link those libraries?