libxml2-2.13.3

#### Beyond Linux® From Scratch (systemd Edition) - Version 12.2

### Chapter 9. General Libraries

- Prev

  libxkbcommon-1.7.0

- Next

  libxmlb-0.3.19

- Up
- Home

# libxml2-2.13.3

## 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.2 platform.

### Package Information

- Download (HTTP): https://download.gnome.org/sources/libxml2/2.13/libxml2-2.13.3.tar.xz

- Download MD5 sum: aeb92dc58cea91c95a10751327193a11

- Download size: 2.5 MB

- Estimated disk space required: 111 MB (with tests)

- Estimated build time: 0.4 SBU (Using parallelism=4; with tests)

### Additional Downloads

- Required patch: https://www.linuxfromscratch.org/patches/blfs/12.2/libxml2-2.13.3-upstream_fix-2.patch

- Optional Test Suite: https://www.w3.org/XML/Test/xmlts20130923.tar.gz - This enables make check to do complete testing.

### libxml2 Dependencies

#### Recommended

ICU-75.1

#### Optional

Valgrind-3.23.0 (may be used in the tests)

## Installation of libxml2

At first, fix an issue causing xmlcatalog to emit bogus warnings when a new catalog file is created. The patch will modify the building system, so regenerate the building scripts after applying the patch:

    patch -Np1 -i ../libxml2-2.13.3-upstream_fix-2.patch

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

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.23.0 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.

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

## 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

- Prev

  libxkbcommon-1.7.0

- Next

  libxmlb-0.3.19

- Up
- Home