I am using Libcurl in my application with C and GNU compiler on a linux machine.
Application also uses OpenSSL libraries and some other libraries. I am trying to statically link the libraries, except for lcurl
linking with other libraries works fine.
I am trying to compile as below.
gcc -static -I. -o test test.c -lz -lssl -lcrypto -lcurl
Am I doing anything wrong? Is there a way to force static linking of some librairies (libc for exemple) ?
Libcurl is itself linked against a ton of other libraries, most of which aren't included in your compile command line. For instance, mine (on Debian Squeeze) links against:
(You can get a similar list for yourself by running ldd
on the library on Linux, or otool -L
on Darwin.)