libxml2-2.15.3

#### Beyond Linux® From Scratch (systemd Edition) - Version r13.0-553

### Chapter 9. General Libraries

- Prev

  libxkbcommon-1.13.1

- Next

  libxmlb-0.3.26

- Up
- Home

# libxml2-2.15.3

## Introduction to libxml2

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

### Note

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

### Package Information

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

- Download MD5 sum: b7b0123654f86ebf630a5cbedaafdece

- Download size: 3.1 MB

- Estimated disk space required: 64 MB (add 27 MB for documentation and 17 MB for tests)

- Estimated build time: less than 0.1 SBU (Using parallelism=4; with tests and documentation)

### Additional Downloads

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

### libxml2 Dependencies

#### Recommended

ICU-78.3

#### Optional (for generating the documentation)

Doxygen-1.17.0 and libxslt-1.1.45

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

    mkdir build &&
    cd    build &&

    meson setup ..            \
          --prefix=/usr       \
          --buildtype=release \
          -D history=enabled  \
          -D icu=enabled      &&
    ninja

If you wish to build and install the manual pages and the documentation, you should have libxslt-1.1.45 and Doxygen-1.17.0 installed, and run:

    sed -e "/^dir_doc/s/\$/ + '-' + meson.project_version()/" \
        -i ../meson.build                                     &&
    meson configure -D docs=enabled                           &&
    ninja

If you downloaded the test suite, issue the following command:

    tar xf ../../xmlts20130923.tar.gz -C ..

To test the results, issue: ninja test.

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

    ninja install

The xml2-config may return flags needed to link against the static library for the project, including the references to the ICU-78.3 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.3 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

`--buildtype=release`: Specify a buildtype suitable for stable releases of the package, as the default may produce unoptimized binaries.

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

## Contents

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

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

- Next

  libxmlb-0.3.26

- Up
- Home