Skip to content

Building XMLSec

linuxonz edited this page Apr 18, 2024 · 44 revisions

Building XMLSec

Below versions of XMLSec are available in respective distributions:

  • RHEL (7.8, 7.9) have 1.2.20
  • RHEL (8.6, 8.8, 8.9) have 1.2.25
  • RHEL (9.0, 9.2, 9.3) have 1.2.29
  • SLES (12 SP5, 15 SP5) have 1.2.37
  • Ubuntu 20.04 has 1.2.28
  • Ubuntu 22.04 has 1.2.33
  • Ubuntu 23.10 has 1.2.37

The instructions provided below specify the steps to build XMLSec 1.3.4 on Linux on IBM Z for following distributions:

  • RHEL (7.8, 7.9, 8.6, 8.8, 8.9, 9.0, 9.2, 9.3)
  • SLES (12 SP5, 15 SP5)
  • Ubuntu (20.04, 22.04, 23.10)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.
  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it

Build XMLSec

Step 1: Build using script

If you want to build XMLSec using manual steps, go to Step 2. Use the following commands to build XMLSec using the build script. Please make sure you have wget installed.

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/XMLSec/1.3.4/build_xmlsec.sh
# Build XMLSec
bash build_xmlsec.sh   [Provide -t option for executing build with tests]

In case of error, check logs for more details or go to STEP 2 to follow manual build steps.

Step 2: Build and Install XMLSec

2.1) Install dependencies

  • RHEL (7.8, 7.9)

    sudo yum install -y git make libtool libxslt-devel libtool-ltdl-devel diffutils devtoolset-7 texinfo gettext python2-devel wget tar
  • RHEL (8.6, 8.8, 8.9)

    sudo yum install -y git make libtool libxslt-devel libtool-ltdl-devel diffutils openssl-devel wget tar texinfo gettext python2-devel 
  • RHEL (9.0, 9.2, 9.3)

    sudo yum install -y git make libtool libxslt-devel libtool-ltdl-devel diffutils tar wget perl-CPAN
  • SLES 12 SP5

    sudo zypper install -y wget libxslt-tools libxml2-tools libxml2-devel git-core make libtool libxslt-devel libopenssl-devel gawk gcc7 gcc7-c++ texinfo gettext transfig 
    sudo ln -sf /usr/bin/gcc-7 /usr/bin/gcc
    sudo ln -sf /usr/bin/g++-7 /usr/bin/g++
    sudo ln -sf /usr/bin/gcc /usr/bin/cc
  • SLES 15 SP5

    sudo zypper install -y git-core gcc make libtool libxslt-devel libopenssl-devel gawk
  • Ubuntu (20.04, 22.04, 23.10)

    sudo apt-get update
    sudo apt-get install -y git make libtool libxslt1-dev autoconf libssl-dev libtool-bin pkg-config libxmlsec1-openssl

2.2) Enable Software Collections: (Only for RHEL 7.x)

Xmlsec requires GCC 7. It is available on RHEL 7.x via the 'Software Collections' packaging system. You can find out more about Software Collections here: https://www.softwarecollections.org/en/.

Following command will enable GCC 7. The changes are not persistent and these commands will need to be re-run every time a new terminal session is started.

scl enable devtoolset-7 bash

2.3) Set the ACLOCAL_PATH and PKG_CONFIG_PATH(Only for RHEL 7.x and RHEL 8.x)

export ACLOCAL_PATH=/usr/share/aclocal
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig

2.4) Build and install automake and libxml2 from source(Only for RHEL 7.x and RHEL 8.x)

cd $SOURCE_ROOT
git clone https://github.com/autotools-mirror/automake.git
cd automake
git checkout v1.16.5
./bootstrap
./configure
make
sudo make install
automake --version

cd $SOURCE_ROOT
git clone https://github.com/GNOME/libxml2.git
cd libxml2/
git checkout v2.10.4
./autogen.sh
make
sudo make install 
xml2-config --version

2.5) Build and install OpenSSL from source(Only for Ubuntu 22.04, RHEL 7.X, RHEL 9.X and SLES 12 SP5)

Openssl 3.0 is available in repository for ubuntu 22.04 which is not supported by libtools

cd $SOURCE_ROOT
wget https://www.openssl.org/source/openssl-1.1.1h.tar.gz
tar -xzvf openssl-1.1.1h.tar.gz
cd openssl-1.1.1h
./config --prefix=/usr/local --openssldir=/usr/local
make
sudo make install

export LDFLAGS="-L/usr/local/lib/ -L/usr/local/lib64/"
export LD_LIBRARY_PATH=/usr/local/lib/:/usr/local/lib64/:/usr/lib/:/usr/lib64/${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CPPFLAGS="-I/usr/local/include/ -I/usr/local/include/openssl"
openssl version

2.6) Get the source code

cd $SOURCE_ROOT
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
git clone https://github.com/lsh123/xmlsec.git
cd xmlsec
git checkout xmlsec_1_3_4

2.7) Generate and then run the configuration

./autogen.sh # Only for ubuntu 
./autogen.sh --without-gcrypt --with-openssl # Only for RHEL and SLES

2.8) Build and (optionally) test

make
make check

2.9) Install XMLSec and verify the installation

sudo make install
xmlsec1 --version
xmlsec1-config --version

References:

Clone this wiki locally