Linux HOWTOs

About | Home | Search


HOWTO: libxml
Description: XML C library for Gnome (used by more than just Gnome though)
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# libxml
# ======
# There are three versions of libxml in this howto.  The latest version of
# libxml 1.x (1.8.17), version 2.5.11 just in case the latest is too new,
# and the latest version of 2.x

# Slackware 9.0, 9.1, (not 10.0), 10.1, 10.2, and 11.0's 'libxml' packages
# in 'pasture' include version 1.8.17
#
# Slackware 9.0's 'libxml2' package includes version 2.5.4, 9.1's includes
# 2.5.11, 10.0's includes 2.6.9, 10.1's includes 2.6.16, 10.2's includes
# 2.6.21, 11.0's includes 2.6.26, and 12.0's includes 2.6.28

# If you have a libxml (1.x or 2.x) that's installed under /usr/local, cd
# into it's source and run 'make uninstall' before proceeding here.  If you
# don't have the source, download it, run configure (as shown below) and
# then run 'make uninstall'.  You can also run this to remove most files for
# old versions (and don't forget to remove source and tarballs too):
su
find /usr/local/lib -type f -name "libxml2.so.*" -exec rm {} \;
find /usr/lib -type f -name "libxml2.so.*" -exec rm {} \;
find /usr/local/doc -type d -name "libxml2-*" -exec rm -r {} \; 2> /dev/null
find /usr/doc -type d -name "libxml2-*" -exec rm -r {} \; 2> /dev/null
test -d /usr/local/include/libxml2 && rm -r /usr/local/include/libxml2
test -d /usr/include/libxml2 && rm -r /usr/include/libxml2
exit

# Prerequisites (for all versions):
# zlib (optional)
# iconv (optional)
# Python (optional)


# libxml 1.8.17
# =============
cd
test -f installed/libxml-1.8.17.tar.bz2 &&
 mv installed/libxml-1.8.17.tar.bz2 .
test ! -f libxml-1.8.17.tar.bz2 &&
 wget http://ftp.gnome.org/pub/GNOME/sources/libxml/1.8/\
libxml-1.8.17.tar.bz2

# Verify tarball w/ md5sum:
echo "c7d1b9b1cbfcfbbc56c92f424c37d32c  libxml-1.8.17.tar.bz2" | md5sum -c

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "libxml-*" -exec rm -r {} \;
tar xjvf ~/libxml-1.8.17.tar.bz2
cd libxml-1.8.17
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr
make

# Become root to install it
su

test -x /sbin/removepkg && /sbin/removepkg libxml
rm -f /usr/lib/libxml.*
make install
ldconfig

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/libxml-*.tar.*
mv libxml-1.8.17.tar.bz2 installed/


# libxml2 2.5.11
# ==============
cd
test -f installed/libxml2-2.5.11.tar.bz2 &&
 mv installed/libxml2-2.5.11.tar.bz2 .
test ! -f libxml2-2.5.11.tar.bz2 &&
 wget http://ftp.gnome.org/pub/GNOME/sources/libxml2/2.5/\
libxml2-2.5.11.tar.bz2

# Verify tarball w/ md5sum:
echo "5b6d9dae5f07f5827e194c69ac1723c1  libxml2-2.5.11.tar.bz2" | md5sum -c

# If you get a complaint (watch for it, it'll blow by) about ./missing being
# too old, you can run 'autoreconf -f -i' before running configure to pretty
# up the autoconf/automake/aclocal files (including ./missing).  This is
# probably not necessary to get things to compile, but if you want
# everything to be peachy, that'll do it.

# If you want to build Python bindings for libxml (if you have Python
# installed), add --with-python to the configure line below.

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "libxml2-*" -exec rm -r {} \;
tar xjvf ~/libxml2-2.5.11.tar.bz2
cd libxml2-2.5.11
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr
make

# Become root to install it
su

test -x /sbin/removepkg && /sbin/removepkg libxml2
rm -f /usr/lib/libxml2.*
find /usr/doc -type d -name "libxml2-*" -exec rm -r {} \; 2> /dev/null
make install
ldconfig
ln -sf /usr/include/libxml2/libxml/*.h /usr/include/libxml2/

# Become yourself again
exit

make tests
cd
mkdir -p -m 0700 installed
rm -f installed/libxml2-*.tar.*
mv libxml2-2.5.11.tar.bz2 installed/


# libxml2 2.6.32
# ==============
cd
test -f installed/libxml2-2.6.32.tar.gz &&
 mv installed/libxml2-2.6.32.tar.gz .
test ! -f libxml2-2.6.32.tar.gz &&
 wget ftp://xmlsoft.org/libxml2/libxml2-2.6.32.tar.gz

# Verify tarball w/ md5sum:
# (this came from Jason, I couldn't find one elsewhere)
echo "2621d322c16f0257e30f0ff2b13384de  libxml2-2.6.32.tar.gz" | md5sum -c

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "libxml2-*" -exec rm -r {} \;
tar xzvf ~/libxml2-2.6.32.tar.gz
cd libxml2-2.6.32
test $UID = 0 && chown -R root:root .

# If you want to build Python bindings for libxml (if you have Python
# installed), add --with-python to the configure line.

./configure --prefix=/usr
make

# Become root to install it
su

# Remove files from old versions
test -x /sbin/removepkg && /sbin/removepkg libxml2
rm -f /usr/lib/libxml2.*
find /usr/doc -type d -name "libxml2-*" -exec rm -r {} \; 2> /dev/null

# Install it
make install
ldconfig
ln -sf /usr/include/libxml2/libxml/*.h /usr/include/libxml2/

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .

# Become yourself again
exit

# Optional, but recommended (if you have the time)
make tests

cd
mkdir -p -m 0700 installed
rm -f installed/libxml2-*.tar.*
mv libxml2-2.6.32.tar.gz installed/

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>