“未定义的符号:libiconv”但没有与libiconv的链接?

时间:2014-10-31 13:20:56

标签: python gcc linker lxml loader

我刚为python编译了lxml,我尝试导入它:

>>> from lxml import etree
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /<truncated>/lxml/etree.cpython-34m.so: undefined symbol: libiconv

但奇怪的是,动态库中没有libiconv

$ ldd /<truncated>/lxml/etree.cpython-34m.so
librt.so.1 => /lib64/librt.so.1 (0x00002b32e2371000)
libgcrypt.so.11 => /usr/lib64/libgcrypt.so.11 (0x00002b32e257a000)
libz.so.1 => /usr/lib64/libz.so.1 (0x00002b32e27ec000)
libm.so.6 => /lib64/libm.so.6 (0x00002b32e2a01000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b32e2c84000)
libc.so.6 => /lib64/libc.so.6 (0x00002b32e2e9f000)
/lib64/ld-linux-x86-64.so.2 (0x000000305fc00000)
libgpg-error.so.0 => /usr/lib64/libgpg-error.so.0 (0x00002b32e31f7000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b32e33fa000)

但我使用nm:我发现它有libiconv作为符号:

$ nm /<truncated>/lxml/etree.cpython-34m.so | grep iconv
             U libiconv
             U libiconv_close
             U libiconv_open

我不明白这里的东西,因为我无法弄清楚如何让它看到那个符号。

如果你想知道我用来安装lxml的构建命令是

CFLAGS="-fPIC" LDFLAGS="-lrt -lgcrypt -liconv" STATIC_DEPS=true pip install lxml

0 个答案:

没有答案