在构建特定模块时,我收到以下错误:
ld: 0711-317 ERROR: Undefined symbol: .MD5_Init
ld: 0711-317 ERROR: Undefined symbol: .SHA1_Init
ld: 0711-317 ERROR: Undefined symbol: .SHA224_Init
ld: 0711-317 ERROR: Undefined symbol: .SHA256_Init
ld: 0711-317 ERROR: Undefined symbol: .SHA384_Init
ld: 0711-317 ERROR: Undefined symbol: .SHA512_Init
ld: 0711-317 ERROR: Undefined symbol: .SHA1_Update
ld: 0711-317 ERROR: Undefined symbol: .SHA1_Final
ld: 0711-317 ERROR: Undefined symbol: .SHA224_Update
ld: 0711-317 ERROR: Undefined symbol: .SHA224_Final
ld: 0711-317 ERROR: Undefined symbol: .SHA256_Update
ld: 0711-317 ERROR: Undefined symbol: .SHA256_Final
ld: 0711-317 ERROR: Undefined symbol: .SHA384_Update
ld: 0711-317 ERROR: Undefined symbol: .SHA384_Final
ld: 0711-317 ERROR: Undefined symbol: .SHA512_Update
ld: 0711-317 ERROR: Undefined symbol: .SHA512_Final
ld: 0711-317 ERROR: Undefined symbol: .MD5_Update
ld: 0711-317 ERROR: Undefined symbol: .MD5_Final
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make: *** [entity_test] Error 8
我看到这些符号来自openssl的libcrypto.a库: -
$ nm openssl-1.0.2f/libcrypto.so|grep SHA512_Final
.SHA512_Final T 448
SHA512_Final D 3088 24
SHA512_Final d 2976 8
.SHA512_Final U -
我已导出LIBPATH =:$ LIBPATH并使用-lcrypto选项构建。但是从转储输出中,我仍然没有找到来自ldd输出的openssl的libcrypto.so。
ldd lru_test
lru_test needs:
/cb/cb10b/rel/server/lib/libexpat.so
/usr/lib/libpthread.a(shr_xpg5_64.o)
/usr/lib/libiconv.a(shr4_64.o)
/cb/cb10b/rel/server/lib/liblog4cxx.so
/usr/lib/libC.a(shr_64.o)
/usr/lib/libC.a(shr2_64.o)
/usr/lib/libC.a(shr3_64.o)
/usr/lib/libC.a(ansi_64.o)
/usr/lib/libc.a(shr_64.o)
/unix
/usr/lib/libaprutil-1.so
/usr/lib/libapr-1.so
/usr/lib/libC.a(shrcore_64.o)
/usr/lib/libC.a(ansicore_64.o)
/usr/lib/libcrypt.a(shr_64.o)
/usr/lib/libexpat.a(libexpat.so.1)
/usr/lib/libiconv.a(libiconv.so.2)
ar: 0707-109 Member name libiconv.so.2 does not exist.
dump: /tmp/tmpdir22282828/extract/libiconv.so.2: 0654-106 Cannot open the specified file.
/usr/lib/libc.a(shr.o)
/usr/lib/libpthread.a(shr_xpg5.o)
/usr/lib/libcrypt.a(shr.o)
/usr/lib/libpthreads.a(shr_comm.o)
$ dump -H -X32_64 lru_test
lru_test:
***Loader Section***
Loader Header Information
VERSION# #SYMtableENT #RELOCent LENidSTR
0x00000001 0x00000117 0x000023b0 0x00000139
#IMPfilID OFFidSTR LENstrTBL OFFstrTBL
0x0000000a 0x00025560 0x00001d5a 0x00025699
***Import File Strings***
INDEX PATH BASE MEMBER
0 /cb/cb10b/cb/server/lib:/cb/cb10b/rel/server/lib:/opt/IBM/xlmass/8.1.2/lib/aix61:/opt/IBM/xlc/13.1.2/lib:/opt/IBM/xlC/13.1.2/lib:/usr/lib:/lib
1 libexpat.so
2 libpthread.a shr_xpg5_64.o
3 libiconv.a shr4_64.o
4 liblog4cxx.so
5 libC.a shr_64.o
6 libC.a shr2_64.o
7 libC.a shr3_64.o
8 libC.a ansi_64.o
9 libc.a shr_64.o
虽然构建已经过去,但ldd的输出仍然非常令人困惑。 1.为什么libcrypto.so不会在ldd中显示为依赖? 2.但是,如何通过链接器解决上面列出的符号的依赖性?