Skip to content

Building netty tcnative

linuxonz edited this page Sep 12, 2024 · 44 revisions

Building netty-tcnative

Below versions of netty-tcnative are available in respective distributions at the time of creation of these build instructions:

  • SLES 15 SP5 has 2.0.65
  • SLES 15 SP6 has 2.0.65

The instructions provided below specify the steps to build netty-tcnative v2.0.66 on Linux on IBM Z for following distributions:

  • RHEL (8.8, 8.10, 9.2, 9.4)
  • SLES (12 SP5, 15 SP5, 15 SP6)
  • Ubuntu (20.04, 22.04, 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 using script

If you want to build netty-tcnative using manual steps, go to STEP 2.

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

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/netty-tcnative/2.0.66/build_netty.sh

# Build netty-tcnative
bash build_netty.sh [Provide -h to see a list of supported Java JDK variant]

If the build completes successfully, go to STEP 5. In case of error, check logs for more details or go to STEP 2 to follow manual build steps.

Step 2: Install dependencies

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

    sudo yum install -y ninja-build cmake perl gcc gcc-c++ libarchive openssl-devel apr-devel autoconf automake libtool make tar git wget golang curl libstdc++-static.s390x xz-devel gzip libcryptui-devel python3-devel patch
  • SLES (12 SP5, 15 SP5, 15 SP6)

    sudo zypper ref -s
    sudo zypper install -y perl libopenssl-devel libapr1-devel autoconf automake libtool make tar git wget curl gcc7 gcc7-c++ gmake xz-devel gzip python3-devel patch go ninja cmake libnghttp2-devel awk
    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
  • Ubuntu (20.04, 22.04, 24.04)

    sudo apt-get update
    sudo apt-get install -y ninja-build cmake perl golang libssl-dev libapr1-dev autoconf automake libtool make tar git wget curl libtool-bin xz-utils gzip python3
2.1) Install Java
  • With IBM Semeru Runtime (previously known as AdoptOpenJDK openj9).

    • Download and install IBM Semeru Runtime (Java 8, 11 or 17) from here.
  • With Eclipse Adoptium Temurin Runtime (previously known as AdoptOpenJDK hotspot)

    • Download and install Eclipse Adoptium Temurin Runtime (Java 11 or 17) from here.
  • With OpenJDK 17

    • RHEL (8.8, 8.10, 9.2, 9.4)

      sudo yum install -y java-17-openjdk java-17-openjdk-devel
    • SLES (15 SP5, 15 SP6)

      sudo zypper install -y java-17-openjdk java-17-openjdk-devel
    • Ubuntu (20.04, 22.04, 24.04)

      sudo apt-get install -y openjdk-17-jdk
  • With OpenJDK 11

    • RHEL (8.8, 8.10, 9.2, 9.4)
      sudo yum install -y java-11-openjdk-devel
    • SLES (12 SP5, 15 SP5, 15 SP6)
      sudo zypper install -y java-11-openjdk java-11-openjdk-devel
    • Ubuntu (20.04, 22.04, 24.04)
      sudo apt-get install -y openjdk-11-jdk
  • With OpenJDK 8

  • RHEL (8.8, 8.10, 9.2, 9.4)

    sudo yum install -y java-1.8.0-openjdk-devel.s390x
  • SLES (12 SP5, 15 SP5, 15 SP6)

    sudo zypper install -y java-1_8_0-openjdk-devel
    
  • Ubuntu (20.04, 22.04, 24.04)

    sudo apt-get install -y openjdk-8-jre openjdk-8-jdk
    
2.2) Set JAVA_HOME
 export JAVA_HOME=/<path to java>/
 export PATH=$JAVA_HOME/bin:$PATH
2.3) Install CMake 3.7.2 (Only for SLES 12 SP5)
 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
 ./bootstrap --prefix=/usr
 gmake && sudo gmake install

Step 3: Download source code

 cd $SOURCE_ROOT
 git clone -b netty-tcnative-parent-2.0.66.Final https://github.com/netty/netty-tcnative.git
 cd netty-tcnative

Step 4: Build netty-tcnative

 cd $SOURCE_ROOT/netty-tcnative
 #Replace boringssl source code link to the one supported on s390x.
 sed -i '88,88 s/chromium-stable/patch-s390x-Jan2021/g' pom.xml
 sed -i '92,92 s/1b7fdbd9101dedc3e0aa3fcf4ff74eacddb34ecc/d83fd4af80af244ac623b99d8152c2e53287b9ad/g' pom.xml
 sed -i '87,87 s/boringssl.googlesource.com/github.com\/linux-on-ibm-z/g' boringssl-static/pom.xml
 sed -i '88,88 s/chromium-stable/patch-s390x-Jan2021/g' boringssl-static/pom.xml
  • Add GCC patch (Only for Ubuntu 22.x, 24.x and RHEL 9.x)
curl -o gcc_patch.diff https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/BoringSSL/Jan2021/patch/gcc_patch.diff 
cp gcc_patch.diff /tmp/gcc_patch.diff

sed -i "489i <exec executable=\"git\" failonerror=\"true\" dir=\"\${boringsslSourceDir}\" resolveexecutable=\"true\">"  boringssl-static/pom.xml
sed -i "490i      <arg value=\"apply\" /> "  boringssl-static/pom.xml
sed -i "491i   <arg value=\"/tmp/gcc_patch.diff\" />"  boringssl-static/pom.xml
sed -i "492i   </exec>"  boringssl-static/pom.xml
  • Build netty-tcnative
./mvnw clean install

Step 5: Set LD_LIBRARY_PATH

export LD_LIBRARY_PATH=$SOURCE_ROOT/netty-tcnative/openssl-dynamic/target/native-build/.libs/:$LD_LIBRARY_PATH

References:

Clone this wiki locally