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 (7.8, 7.9, 8.4)
  • SLES (12 SP5, 15 SP3)
  • Ubuntu (18.04, 20.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/Jan2021/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 (7.8, 7.9)

    sudo subscription-manager repos --enable=rhel-7-server-for-system-z-devtools-rpms
    sudo yum install -y wget tar make gcc gcc-c++ bzip2 zlib zlib-devel git devtoolset-7
    scl enable devtoolset-7 bash
    
  • RHEL 8.4

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

    sudo zypper install -y wget git tar cmake zlib-devel gcc7 gcc7-c++
    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
    sudo ln -sf /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc
    
  • SLES 15 SP3

    sudo zypper install -y wget git tar cmake zlib-devel gcc gcc-c++
    sudo ln -sf /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc
    
  • Ubuntu 18.04

    sudo apt-get update
    sudo apt-get install -y build-essential wget make tar git cmake gcc-7 g++-7
    
  • Ubuntu 20.04

    sudo apt-get update
    sudo apt-get install -y wget tar make gcc g++ cmake git curl
    
  • Build Cmake 3.7.2 (Only for RHEL 7.x)

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

    cd $SOURCE_ROOT
    wget https://storage.googleapis.com/golang/go1.15.7.linux-s390x.tar.gz
    tar -xzf go1.15.7.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-Jan2021

1.4) Build BoringSSL

cd $SOURCE_ROOT/boringssl
mkdir build
cd build/
cmake ..
make

Step 2: Testing (Optional)

cd $SOURCE_ROOT/boringssl
go run util/all_tests.go

Reference: