libxml2-2.13.3

Introduction to libxml2

The libxml2 package contains libraries and utilities used for parsing XML files.

[Note]

Note

Development versions of GLFS may not build or run some packages properly if LFS or dependencies have been updated since the most recent stable versions of the books.

libxml2 Dependencies

Recommended

Installation of libxml2

First apply the patch to emit bogus warnings and regenerate the build scripts:

patch -Np1 -i ../libxml2-2.13.3-upstream_fix-2.patch &&
autoreconf -fi

Install libxml2 by running the following commands:

./configure --prefix=/usr           \
            --sysconfdir=/etc       \
            --disable-static        \
            --with-history          \
            --with-icu              \
            PYTHON=/usr/bin/python3 \
            --docdir=/usr/share/doc/libxml2-2.13.3 &&
make

Now, as the root user:

make install

Finally, prevent some packages from unnecessarily linking to ICU using the following commands as the root user:

rm -vf /usr/lib/libxml2.la &&
sed '/libs=/s/xml2.*/xml2"/' -i /usr/bin/xml2-config

32-bit Installation of libxml2

First clean the directory:

make distclean

Install lib32-libxml2 by running the following commands:

CC="gcc -m32" CXX="g++ -m32"         \
PKG_CONFIG_PATH=/usr/lib32/pkgconfig \
./configure --prefix=/usr            \
            --libdir=/usr/lib32      \
            --host=i686-pc-linux-gnu \
            --sysconfdir=/etc        \
            --disable-static         \
            --with-history           \
            --with-icu               \
            --without-python &&
make

Now, as the root user:

make DESTDIR=$PWD/DESTDIR install     &&
rm -vf DESTDIR/usr/lib32/libxml2.la   &&
cp -Rv DESTDIR/usr/lib32/* /usr/lib32 &&
rm -rf DESTDIR                        &&
ldconfig

Command Explanations

--disable-static: This switch prevents installation of static versions of the libraries.

--with-history: This switch enables Readline support when running xmlcatalog or xmllint in shell mode.

--with-icu: This switch enables support for ICU, which provides additional Unicode support. This is needed for some packages outside of GLFS, such as for QtWebEngine.

PYTHON=/usr/bin/python3: Allows building the libxml2 module with Python3 instead of Python2.

--without-python: This switch disables building this package for 32-bit on a 64-bit system with Python support as it cannot find Python.

Contents

Installed Programs: xml2-config, xmlcatalog, and xmllint
Installed Libraries: libxml2.so
Installed Directories: /usr/include/libxml2, /usr/lib/cmake/libxml2, /usr/share/doc/libxml2-2.13.3, and /usr/share/gtk-doc/html/libxml2

Short Descriptions

xml2-config

determines the compile and linker flags that should be used to compile and link programs that use libxml2

xmlcatalog

is used to monitor and manipulate XML and SGML catalogs

xmllint

parses XML files and outputs reports (based upon options) to detect errors in XML coding

libxml2.so

provides functions for programs to parse files that use the XML format