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

Building Erlang

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

  • RHEL(8.8, 8.10) have 22.0.7
  • RHEL(9.2, 9.4) have 26.2.5
  • SLES (15 SP5, 15 SP6) have 23.3.4.19
  • Ubuntu 20.04 has 22.2.7
  • Ubuntu 22.04 has 24.2.1
  • Ubuntu 24.04 has 25.3.2.8

The instructions provided below specify the steps to build Erlang version 27.0.1 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 and Install Erlang

1.1) Build using script

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

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

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Erlang/27.0.1/build_erlang.sh

# Build erlang
bash build_erlang.sh   #[Provide -t option for executing build with tests and -j to specify java to be used from { IBM_Semeru_8, IBM_Semeru_11, Eclipse_Adoptium_Temurin_11, OpenJDK11, IBM_Semeru_17, IBM_Semeru_21, Eclipse_Adoptium_Temurin_17, Eclipse_Adoptium_Temurin_21, OpenJDK17 (except RHEL 7.x and SLES 12 SP5), OpenJDK21 (except RHEL 7.x, SLES 12 SP5 and SLES 15 SP5) }]

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

1.2) Install the build dependencies

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

    sudo yum install -y autoconf flex gawk gcc gcc-c++ gzip libxml2-devel libxslt ncurses-devel openssl-devel make tar unixODBC-devel wget
    
  • SLES 12 SP5

    sudo zypper install -y autoconf flex gawk gcc gcc-c++ gzip libopenssl-devel libxml2-devel libxslt-tools libyui-ncurses-devel make tar unixODBC-devel wget xmlgraphics-fop
    
  • SLES (15 SP5, 15 SP6)

    sudo zypper install -y wget tar make gcc gcc-c++ ncurses-devel unixODBC-devel autoconf flex gawk libopenssl-1_1-devel libxml2-devel gzip libxslt-tools
    
  • Ubuntu (20.04, 22.04, 24.04)

    sudo apt-get update
    sudo apt-get install -y  curl autoconf fop flex gawk gcc g++ gzip libncurses-dev libssl-dev libxml2-utils make tar unixodbc-dev wget xsltproc pkg-config
    

1.3) Install java

  • With IBM Semeru Runtime

    • Download and install IBM Semeru Runtime (Java 8 or 11 or 17 or 21) from here.
  • With Eclipse Adoptium Temurin Runtime

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

    • RHEL (8.8, 8.10, 9.2, 9.4)
      sudo yum install -y java-1.8.0-openjdk-devel 
    • 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-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-devel
    • Ubuntu (20.04, 22.04, 24.04)
      sudo apt-get install -y openjdk-11-jdk
  • With OpenJDK 17

    • RHEL (8.8, 8.10, 9.2, 9.4)
      sudo yum install -y java-17-openjdk-devel 
    • SLES (15 SP5, 15 SP6)
      sudo zypper install -y --auto-agree-with-licenses java-17-openjdk java-17-openjdk-devel
    • Ubuntu (20.04, 22.04, 24.04)
      sudo apt-get install -y openjdk-17-jdk
  • With OpenJDK 21

    • RHEL (8.8, 8.10, 9.2, 9.4)
      sudo yum install -y java-21-openjdk-devel
    • SLES (15 SP6)
      sudo zypper install -y --auto-agree-with-licenses java-21-openjdk java-21-openjdk-devel
    • Ubuntu (20.04, 22.04, 24.04)
      sudo apt-get install -y openjdk-21-jdk

1.4) Set JAVA_HOME

  • Set JAVA_HOME and PATH

    export JAVA_HOME=<Path to Java>
    export PATH=$JAVA_HOME/bin:$PATH

Note: At the time of creation of these build instructions, ErLang was verified with IBM Semeru Runtime Open Edition (build jdk8u402-b06_openj9-0.43.0), IBM Semeru Runtime Open Edition (build jdk-11.0.22_7_openj9-0.43.0),IBM Semeru Runtime Open Edition (build jdk-17.0.10_7_openj9-0.43.0), IBM Semeru Runtime Open Edition (build jdk-21.0.2_13_openj9-0.43.0), Eclipse Adoptium Temurin Runtime (build jdk-11.0.22_7), Eclipse Adoptium Temurin Runtime (build jdk-17.0.10_7), Eclipse Adoptium Temurin Runtime (build jdk-21.0.2_13), OpenJDK 8 (latest distro provided version), OpenJDK 11 (latest distro provided version), OpenJDK 17 (latest distro provided version), OpenJDK 21 (latest distro provided version).

1.5) Download, configure and install Erlang

cd $SOURCE_ROOT
wget https://github.com/erlang/otp/releases/download/OTP-27.0.1/otp_src_27.0.1.tar.gz
tar -xzf otp_src_27.0.1.tar.gz
cd otp_src_27.0.1
./configure --prefix=/usr
make
sudo make install

1.6) To verify the build, start the Erlang shell

erl --version

You should see a shell shown below:

Erlang/OTP 27 [erts-15.0.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]

Eshell V15.0.1 (press Ctrl+G to abort, type help(). for help)
1>

Note: To exit from the shell type <CTRL>+G, and then once User switch command is displayed, type q to exit.

Step 2: Testing (Optional)

2.1) Run the smoke tests

cd $SOURCE_ROOT/otp_src_27.0.1
export ERL_TOP=`pwd`
make release_tests
cd release/tests/test_server
$ERL_TOP/bin/erl -s ts install -s ts smoke_test batch -s init stop

References:

⚠️ **GitHub.com Fallback** ⚠️