XML Security Library requires the following libraries:
And at least one of the following cryptographic libraries:
- OpenSSL >= 3.0.13 (>= 3.5.0 is recommended)
- LibreSSL >= 3.9.0
- BoringSSL >= 1.1.0
- NSS >= 3.91 (with NSPR >= 4.34.1)
- GnuTLS >= 3.8.3
- Microsoft Cryptography API: Next Generation (CNG)
- (Deprecated) Microsoft Cryptography API
- (Deprecated) GCrypt
For example, install the following packages on Ubuntu to build the XML Security Library:
# common build tools
apt install automake autoconf libtool libtool-bin gcc
# ltdl is required to support dynamic crypto libs loading
apt install libltdl7 libltdl-dev
# core libxml2 and libxslt libraries
apt install libxml2 libxml2-dev libxslt1.1 libxslt1-dev
# openssl libraries
apt install openssl libssl3 libssl-dev
# nspr/nss libraries
apt install libnspr4 libnspr4-dev libnss3 libnss3-dev libnss3-tools
# gnutls libraries
apt install libgnutls30
# gnutls libraries
apt install libgcrypt20 libgcrypt20-dev
# required for building man pages and docs
apt install help2man pandoc doxygen python3
To build and install XML Security Library on Unix-like systems from a release tarball, run the following commands:
gunzip -c xmlsec1-<version>.tar.gz | tar xvf -
cd xmlsec1-<version>
./configure [possible configure options]
make
make check
make install
To build from GitHub, run the following commands:
git clone https://github.com/lsh123/xmlsec.git
cd xmlsec
autoreconf -i -f
./configure [possible configure options]
make
make check
make install
To see the configuration options, run:
./configure --help
Building from the command line is the only supported method. To build
from the command line, you must make sure that your compiler works
there as well. The simplest way is to launch the
x64 Native Tools Command Prompt for VS 2022 (or a similar)
specialized shell environment that automatically sets the necessary
environment variables. Alternatively, you can use vcvars64.bat (or
similar) scripts.
The XML Security Library on Windows uses JScript to configure the
build automatically. JScript is widely available, but if it is not
available on your machine for any reason, you can also configure the
build manually.
To build and install XML Security Library on Windows using Microsoft Visual Studio, run the following commands:
gunzip -c xmlsec1-<version>.tar.gz | tar xvf -
cd xmlsec1-<version>\win32
powershell -ExecutionPolicy Bypass -File configure.ps1 [possible configure options]
nmake
nmake install
To see the configuration options, run:
powershell -ExecutionPolicy Bypass -File configure.ps1 help
Note: Do not use path names that contain spaces. This will fail.
The following command configures the build as follows:
- Use Microsoft Cryptography API: Next Generation (CNG);
- Use the multithreaded, DLL-specific version of the Microsoft Visual Studio C Runtime libraries;
- Use
c:\opt\includeandc:\opt\libas additional search paths for the compiler and the linker; - Include debug symbols in the binaries.
powershell -ExecutionPolicy Bypass -File configure.ps1 crypto=mscng cruntime=/MD prefix=c:\opt include=c:\opt\include lib=c:\opt\lib debug=yes