corretto-8 icon indicating copy to clipboard operation
corretto-8 copied to clipboard

Document how to build on Linux

Open EricEdens opened this issue 5 years ago • 2 comments

From https://github.com/corretto/corretto-8/issues/64, @tanayjha is interested in experimenting with font configurations. Let's publish how we build on Linux so that he can iterate on his side.

Here's something to get people started. These may evolve over time, and we'll keep our documentation up to date. But these values will work on the current release tag of 8.212.04.2.

  1. The ./gradlew installers:linux:universal:tar:build target will build what we call a "generic linux" release. It bundles libraries to avoid linking errors at runtime.
  2. The results are stored in installers/linux/universal/tar/corretto-build/distributions.

EricEdens avatar Apr 23 '19 17:04 EricEdens

Thanks @EricEdens for this initiative. I tried the commands you mentioned and after installing a few dependencies as prompted, I am currently getting:

[ec2-user@ip-172-31-28-166 corretto-8]$ ./gradlew installers:linux:universal:tar:build

> Task :javafx:buildJfx FAILED
> Task :buildSrc:generateGrammarSource UP-TO-DATE
> Task :buildSrc:compileJava UP-TO-DATE
> Task :buildSrc:compileGroovy UP-TO-DATE
> Task :buildSrc:processResources UP-TO-DATE
> Task :buildSrc:classes UP-TO-DATE
> Task :buildSrc:jar UP-TO-DATE
> Task :buildSrc:assemble UP-TO-DATE
> Task :buildSrc:compileTestJava UP-TO-DATE
> Task :buildSrc:compileTestGroovy NO-SOURCE
> Task :buildSrc:processTestResources NO-SOURCE
> Task :buildSrc:testClasses UP-TO-DATE
> Task :buildSrc:test UP-TO-DATE
> Task :buildSrc:check UP-TO-DATE
> Task :buildSrc:build UP-TO-DATE

FAILURE: Build failed with an exception.

* Where:
Script '/home/ec2-user/corretto-8/javafx/corretto-build/buildRoot/rt-8u202-ga/buildSrc/linux.gradle' line: 89

* What went wrong:
A problem occurred evaluating script.
> Cannot invoke method split() on null object

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

This is on an Amazon Linux 64 bit EC2 instance.

Not sure how to fix this one. Any help is appreciated.

tanayjha avatar Apr 24 '19 18:04 tanayjha

From what I recall, that's JavaFX telling you that a dependency is missing. For this initiative, we'll at least want to document which dependencies are required, but it would also be nice if the build logic gave helpful failure messages :)

Here is roughly what we're using to build the generic linux binary, in Docker form. It uses CentOS6 to ensure that we're linking against a relatively old version of glibc to maximize the probability that symbols will be available on user's machines. You could build this on AL2, but this will decrease the number of systems the resulting JDK will work on given AL2's newer version of glibc.

Make sure you run scl enable devtoolset-7 bash prior to ./gradlew installers:linux:universal:tar:build.

FROM centos:centos6.10

# Update toolchain to use GCC 7
# To use the updated toolchain, either run
#    scl enable devtoolset-7 bash
# Or
#    source /opt/rh/devtoolset-7/enable
#
# The second form is required by CodeBuild, as
# CodeBuild doesn't appear to use bash.
RUN yum update -y \
    && yum install -y centos-release-scl \
    && yum install -y devtoolset-7-gcc-c++

# Add build dependencies for OpenJDK
RUN yum install -y \
    zip unzip \
    libXtst-devel libXt-devel libXrender-devel \
    cups-devel \
    freetype-devel \
    fontconfig-devel \
    alsa-lib-devel \
    && yum clean all

# Add build dependencies for JavaFX
RUN yum install -y \
    glib2-devel \
    gtk2-devel \
    mesa-libGL-devel \
    && yum clean all

# Install bootstrap JDK. The last step removes jfxrt.jar; if present, the jar causes JavaFX's build to fail.
RUN yum install -y wget
RUN wget https://d3pxv6yz143wms.cloudfront.net/8.212.04.2/java-1.8.0-amazon-corretto-devel-1.8.0_212.b04-2.x86_64.rpm \
  && yum localinstall -y java-1.8.0-amazon-corretto-devel-1.8.0_212.b04-2.x86_64.rpm \
  && rm java-1.8.0-amazon-corretto-devel-1.8.0_212.b04-2.x86_64.rpm \
  && rm /usr/lib/jvm/java-1.8.0-amazon-corretto/jre/lib/ext/jfxrt.jar

RUN yum install -y git && git clone https://github.com/corretto/corretto-8 && cd corretto-8 && git checkout release-8.212.04.2

EricEdens avatar Apr 25 '19 15:04 EricEdens