2

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?

Jason Hu
  • 6,239
  • 1
  • 20
  • 41

2 Answers2

3

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.

Jason Hu
  • 6,239
  • 1
  • 20
  • 41
0

Had the same problem with Python3 on Solaris Sparc (5.11). OpenCSW version of lxml is for Python 2 only, so had to do the following:

  • Get libxml2 and libz1 from OpenCSW (in my case these were libz1-1.2.8,REV=2013.09.23-SunOS5.10-sparc-CSW and libxml2_2-2.9.3,REV=2016.02.16-SunOS5.10-sparc-CSW, downloaded from openCSW: https://mirror.opencsw.org/opencsw/)
  • Extract corresponding SO files (not sparcv9 versions) from these packages
  • Create symlinks
libxml2.so.2 -> libxml2.so.2.9.3
libxml2.so.2.9.3
libz.so.1 -> libz.so.1.2.8
libz.so.1.2.8
  • Add path to this folder in LD_LIBRARY_PATH variable in your .bashrc
Dmitry.Kolosov
  • 635
  • 4
  • 8