【发布时间】:2016-09-27 10:24:53
【问题描述】:
我正在开发 Red Hat Enterprise Linux Server 7.0 版 (Maipo)。服务器提供 OpenSSL 1.0.1。我在尝试链接到 OpenSSL 时遇到很多加密错误。
这是我的链接命令命令行(命令行中的顺序):
g++ -g -O2 -Wl,-rpath -o output file1.o libprivate_lib1.so -Lprivate_path -llib1 -ldl \
-lpthread -llib2 -lexpat -lgtest -lgtest_main -lboost_regex -lboost_filesystem -llzma \
-lcrypto private_lib2.so private_lib3.so -llib3
以下是一些错误:
/lib64/libssl.so.10: undefined reference to `COMP_zlib@libcrypto.so.10'
/lib64/libssh2.so.1: undefined reference to `EVP_get_cipherbyname@libcrypto.so.10'
/lib64/libssl.so.10: undefined reference to `X509_STORE_free@libcrypto.so.10'
/lib64/libssl.so.10: undefined reference to `BIO_clear_flags@libcrypto.so.10'
/lib64/libssl.so.10: undefined reference to `d2i_KRB5_AUTHENT@libcrypto.so.10'
/lib64/libssl.so.10: undefined reference to `MD5_Transform@libcrypto.so.10'
/lib64/libssl.so.10: undefined reference to `X509_VERIFY_PARAM_set_depth@libcrypto.so.10'
/lib64/libssh2.so.1: undefined reference to `DSA_do_verify@libcrypto.so.10'
/lib64/libssl.so.10: undefined reference to `SHA384_Init@libcrypto.so.10'
/lib64/libssl.so.10: undefined reference to `PEM_ASN1_read_bio@libcrypto.so.10'
/lib64/libssl.so.10: undefined reference to `FIPS_mode@libcrypto.so.10'
/lib64/libssl.so.10: undefined reference to `OBJ_find_sigid_algs@libcrypto.so.10'
/lib64/libssh2.so.1: undefined reference to `BN_bn2bin@libcrypto.so.10'
/lib64/libssl.so.10: undefined reference to `EVP_rc2_40_cbc@libcrypto.so.10'
/lib64/libssl.so.10: undefined reference to `sk_num@libcrypto.so.10'
...
当我跑步时:
ll /usr/lib64/libcrypto.so
我来了
/usr/lib64/libcrypto.so -> libcrypto.so.1.0.1e
运行时:
objdump -tT /usr/lib64/libcrypto.so.1.0.1e | grep COMP_zlib
我明白了
000000000013e500 g DF .text 0000000000000002 libcrypto.so.10 COMP_zlib_cleanup
000000000013e460 g DF .text 000000000000009e libcrypto.so.10 COMP_zlib
所以这意味着我在这个图书馆里有它。 最奇怪的是,它能够在 redhat 6.5/4 中链接,但在 redhat 7 以上时失败。 有什么建议么 ?
【问题讨论】:
-
这个问题不清楚,可能有很多潜在的原因。我们甚至不知道您尝试链接的什么或您正在使用哪些工具的哪个版本,以及您如何使用它们(例如 CLI args)等等。跨度>
-
也许你忘了链接到 libcrypto ?添加
-lcrypto链接标志之后 用于链接到libssl 的标志。或者,您可能正试图链接一些您在与 Red Hat 7.0 不兼容的机器上编译的不兼容库。无论如何,详细描述您的问题是个好主意,例如向我们展示您运行的产生此输出的实际命令。 -
我正在链接加密库(添加了命令行)。我认为它与redhat 7有关。因为它能够在redhat 6.5/4上编译。