使用以下 CMakeLists.txt (我尝试将其剪切 AMAP)
https://gist.github.com/pbertoni/29200833dc562ab6ee2c
make
我在链接时收到此错误:
/usr/bin/ld: CMakeFiles/blockmon.dir/bin/blockmon.cpp.o: undefined reference to symbol 'SSL_load_error_strings@@OPENSSL_1.0.0'
//lib/x86_64-linux-gnu/libssl.so.1.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
/usr/bin/ld: CMakeFiles/blockmonWithXmlRPC.dir/bin/blockmonWithXmlRPC.cpp.o: undefined reference to symbol 'SSL_load_error_strings@@OPENSSL_1.0.0'
//lib/x86_64-linux-gnu/libssl.so.1.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
对于 Cmake 所针对的两个可执行文件中的每一个。输出:
ldd /lib/x86_64-linux-gnu/libssl.so.1.0.0
是
linux-vdso.so.1 => (0x00007ffc5a1f4000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fad78c52000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fad7888d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fad78688000)
/lib64/ld-linux-x86-64.so.2 (0x00007fad792bd000)
我在用着Ubuntu 14.04.2 LTS x64
。请注意,在Debian 7.8 x64
系统上有用!
我试图根据这个要点来剪切可执行代码。
答案1
开发人员删除了该符号。看https://github.com/openssl/openssl/blob/72257204bd2a88773461150765dfd0e0a428ee86/include/openssl/ssl.h#L1495您需要做的是添加#define OPENSSL_API_COMPAT 0x0908
某处以将符号定义为宏。