由于未定义的符号

时间:2016-09-01 11:34:57

标签: python cpython python-extensions

python扩展lsblib.so由cython和distutils创建,distutil生成的build命令如下:

/gpfs/software/openlava_sqa/3.3.3/etc/../include/lsbatch.h:1681: warning: function declaration isn’t a prototype
gcc -pthread -shared -L/gpfs/DEV/PLT/software/anaconda2-4.0.0/lib -Wl,-rpath=/gpfs/DEV/PLT/software/anaconda2-4.0.0/lib,--no-as-needed build/temp.linux-x86_64-2.7/openlava/lsblib.o /gpfs/software/openlava_sqa/3.3.3/etc/../lib/liblsfint.a /gpfs/software/openlava_sqa/3.3.3/etc/../lib/liblsf.a /gpfs/software/openlava_sqa/3.3.3/etc/../lib/liblsbatch.a -L/gpfs/software/openlava_sqa/3.3.3/etc/../lib -L/gpfs/DEV/PLT/software/anaconda2-4.0.0/lib -llsfint -llsf -llsbatch -lnsl -ltools -lpython2.7 -o build/lib.linux-x86_64-2.7/openlava/lsblib.so -g

请注意,通过lsblib.o + lib * .a和-lXX两次链接四个库,目标模块是 lsblib.so

-llsfint -llsf -llsbatch -lnsl -ltools
build/temp.linux-x86_64-2.7/openlava/lsblib.o /gpfs/software/openlava_sqa/3.3.3/etc/../lib/liblsfint.a /gpfs/software/openlava_sqa/3.3.3/etc/../lib/liblsf.a /gpfs/software/openlava_sqa/3.3.3/etc/../lib/liblsbatch.a

导入模块时:

  

/gpfs/software/openlava_sqa/3.3.3/lib/ liblsbatch.so.0 :undefined   符号:mergeResreq

但是,编译后的 lsblib.so 的符号为

  

000000000009dc9b T mergeResreq

,符号mergeResreq位于liblsfint.a和liblsfinit.so.0.0.1

nm /gpfs/software/openlava_sqa/3.3.3/lib/liblsfint.so.0.0.1 |grep merge
0000000000010017 T mergeResreq
00000000000161d5 t mergeW
nm /gpfs/software/openlava_sqa/3.3.3/lib/liblsfint.a |grep merge
00000000000041ff T mergeResreq
0000000000000581 t mergeW

为什么在导入模块时,它会在错误的lsbatch.so中找到符号?它不使用lsblib.so中的符号,即使我设置了LD_LIBRARY_PATH,它也不会使用lsfint.so .0.0.1

0 个答案:

没有答案