I've edited my CMake script to link libcurl with my C application on Linux.
Besides adding libcurl to my target link libraries, I've set the libcurl flag DCURL_STATICLIB
.
What is the definitive way of checking this has linked statically, rather than dynamically?
CodePudding user response:
What is the definitive way of checking this has linked statically, rather than dynamically?
Run the ldd
program on the generated executable(s). This will give you a list of all the shared libraries that are dynamically linked to it. Verify that libcurl.so
is not on the list.
ldd my_executable
It may be useful to engage grep
to filter out other shared libs:
ldd my_executable | grep libcurl
, but because that will produce no output when libcurl
indeed is not dynamically linked to the executable. Nevertheless, the unfiltered form is useful at least for confirming that ldd
actually worked.
CodePudding user response:
Move all libcurl.so
to another location with find and rename it.