0

在 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

这个 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

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

4

0 回答 0