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 - RHEL 10.0 has
1.8.0 - SLES 15 (SP6, SP7) have
1.5.0
The instructions provided below specify the steps to build libunwind v1.8.3 on Linux on IBM Z for following distributions:
- RHEL (8.10, 9.4, 9.6, 10.0)
- SLES 15 (SP6, SP7)
- 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
export SOURCE_ROOT=/<source_root>/
-
RHEL (8.10, 9.4, 9.6, 10.0)
sudo yum install -y automake gcc git make libtool gcc-c++ -
SLES 15 (SP6, SP7)
sudo zypper install -y 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 -y 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.3 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 #RHEL 8.10 and SLES 15.X
export CFLAGS="-std=gnu99" #Ubuntu 24.04 and Ubuntu 25.04
export CFLAGS="-g -O0" #Ubuntu 22.04 and RHEL 10.0
autoreconf -i
./configure --disable-setjmp #RHEL 10.0
./configure #All except RHEL 10.0
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.X, 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.