您如何链接到GCC中的特定版本的共享库 [英] How do you link to a specific version of a shared library in GCC
问题描述
我发现如果我指定了 -lcurl 它将链接到libcurl.so.4但Debian 4系统只有libcurl.so.3
有没有办法我可以告诉GCC链接到libcurl .so.3(存在于Debian 4和5中)或只是libcurl.so,所以它将使用任何可用的版本?
您可以在链接器命令行上传递实际的.so文件而不是-l,它应该做你想要的。
I'm compiling some code which uses libcurl on a Debian Linux system. My dev machine is running Debian 5 but I want the binary to be usable on older Debian 4 systems too.
I find that if I specify -lcurl it will link to libcurl.so.4 but Debian 4 systems only have libcurl.so.3
Is there some way I can tell GCC to link to either libcurl.so.3 (which exists in both Debian 4 and 5) or just libcurl.so so it will use whatever version is available ?
You can pass the actual .so file instead of -l on the linker command line, and it ought to do what you want.
这篇关于您如何链接到GCC中的特定版本的共享库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!