Statically linking libxml2 into an application I was building was causing issues like the following messages:
/usr/lib/x86_64-linux-gnu/libxml2.a(xzlib.o): In function `xz_decomp': (.text+0x5de): undefined reference to `lzma_code' /usr/lib/x86_64-linux-gnu/libxml2.a(xzlib.o): In function `xz_make': (.text+0x9d5): undefined reference to `lzma_properties_decode' /usr/lib/x86_64-linux-gnu/libxml2.a(xzlib.o): In function `xz_make': (.text+0xc09): undefined reference to `lzma_auto_decoder' /usr/lib/x86_64-linux-gnu/libxml2.a(xzlib.o): In function `__libxml2_xzclose': (.text+0x16a5): undefined reference to `lzma_end'
Debian Bug report logs - #697382 indicates that there might be a small package error. Debian Wheezy uses package '2.8.0+dfsg1-7+nmu1'. The bug was fixed in package 'libxml2/2.9.1+dfsg1-1'. So now the question: how to just update that package? The first answer might reside with the concept of backports.
Based upon the instructions at Debian Backports - Instructions , it should be as easy as putting the following line in /etc/apt/sources.list
# Backports repository #deb http://ftp.debian.org/debian wheezy-backports main contrib non-free
and then running:
apt-get update apt-get -t wheezy-backports install libxml2
This didn't solve my problem.
I was introduced to the next style of solution at Installing a newer version of a package on Debian stable. The concept is further explained, in some what confusing detail, at the wiki entry AptPreferences. The basics include putting the following into /etc/apt/sources.list (and commenting out the lines put in there based upon my instructions above):
## Testing deb http://ftp.debian.org/debian/ testing main contrib non-free ## Testing Security updates deb http://security.debian.org/ testing/updates main contrib
and the following into /etc/apt/preferences:
Package: * Pin: release a=stable Pin-Priority: 700 Package: * Pin: release a=testing Pin-Priority: 650 Package: * Pin: release a=unstable Pin-Priority: 600
Running the following, half solved my problem:
apt-get update apt-get -t testing install libxml2
The real solution was to realize that I had installed the wrong dependent package, and that I really needed to install the correct package:
apt-get install liblzma-dev
As part of this process, I learned about a new command, something which will list the dependencies of a particular library:
pkg-config --libs --static libxml-2.0