Failed to linked symbol in .so file while the symbol exists

不羁岁月 提交于 2019-12-22 17:49:16

问题


I want to install lxml module in my unix system, and it doesn't work. the problem is failed to reference symbol:

Python 2.6.4 (r264:75706, Sep 12 2010, 18:46:30) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: ld.so.1: isapython2.6: fatal: relocation error: file lxml/etree.so: symbol __xmlStructuredErrorContext: referenced symbol not found

however, the output of ldd command is:

$ ldd lxml/etree.so
        libxslt.so.1 =>  /usr/lib/libxslt.so.1
        libexslt.so.0 =>         /usr/lib/libexslt.so.0
        libxml2.so.2 =>  /lib/libxml2.so.2
        libz.so.1 =>     /lib/libz.so.1
        libm.so.2 =>     /lib/libm.so.2
        libpython2.6.so.1.0 =>   /usr/lib/libpython2.6.so.1.0
        libgcc_s.so.1 =>         /usr/sfw/lib/libgcc_s.so.1
        libpthread.so.1 =>       /lib/libpthread.so.1
        libsocket.so.1 =>        /lib/libsocket.so.1
        libnsl.so.1 =>   /lib/libnsl.so.1
        libc.so.1 =>     /lib/libc.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libmp.so.2 =>    /lib/libmp.so.2
        libmd.so.1 =>    /lib/libmd.so.1

and found out:

$ nm /lib/libxml2.so.2 | grep __xmlStructuredErrorContext
000a99e8 t __xmlStructuredErrorContext

this makes me sick. there is a symbol there why it just can't link? do i lack of something?


回答1:


ok. this question is from long time ago. i found out why is that:

notice:

$ nm /lib/libxml2.so.2 | grep __xmlStructuredErrorContext
000a99e8 t __xmlStructuredErrorContext

this symbol has attribute of t, which is local, which won't be exported. it happens because the library is tooooooooo old.

but unfortunately, if you are working on solaris system, if you try to update libxml2 by compiling it from source, it will fail, because of bug in either compiler or source. further reference in: http://blog.gmane.org/gmane.comp.gnome.lib.xslt/month=20110201

actually there is a short cut to install lxml with pre-compiled package using openCSW:

pkgadd -d http://get.opencsw.org/now
/opt/csw/bin/pkgutil -U
/opt/csw/bin/pkgutil -y -i python27 py_lxml

it will just work.



来源:https://stackoverflow.com/questions/26488797/failed-to-linked-symbol-in-so-file-while-the-symbol-exists

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!