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 12.4 platform.
Package Information
Download (HTTP): https://download.gnome.org/sources/libxml2/2.15/libxml2-2.15.1.tar.xz
Download SHA256 Sum: c008bac08fd5c7b4a87f7b8a71f283fa581d80d80ff8d2efd3b26224c39bc54c
Download MD5 sum: fcf38f534bb8996984dba978ee3e27f4
Download size: 1.9 MB
Estimated disk space required: 49 MB (add 28 MB for documentation and 16 MB for tests)
Estimated build time: less than 0.1 SBU (Using parallelism=4; with tests and documentation)
Additional Downloads
libxml2 Dependencies
Recommended
ICU-78.1
Optional (for generating the documentation)
"doxygen" and
libxslt-1.1.43
Installation of libxml2
First, remove an unnecessary call to git in
meson.build:
sed -i "/'git'/,+3d" meson.build
Install libxml2 by running the following
commands:
meson setup build \
--prefix=/usr \
-D history=enabled \
-D icu=enabled
Now build libxml2, issue the following command:
ninja -C build
If you downloaded the test suite, and want to test the results
issue the following commands:
tar xf ../xmlts20130923.tar.gz
ninja -C build test
![[Note]](../images/note.png)
Note
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, Install as the root user:
ninja -C build install
The xml2-config may return flags needed to link
against the static library for the project, including the references
to the ICU-78.1 libraries. That would be pointless
because we only install the shared library. To make things worse,
that may cause some packages using libxml2
to be unnecessarily linked against some ICU-78.1 library,
then those packages will need a rebuild if ICU is upgraded to a new
major version. Fix this by issuing, as root:
sed "s/--static/--shared/" -i /usr/bin/xml2-config
Command Explanations
-D history=enabled: This switch enables
Readline support when running
xmlcatalog or xmllint in shell mode.
-D icu=enabled: This switch enables support for
ICU, which provides additional Unicode support.
This is needed for some packages in BLFS, such as for QtWebEngine.
-D python=enabled: This switch enables the libxml2
Python bindings. Note
that those bindings are deprecated due to flaws in the API design and
they will be removed in libxml2-2.16.