Tuesday, April 07, 2020

Building OpenJDK 13 and OpenJDK 14 on Solaris 11 x86_64

Following on from a previous blog "Building OpenJDK 12 on Solaris 11 x86_64" I have added instructions for OpenJDK 13 on Oracle Solaris 11.4 x64, and the setup is exactly the same for OpenJDK 14
References: Key Steps:
  • At this time you require Oracle Solaris Studio 12.4 or Oracle Solaris Studio 12.6
  • Do not build on a NFS drive, since will be very slow.
  • Tested on Solaris 11.4.19.3.0 with Oracle Solaris Studio 12.4.
    • Disable hotspot-gtest & shenandoahgc & dtrace.
  • You need to have OpenJDK 12 installed already.
  • Remove EM_486, since no longer defined since Solaris 11.4
  • Patch for hb-subset-cff-common.hh due to studio 12.4 (ref: Peter Tribble)
  • remove refmemnoconstr_aggr from DISABLED_WARNINGS_CXX_solstudio in the file make/lib/Awt2dLibraries.gmk
  • Need a copy of libsoftcrypto.h. (ref: https://bugs.openjdk.java.net/browse/JDK-8062219 (Not need if building on S11)
# cd /usr/tmp 
# export PATH=/dpool/work/openjdk/jdk12/build/solaris-x86_64-server-release/images/jdk/bin:/opt/solarisstudio12.4/bin:/usr/bin:/usr/sbin:/usr/gnu/bin:/usr/sfw/bin

# which cc java
/opt/solarisstudio12.4/bin/cc
/dpool/work/openjdk/jdk12/build/solaris-x86_64-server-release/images/jdk/bin/java

# java -version
openjdk version "12-internal" 2019-03-19
OpenJDK Runtime Environment (build 12-internal+0-adhoc.andrew.openjdk12)
OpenJDK 64-Bit Server VM (build 12-internal+0-adhoc.andrew.openjdk12, mixed mode, sharing)

# hg clone http://hg.openjdk.java.net/jdk/jdk13 jdk13
adding changesets
adding manifests
manifests [=======> ]  3361/55580 15m13s
manifests [=======> ]  3385/55580 15m10s
adding file changes
added 55580 changesets with 477985 changes to 183904 files
new changesets fd16c54261b3:0368f3a073a9
updating to branch default
67542 files updated, 0 files merged, 0 files removed, 0 files unresolved

# cd jdk13
# cp -ip src/hotspot/os/solaris/os_solaris.cpp src/hotspot/os/solaris/os_solaris.orig
# gsed -i 's/EM_486/EM_IAMCU/' src/hotspot/os/solaris/os_solaris.cpp
# diff src/hotspot/os/solaris/os_solaris.cpp src/hotspot/os/solaris/os_solaris.orig
1583c1583
<     {EM_IAMCU,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
---
>     {EM_486,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},

# cp -ip make/lib/Awt2dLibraries.gmk  make/lib/Awt2dLibraries.orig
# gsed -i 's/refmemnoconstr_aggr//' make/lib/Awt2dLibraries.gmk
# diff make/lib/Awt2dLibraries.gmk  make/lib/Awt2dLibraries.orig
628c628
<         hidevf w_novirtualdescr arrowrtn2  unknownpragma, \
---
>         hidevf w_novirtualdescr arrowrtn2 refmemnoconstr_aggr unknownpragma, \

// FOLLOWING (libsoftcrypto.h) NOT NEED FOR Oracle Solaris 11, but leaving it there for reference:
//# curl http://hg.openjdk.java.net/jdk9/jdk9/jdk/raw-file/48148c98c95a/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/libsoftcrypto.h > src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/libsoftcrypto.h

// Solaris: OS12u4 complains about "A class with a reference member lacks a user-defined constructor" so provide the constructor 
# wget https://raw.githubusercontent.com/tribblix/build/master/patches/jdk12-studio124.patch
# cp -ip src/java.desktop/share/native/libfontmanager/harfbuzz/hb-subset-cff-common.hh src/java.desktop/share/native/libfontmanager/harfbuzz/hb-subset-cff-common.orig
# patch -p1 < jdk12-studio124.patch
patching file src/java.desktop/share/native/libfontmanager/harfbuzz/hb-subset-cff-common.hh
# diff src/java.desktop/share/native/libfontmanager/harfbuzz/hb-subset-cff-common.hh src/java.desktop/share/native/libfontmanager/harfbuzz/hb-subset-cff-common.orig
283,286d282
<
<   // Solaris: OS12u4 complains about "A class with a reference member lacks a user-defined constructor"
<   // so provide the constructor
<   flatten_param_t(str_buff_t& sbt, bool dh) : flatStr(sbt), drop_hints(dh) {}
312,314c308
<       // Solaris: OS12u4 does not like the C++11 style init
<       // flatten_param_t  param = { flat_charstrings[i], drop_hints };
<       flatten_param_t  param(flat_charstrings[i], drop_hints);
---
>       flatten_param_t  param = { flat_charstrings[i], drop_hints };

# bash configure --disable-hotspot-gtest --with-jvm-features=-shenandoahgc --enable-unlimited-crypto --with-native-debug-symbols=none --enable-dtrace=no
......
====================================================
The existing configuration has been successfully updated in
/dpool/work/openjdk/jdk13/build/solaris-x86_64-server-release
using configure arguments '--disable-hotspot-gtest --with-jvm-features=-shenandoahgc --enable-unlimited-crypto --with-native-debug-symbols=none --enable-dtrace=no'.
Configuration summary:
* Debug level:    release
* HS debug level: product
* JVM variants:   server
* JVM features:   server: 'aot cds cmsgc compiler1 compiler2 epsilongc g1gc graal jfr jni-check jvmci jvmti management nmt parallelgc serialgc services vm-structs'
* OpenJDK target: OS: solaris, CPU architecture: x86, address length: 64
* Version string: 13-internal+0-adhoc.andrew.jdk13 (13-internal)

Tools summary:
* Boot JDK:       openjdk version "12-internal" 2019-03-19 OpenJDK Runtime Environment (build 12-internal+0-adhoc.andrew.openjdk12) OpenJDK 64-Bit Server VM (build 12-internal+0-adhoc.andrew.openjdk12, mixed mode, sharing)  (at /dpool/work/openjdk/openjdk12/build/solaris-x86_64-server-release/images/jdk)
* Toolchain:      solstudio (Oracle Solaris Studio)
* C Compiler:     Version 5.13 (at /opt/solarisstudio12.4/bin/cc)
* C++ Compiler:   Version 5.13 (at /opt/solarisstudio12.4/bin/CC)

Build performance summary:
* Cores to use:   12
* Memory limit:   16297 MB

# gmake  
...
Creating support/modules_libs/jdk.security.auth/libjaas.so from 1 file(s)
Compiling 4 files for BUILD_JIGSAW_TOOLS
Optimizing the exploded image
Stopping sjavac server
Finished building target 'default (exploded-image)' in configuration 'solaris-x86_64-server-release'

# gmake images     
....
Creating support/demos/image/jfc/J2Ddemo/J2Ddemo.jar
Compiling 1 files for CLASSLIST_JAR
Creating support/classlist.jar
Creating jdk.jlink.jmod
Creating java.base.jmod
Creating jdk image
Creating CDS archive for jdk image
Stopping sjavac server
Finished building target 'images' in configuration 'solaris-x86_64-server-release'

# ./build/solaris-x86_64-server-release/images/jdk/bin/java -version
openjdk version "13-internal" 2019-09-17
OpenJDK Runtime Environment (build 13-internal+0-adhoc.andrew.jdk13)
OpenJDK 64-Bit Server VM (build 13-internal+0-adhoc.andrew.jdk13, mixed mode, sharing)

Formatting: I now use http://codeformatter.blogspot.co.uk for code formatting.

No comments: