如何处理可能的dl和glibc库版本不兼容?

时间:2012-11-28 05:23:53

标签: linux gcc openssl glibc dynamic-linking

将OpenSSL链接到我的代码时,将-lssl -lcrypto添加到我的链接步骤,我收到以下错误:

/usr/lib/../lib64/libcrypto.a(fips.o): In function `FIPSCHECK_verify':
(.text+0x8da): undefined reference to `dlopen'
/usr/lib/../lib64/libcrypto.a(fips.o): In function `FIPSCHECK_verify':
(.text+0x8f1): undefined reference to `dlsym'
/usr/lib/../lib64/libcrypto.a(fips.o): In function `FIPSCHECK_verify':
(.text+0x903): undefined reference to `dladdr'
/usr/lib/../lib64/libcrypto.a(fips.o): In function `FIPSCHECK_verify':
(.text+0x90f): undefined reference to `dlclose'
/usr/lib/../lib64/libcrypto.a(fips.o): In function `FIPSCHECK_verify':
(.text+0x98a): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
make: *** [run] Error 1

this Stack Overflow question的回答中,我添加了-ldl,现在我收到以下警告:

/usr/lib/../lib64/libcrypto.a(fips.o): In function `FIPSCHECK_verify':
(.text+0x8da): warning: Using 'dlopen' in statically linked applications
requires at runtime the shared libraries from the glibc version used for linking

这是一个Linux工作站,我不太熟悉如何在"the glibc version used for linking"的库中找出如何链接:

$ uname -a                                                                                                                                                                                             
Linux foo.example.com 2.6.18-274.el5 #1 SMP Fri Jul 8 17:36:59 EDT 2011 x86_64 GNU/Linux

我怎么能解决这个警告?我的一个要求是我需要编译一个静态二进制文件。我认为我不能放松这个要求。如果这是一个愚蠢的问题,请道歉,并感谢您的建议。

0 个答案:

没有答案