Introduction to libxml2

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

This package is known to build and work properly using an LFS-8.2 platform.

Package Information

Additional Downloads

libxml2 Dependencies





Some packages which utilize libxml2 (such as GNOME Doc Utils) need the Python3 module installed to function properly and some packages will not build properly if the Python3 module is not available.

The old Python2 module can be built after has been installed, see libxml2-2.9.8 (for Python2).


ICU-60.2 and Valgrind-3.13.0 (may be used in the tests)

User Notes:

Installation of libxml2

First apply a patch, which prevents segfaults in the Python module, when built by Python-3.6.4:

patch -Np1 -i ../libxml2-2.9.8-python3_hack-1.patch

To ensure that the Python module can be built by Python-3.6.4, run:

sed -i '/_PyVerify_fd/,+1d' python/types.c

Install libxml2 by running the following commands:

./configure --prefix=/usr    \
            --disable-static \
            --with-history   \
            --with-python=/usr/bin/python3 &&

If you downloaded the testsuite, issue the following command:

tar xf ../xmlts20130923.tar.gz

To test the results, issue: make check > check.log. A summary of the results can be obtained with grep -E '^Total|expected' check.log. If Valgrind-3.13.0 is installed and you want to check memory leaks, replace check with check-valgrind.



The tests use http://localhost/ to test parsing of external entities. If the machine where you run the tests serves as a web site, the tests may hang, depending on the content of the file served. It is therefore recommended to shut down the server during the tests, as the root user:

systemctl stop httpd.service

Now, as the root user:

make install

Command Explanations

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

sed -i '/_PyVerify_fd/,+1d' python/types.c: This fixes the Python3 code to build with gcc-7.

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

--with-python=/usr/bin/python3: Allows to build the libxml2 module with Python3 instead of Python2.

--with-icu: Add this switch if you have built ICU-60.2, for better unicode support.

--with-threads: Add this switch to enable multithread support.


Installed Programs: xml2-config, xmlcatalog, xmllint and the and Python3 modules.
Installed Libraries: and optionally, the Python3 module
Installed Directories: /usr/include/libxml2, /usr/lib/cmake/libxml2, /usr/share/doc/libxml2-2.9.8, /usr/share/doc/libxml2-python-2.9.8, and /usr/share/gtk-doc/html/libxml2

Short Descriptions


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


is used to monitor and manipulate XML and SGML catalogs.


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

is a SAX Python3 driver for libxml2.

is the Python3 binding for libxml2.

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

is the interface for Python3 to use

Last updated on 2018-03-23 08:22:45 -0500