-
Notifications
You must be signed in to change notification settings - Fork 56
Building Scala 3.x
Below versions of Scala are available in respective distributions at the time of creation of these build instructions:
- Ubuntu 20.04 has
2.11.12-4 - Ubuntu (22.04, 22.10, 23.04) has
2.11.12-5 - RHEL (8.6, 8.7, 8.8) has
2.10.6
The instructions provided below specify the steps to build Scala version 3.3.0 on Linux on IBM Z Systems for following distributions:
- RHEL (7.8, 7.9, 8.6, 8.7, 8.8, 9.0, 9.1, 9.2)
- SLES (12 SP5, 15 SP4)
- Ubuntu (20.04, 22.04, 22.10, 23.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.
export SOURCE_ROOT=/<source_root>/-
RHEL (7.8, 7.9, 8.6, 8.7, 8.8, 9.0, 9.1, 9.2)
-
With OpenJDK
sudo yum install -y java-17-openjdk-devel wget # for JAVA 17 (Except RHEL 7.x) sudo yum install -y java-11-openjdk-devel wget # for JAVA 11 sudo yum install -y java-1.8.0-openjdk-devel wget # for JAVA 8
-
With IBM Semeru Runtime (previously known as AdoptOpenJDK openj9)
sudo yum install -y tar wget
- Download and install IBM Semeru Runtime (Java 8, 11, 17) from here.
-
With AdoptOpenJDK8 hotspot
sudo yum install -y tar wget sudo yum install -y gcc make # for RHEL 9.x- Download and install AdoptOpenJDK8 from here
-
With Eclipse Adoptium Temurin Runtime (previously known as AdoptOpenJDK hotspot)
sudo yum install -y tar wget
- Download and install Eclipse Adoptium Temurin Runtime (Java 11, 17) from here.
-
-
SLES (12 SP5, 15 SP4)
-
With OpenJDK
sudo zypper install -y java-17-openjdk-devel wget # JAVA 17 (Except SLES 12 SP5) sudo zypper install -y java-11-openjdk-devel wget # JAVA 11 sudo zypper install -y java-1_8_0-openjdk-devel wget # JAVA 8
-
With IBM Semeru Runtime (previously known as AdoptOpenJDK openj9)
sudo zypper install -y tar wget gzip
- Download and install IBM Semeru Runtime (Java 8, 11, 17) from here.
-
With AdoptOpenJDK8 hotspot
sudo yum install -y tar wget gcc make
- Download and install AdoptOpenJDK8 from here
-
With Eclipse Adoptium Temurin Runtime (previously known as AdoptOpenJDK hotspot)
sudo zypper install -y tar wget gzip
- Download and install Eclipse Adoptium Temurin Runtime (Java 11, 17) from here.
-
-
Ubuntu (20.04, 22.04, 22.10, 23.04)
-
With OpenJDK
sudo apt-get update sudo apt-get install -y openjdk-17-jdk wget # for JAVA 17 sudo apt-get install -y openjdk-11-jdk wget # for JAVA 11 sudo apt-get install -y openjdk-8-jdk wget # for JAVA 8
-
With IBM Semeru Runtime (previously known as AdoptOpenJDK openj9)
sudo apt-get update sudo apt-get install -y wget tar gzip
- Download and install IBM Semeru Runtime (Java 8, 11, 17) from here.
-
With AdoptOpenJDK8 hotspot
sudo yum install -y tar wget gcc make
- Download and install AdoptOpenJDK8 from here
-
With Eclipse Adoptium Temurin Runtime (previously known as AdoptOpenJDK hotspot)
sudo apt-get update sudo apt-get install -y wget tar gzip
- Download and install Eclipse Adoptium Temurin Runtime (Java 11, 17) from here.
-
Note: At the time of creation of these build instructions, Scala 3.3.0 was verified with
OpenJDK 1.8.0, 11.0.19, 17.0.7
IBM Semeru Runtime Open Edition 1.8.0_372-b07, 11.0.19.0 and 17.0.7.0
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_282-b08)
Eclipse Adoptium Temurin-11.0.19+7, Temurin-17.0.7+7
cd $SOURCE_ROOT/
wget ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz
tar xvfz libffi-3.2.1.tar.gz
cd libffi-3.2.1
./configure --prefix=/usr/local
make
sudo make install
sudo ldconfig
sudo ldconfig /usr/local/lib64export JAVA_HOME=<Path to Java>
export PATH=$JAVA_HOME/bin:$PATHcd $SOURCE_ROOT
wget https://github.com/lampepfl/dotty/releases/download/3.3.0/scala3-3.3.0.tar.gz
tar -xvf scala3-3.3.0.tar.gz
export PATH=$SOURCE_ROOT/scala3-3.3.0/bin:$PATHCheck Scala version by using the following command
scala -version
scalac -versionScala code runner version 3.3.0 -- Copyright 2002-2023, LAMP/EPFL
Scala compiler version 3.3.0 -- Copyright 2002-2023, LAMP/EPFL
Create a test file called Hello.scala using below command:
echo '@main def hello = println("Hello, world!")' > Hello.scalascalac Hello.scalaNote: This will create several files:
Hello$package$.class
Hello$package.class
Hello$package.tasty
Hello.scala
hello.class
hello.tastyscala helloThe output of the above test program should be:
Hello, world!Note: For addition information on Getting Started with Scala, visit here
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.