Building libunwind - linux-on-ibm-z/docs GitHub Wiki
Building libunwind
Below versions of Libunwind are available in respective distributions at the time creation of these build instructions:
- RHEL (9.4, 9.6) have
1.6.2
- SLES 15 SP6 has
1.5.0
The instructions provided below specify the steps to build libunwind v1.8.2 on Linux on IBM Z for following distributions:
- RHEL (8.10, 9.4, 9.6)
- SLES 15 SP6
- Ubuntu (22.04, 24.04, 25.04)
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.
1. Build and Install
1.1. Install dependencies
- RHEL (8.10, 9.4, 9.6)
sudo yum install automake gcc git make libtool gcc-c++
- SLES 15 SP6
sudo zypper install automake gcc git make texinfo libtool pkg-config gcc-c++
- Ubuntu (22.04, 24.04, 25.04)
sudo apt-get update
sudo apt-get install automake gcc g++ git make texinfo libtool libltdl-dev pkg-config
1.2. Build and install Libunwind
cd $SOURCE_ROOT
git clone -b v1.8.2 https://github.com/libunwind/libunwind
cd libunwind
perl -pi -e 's/#if defined\(SYS_mmap\) && !defined\(__i386__\)/#if defined(SYS_mmap) && !defined(__i386__) && !defined(__s390x__)/ if $. == 229' include/libunwind_i.h
sed -i '52s/.*/unw_word_t _UPT_ptrauth_insn_mask (unw_addr_space_t as, void *arg)/' src/ptrace/_UPT_ptrauth_insn_mask.c #Only for RHEL 8.10 and SLES 15 SP6
export CFLAGS="-std=gnu99" #Only for ubuntu 24.04 and ubuntu 25.04
export CFLAGS="-g -O0" #Only for ubuntu 22.04
autoreconf -i
./configure
make
sudo make install
1.3. Run Unit and Performance Tests (Optional)
cd $SOURCE_ROOT/libunwind
make check
cd $SOURCE_ROOT/libunwind/tests
make perf
Note: The test-ptrace test case is failing on SLE 15.6, and the run-ptrace-misc test case is failing on RHEL 8.10. Both failures are attributed to kernel limitations and imperfect implementation of the upstream kernal ptrace system call.