Installation of libxml2
First, apply a patch from upstream to fix a failure parsing not
normalized yet attribute values (for example, the source of BLFS
itself and the source of PostgreSQL-17.6 contain such values):
patch -Np1 -i ../libxml2-2.15.0-upstream_fix-1.patch
Install libxml2 by running the
following commands:
./configure --prefix=/usr \
--sysconfdir=/etc \
--disable-static \
--with-history \
--with-icu \
--docdir=/usr/share/doc/libxml2-2.15.0 &&
make
If you downloaded the test suite, issue the following command:
tar xf ../xmlts20130923.tar.gz
To test the results, issue: make
check > check.log. This command will print
several lines of error messages like “Failed to
parse xstc/...
” because some test files are
missing and these messages can be safely ignored. A summary of the
results can be obtained with grep -E
'^Total|expected|Ran' check.log. If Valgrind-3.25.1 is
installed and you want to check for memory leaks, replace
check with
check-valgrind.
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, 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
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 in BLFS, such as for QtWebEngine.
--with-python PYTHON=/usr/bin/python3
:
This combination of switches enable the libxml2 bindings for Python
3. Note that those bindings are deprecated due to flaws in the API
design and they will be removed in libxml2-2.16.