Building BoringSSL - linux-on-ibm-z/docs GitHub Wiki

Building BoringSSL

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

  • RHEL (8.8, 8.9, 8.10, 9.2, 9.3, 9.4)
  • SLES (12 SP5, 15 SP5)
  • Ubuntu (20.04, 22.04, 23.10, 24.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.

Step 1: Build and Install BoringSSL

1.1) Build using script

If you want to build boringssl using manual steps, go to STEP 1.2.

Use the following commands to build boringssl using the build script. Please make sure you have wget installed.

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/BoringSSL/Aug2023/build_boringssl.sh

# Build boringssl
bash build_boringssl.sh   [Provide -t option for executing build with tests]   

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

1.2) Install dependencies

export SOURCE_ROOT=/<source_root>/
  • RHEL (8.8, 8.9, 8.10)

    sudo yum install -y wget tar make gcc-toolset-12-gcc-c++ gcc-toolset-12-libstdc++-devel bzip2 zlib zlib-devel git xz diffutils cmake ninja-build libarchive-devel.s390x curl
    source /opt/rh/gcc-toolset-12/enable
    
  • RHEL (9.2, 9.3, 9.4)

    sudo yum install -y wget tar make gcc gcc-c++ bzip2 zlib zlib-devel git xz diffutils cmake ninja-build libarchive-devel.s390x
    sudo yum install -y --allowerasing curl
    
  • SLES 12 SP5

    sudo zypper install -y wget git tar gzip ninja zlib-devel gcc12 gcc12-c++ make openssl-devel curl
    export CC=/usr/bin/gcc-12
    export CXX=/usr/bin/g++-12
    
  • SLES 15 SP5

    sudo zypper install -y wget git tar gzip cmake ninja zlib-devel gcc12 gcc12-c++ curl
    export CC=/usr/bin/gcc-12
    export CXX=/usr/bin/g++-12
    
  • Ubuntu (20.04, 22.04, 24.04)

    sudo apt-get update
    sudo apt-get install -y wget tar make gcc g++ cmake ninja-build git curl
    
  • Build Cmake 3.29.5 (Only for SLES 12 SP5)

    cd $SOURCE_ROOT
    wget https://cmake.org/files/v3.29/cmake-3.29.5.tar.gz
    tar xzf cmake-3.29.5.tar.gz
    cd cmake-3.29.5
    ./configure --prefix=/usr/local
    make && sudo make install
    
  • Install Go - v1.22.4

    cd $SOURCE_ROOT
    wget https://storage.googleapis.com/golang/go1.22.4.linux-s390x.tar.gz
    tar -xzf go1.22.4.linux-s390x.tar.gz
    export PATH=$SOURCE_ROOT/go/bin:$PATH
    export GOROOT=$SOURCE_ROOT/go
    export GOPATH=$SOURCE_ROOT/go/bin
    go version
    

1.3) Download source code

cd $SOURCE_ROOT
git clone https://github.com/linux-on-ibm-z/boringssl
cd boringssl
git checkout patch-s390x-Aug2023

1.4) Build BoringSSL

cd $SOURCE_ROOT/boringssl
curl -sSL https://github.com/google/boringssl/commit/e3d9b69e8c6f6b78120006282c020c71803a8075.patch | git apply - # Only for Ubuntu (23.10 and 24.04)
mkdir build
cd build/
cmake -G Ninja ..
cd ..
ninja -C build

Step 2: Testing (Optional)

cd $SOURCE_ROOT/boringssl
ninja -C build run_tests

Reference: