From 22af091235f4274cc5f8955389ee8a1e45fa73e6 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 13 Mar 2025 19:56:26 +0400 Subject: [PATCH 01/19] chore: dockerignore everything --- .dockerignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a7db75e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +* +!/piped.sh From e6f50be0f5a8fba3a6e6e8abcf1ad65b3228213b Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 13 Mar 2025 19:58:16 +0400 Subject: [PATCH 02/19] style: fix indents, typo --- Dockerfile.openj9 | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 66ebf66..7f70212 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -1,42 +1,42 @@ FROM ubuntu:25.04 AS build -# partly copied from mkdocker.sh +# partially copied from mkdocker.sh # Copyright IBM Corp (Eclipse Public License 2.0) RUN apt -qq update \ - && apt -qq upgrade -y \ - && apt -qq install -y --no-install-recommends \ - ant ant-contrib autoconf build-essential ca-certificates cmake cpio curl file gcc-14 g++-14 gdb git \ - libasound2-dev libcups2-dev libdwarf-dev libelf-dev libexpat1-dev libffi-dev libfontconfig libfontconfig1-dev \ - libfreetype6-dev libnuma-dev libssl-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev \ - make nasm pkg-config python3 python3-dev rsync systemtap-sdt-dev unzip wget xvfb zip zlib1g-dev execstack unzip \ - && rm -rf /var/lib/apt/lists/* + && apt -qq upgrade -y \ + && apt -qq install -y --no-install-recommends \ + ant ant-contrib autoconf build-essential ca-certificates cmake cpio curl file gcc-14 g++-14 gdb git \ + libasound2-dev libcups2-dev libdwarf-dev libelf-dev libexpat1-dev libffi-dev libfontconfig libfontconfig1-dev \ + libfreetype6-dev libnuma-dev libssl-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev \ + make nasm pkg-config python3 python3-dev rsync systemtap-sdt-dev unzip wget xvfb zip zlib1g-dev execstack unzip \ + && rm -rf /var/lib/apt/lists/* WORKDIR /build RUN mkdir /build/bootjdk /build/dist \ - && wget --progress=dot:mega -O jdk21.tar.gz \ - https://api.adoptopenjdk.net/v3/binary/latest/21/ga/linux/x64/jdk/openj9/normal/adoptopenjdk \ - && tar -xzf jdk21.tar.gz --directory=/build/bootjdk --strip-components=1 \ - && rm -f jdk21.tar.gz + && wget --progress=dot:mega -O jdk21.tar.gz \ + https://api.adoptopenjdk.net/v3/binary/latest/21/ga/linux/x64/jdk/openj9/normal/adoptopenjdk \ + && tar -xzf jdk21.tar.gz --directory=/build/bootjdk --strip-components=1 \ + && rm -f jdk21.tar.gz RUN wget --progress=dot:mega -O jtreg.zip https://builds.shipilev.net/jtreg/jtreg-7.5.1%2B1.zip \ - && unzip jtreg.zip -d /build \ - && rm -rf jtreg.zip + && unzip jtreg.zip -d /build \ + && rm -rf jtreg.zip ENV JT_HOME=/build/jtreg RUN find /build/bootjdk -name '*.so' | xargs execstack -c RUN git clone --single-branch --depth 1 \ - https://github.com/ibmruntimes/openj9-openjdk-jdk21.git \ - /build/src + https://github.com/ibmruntimes/openj9-openjdk-jdk21.git \ + /build/src WORKDIR /build/src RUN bash get_source.sh RUN bash configure \ - --enable-libffi-bundling --enable-ddr --enable-jitserver \ - --enable-fallback-linker --with-jtreg=/build/jtreg --with-boot-jdk=/build/bootjdk \ - --with-openssl=system --with-extra-ldflags="-Wl,-z,noexecstack" + --enable-libffi-bundling --enable-ddr --enable-jitserver \ + --enable-fallback-linker --with-jtreg=/build/jtreg --with-boot-jdk=/build/bootjdk \ + --with-openssl=system --with-extra-ldflags="-Wl,-z,noexecstack" RUN make all JOBS=$(nproc) RUN make install @@ -44,8 +44,8 @@ RUN make install # jlink by advice from https://adoptium.net/blog/2021/10/jlink-to-produce-own-runtime/ WORKDIR /build/src/build/linux-x86_64-server-release/images RUN jdk/bin/jlink --strip-debug --no-man-pages --no-header-files --compress=2 \ - --output jre \ - --add-modules java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,\ + --output jre \ + --add-modules java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,\ java.management,java.management.rmi,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.se,\ java.security.jgss,java.security.sasl,java.smartcardio,java.sql,java.sql.rowset,java.transaction.xa,\ java.xml,java.xml.crypto,jdk.accessibility,jdk.charsets,jdk.crypto.cryptoki,jdk.crypto.ec,jdk.dynalink,\ @@ -54,8 +54,6 @@ jdk.nio.mapmode,jdk.random,jdk.sctp,jdk.security.auth,jdk.security.jgss,jdk.unsu jdk.xml.dom,jdk.zipfs,openj9.criu,openj9.cuda,openj9.dataaccess,openj9.gpu,openj9.jvm,\ openj9.sharedclasses,openj9.zosconditionhandling - - ENV JAVA_HOME=/build/src/build/linux-x86_64-server-release/images/jre ENV PATH="$JAVA_HOME/bin:$JAVA_HOME/lib:$PATH" ENV TEST_JDK_HOME=/build/src/build/linux-x86_64-server-release/images/jdk @@ -64,7 +62,7 @@ ENV DIAGNOSTICLEVEL=nodetails ENV NATIVE_TEST_LIBS=/build/src/build/linux-x86_64-server-release/images/test RUN cd /build/src/openj9/test \ - && git clone https://github.com/adoptium/TKG.git + && git clone https://github.com/adoptium/TKG.git WORKDIR /build/src/openj9/test/TKG @@ -84,7 +82,6 @@ RUN make -f parallelList.mk JOBS=$(nproc) WORKDIR /build/src/build/linux-x86_64-server-release/images RUN mv ./* /build/dist/ - # ------ FROM ubuntu:25.04 AS run From cc5c929b1efac740ad6439d20c7ca2461378f66d Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 13 Mar 2025 20:02:44 +0400 Subject: [PATCH 03/19] fix: remove tests --- Dockerfile.openj9 | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 7f70212..ffc725f 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -18,12 +18,6 @@ RUN mkdir /build/bootjdk /build/dist \ && tar -xzf jdk21.tar.gz --directory=/build/bootjdk --strip-components=1 \ && rm -f jdk21.tar.gz -RUN wget --progress=dot:mega -O jtreg.zip https://builds.shipilev.net/jtreg/jtreg-7.5.1%2B1.zip \ - && unzip jtreg.zip -d /build \ - && rm -rf jtreg.zip - -ENV JT_HOME=/build/jtreg - RUN find /build/bootjdk -name '*.so' | xargs execstack -c RUN git clone --single-branch --depth 1 \ @@ -39,7 +33,6 @@ RUN bash configure \ --with-openssl=system --with-extra-ldflags="-Wl,-z,noexecstack" RUN make all JOBS=$(nproc) -RUN make install # jlink by advice from https://adoptium.net/blog/2021/10/jlink-to-produce-own-runtime/ WORKDIR /build/src/build/linux-x86_64-server-release/images @@ -54,31 +47,6 @@ jdk.nio.mapmode,jdk.random,jdk.sctp,jdk.security.auth,jdk.security.jgss,jdk.unsu jdk.xml.dom,jdk.zipfs,openj9.criu,openj9.cuda,openj9.dataaccess,openj9.gpu,openj9.jvm,\ openj9.sharedclasses,openj9.zosconditionhandling -ENV JAVA_HOME=/build/src/build/linux-x86_64-server-release/images/jre -ENV PATH="$JAVA_HOME/bin:$JAVA_HOME/lib:$PATH" -ENV TEST_JDK_HOME=/build/src/build/linux-x86_64-server-release/images/jdk -ENV TEST_ROOT=/build/src/openj9/test -ENV DIAGNOSTICLEVEL=nodetails -ENV NATIVE_TEST_LIBS=/build/src/build/linux-x86_64-server-release/images/test - -RUN cd /build/src/openj9/test \ - && git clone https://github.com/adoptium/TKG.git - -WORKDIR /build/src/openj9/test/TKG - -ENV BUILD_LIST=functional - -RUN find ../ -type f -name "playlist.xml" | xargs sed -i 's#jit_jar#jit_jarhttps://github.com/#g' -RUN find ../ -type f -name "playlist.xml" | xargs sed -i 's#testJITServer#testJITServerhttps://github.com/#g' - -RUN make compile -j$(nproc) - -RUN make genParallelList PARALLEL_OPTIONS=TEST=_sanity.functional.regular TEST_TIME= NUM_MACHINES=$(nproc) - -RUN cat parallelList.mk - -RUN make -f parallelList.mk JOBS=$(nproc) - WORKDIR /build/src/build/linux-x86_64-server-release/images RUN mv ./* /build/dist/ From 11e8999e660bc55c63a6bbb3476deea25f8e2e6d Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 13 Mar 2025 20:03:32 +0400 Subject: [PATCH 04/19] style: indent, deps sort --- Dockerfile.openj9 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index ffc725f..8aed8d6 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -5,10 +5,10 @@ FROM ubuntu:25.04 AS build RUN apt -qq update \ && apt -qq upgrade -y \ && apt -qq install -y --no-install-recommends \ - ant ant-contrib autoconf build-essential ca-certificates cmake cpio curl file gcc-14 g++-14 gdb git \ - libasound2-dev libcups2-dev libdwarf-dev libelf-dev libexpat1-dev libffi-dev libfontconfig libfontconfig1-dev \ - libfreetype6-dev libnuma-dev libssl-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev \ - make nasm pkg-config python3 python3-dev rsync systemtap-sdt-dev unzip wget xvfb zip zlib1g-dev execstack unzip \ + ant ant-contrib autoconf build-essential ca-certificates cmake cpio curl execstack file gcc-14 g++-14 gdb git \ + libasound2-dev libcups2-dev libdwarf-dev libelf-dev libexpat1-dev libffi-dev libfontconfig libfontconfig1-dev \ + libfreetype6-dev libnuma-dev libssl-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev \ + make nasm pkg-config python3 python3-dev rsync systemtap-sdt-dev unzip wget xvfb zip zlib1g-dev unzip \ && rm -rf /var/lib/apt/lists/* WORKDIR /build From 6b3da81ed3b8c5e9588aa0aca2b4663ba409c399 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 13 Mar 2025 20:20:46 +0400 Subject: [PATCH 05/19] perf: change flags, add optimizations --- Dockerfile.openj9 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 8aed8d6..2143449 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -27,11 +27,13 @@ RUN git clone --single-branch --depth 1 \ WORKDIR /build/src RUN bash get_source.sh +ENV CC=/usr/bin/gcc CXX=/usr/bin/g++ \ + CFLAGS="-O3 -flto -fuse-linker-plugin" \ + LDFLAGS="-Wl,-O1" RUN bash configure \ - --enable-libffi-bundling --enable-ddr --enable-jitserver \ - --enable-fallback-linker --with-jtreg=/build/jtreg --with-boot-jdk=/build/bootjdk \ - --with-openssl=system --with-extra-ldflags="-Wl,-z,noexecstack" - + --with-boot-jdk=/build/bootjdk \ + --with-openssl=system \ + --enable-jvm-feature-link-time-opt RUN make all JOBS=$(nproc) # jlink by advice from https://adoptium.net/blog/2021/10/jlink-to-produce-own-runtime/ From ad6acfeaf9ada903bd8f2e0da3f8d5ef7c4a69a7 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 13 Mar 2025 20:22:27 +0400 Subject: [PATCH 06/19] fix: safer find|xargs --- Dockerfile.openj9 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 2143449..2102846 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -18,7 +18,7 @@ RUN mkdir /build/bootjdk /build/dist \ && tar -xzf jdk21.tar.gz --directory=/build/bootjdk --strip-components=1 \ && rm -f jdk21.tar.gz -RUN find /build/bootjdk -name '*.so' | xargs execstack -c +RUN find /build/bootjdk -name '*.so' -type f -print0 | xargs -0 -- execstack -c RUN git clone --single-branch --depth 1 \ https://github.com/ibmruntimes/openj9-openjdk-jdk21.git \ From adccf14ee1501ddd34a75bed991b5f28d760950d Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 13 Mar 2025 20:51:15 +0400 Subject: [PATCH 07/19] feat: clang --- Dockerfile.openj9 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 2102846..6cb53df 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -5,7 +5,7 @@ FROM ubuntu:25.04 AS build RUN apt -qq update \ && apt -qq upgrade -y \ && apt -qq install -y --no-install-recommends \ - ant ant-contrib autoconf build-essential ca-certificates cmake cpio curl execstack file gcc-14 g++-14 gdb git \ + ant ant-contrib autoconf build-essential ca-certificates clang-19 cmake cpio curl execstack file git \ libasound2-dev libcups2-dev libdwarf-dev libelf-dev libexpat1-dev libffi-dev libfontconfig libfontconfig1-dev \ libfreetype6-dev libnuma-dev libssl-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev \ make nasm pkg-config python3 python3-dev rsync systemtap-sdt-dev unzip wget xvfb zip zlib1g-dev unzip \ @@ -27,12 +27,13 @@ RUN git clone --single-branch --depth 1 \ WORKDIR /build/src RUN bash get_source.sh -ENV CC=/usr/bin/gcc CXX=/usr/bin/g++ \ - CFLAGS="-O3 -flto -fuse-linker-plugin" \ +ENV CC=/usr/bin/clang CXX=/usr/bin/clang++ \ + CFLAGS="-O3 -flto -fwhole-program-vtables" \ LDFLAGS="-Wl,-O1" RUN bash configure \ --with-boot-jdk=/build/bootjdk \ --with-openssl=system \ + --with-toolchain-type=clang \ --enable-jvm-feature-link-time-opt RUN make all JOBS=$(nproc) From 0e5611083b09290d47d9ceb41bcb94d26eddaeea Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 13 Mar 2025 20:56:51 +0400 Subject: [PATCH 08/19] fix: clang exe path --- Dockerfile.openj9 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 6cb53df..5e5bc2e 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -27,7 +27,7 @@ RUN git clone --single-branch --depth 1 \ WORKDIR /build/src RUN bash get_source.sh -ENV CC=/usr/bin/clang CXX=/usr/bin/clang++ \ +ENV CC=/usr/bin/clang-19 CXX=/usr/bin/clang++-19 \ CFLAGS="-O3 -flto -fwhole-program-vtables" \ LDFLAGS="-Wl,-O1" RUN bash configure \ From f881e40484174375edc2aa28f4e665b903c01af7 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 13 Mar 2025 21:04:26 +0400 Subject: [PATCH 09/19] fix: use lld and latest clang --- Dockerfile.openj9 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 5e5bc2e..7709223 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -5,10 +5,10 @@ FROM ubuntu:25.04 AS build RUN apt -qq update \ && apt -qq upgrade -y \ && apt -qq install -y --no-install-recommends \ - ant ant-contrib autoconf build-essential ca-certificates clang-19 cmake cpio curl execstack file git \ + ant ant-contrib autoconf build-essential ca-certificates clang cmake cpio curl execstack file git \ libasound2-dev libcups2-dev libdwarf-dev libelf-dev libexpat1-dev libffi-dev libfontconfig libfontconfig1-dev \ libfreetype6-dev libnuma-dev libssl-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev \ - make nasm pkg-config python3 python3-dev rsync systemtap-sdt-dev unzip wget xvfb zip zlib1g-dev unzip \ + lld make nasm pkg-config python3 python3-dev rsync systemtap-sdt-dev unzip wget xvfb zip zlib1g-dev unzip \ && rm -rf /var/lib/apt/lists/* WORKDIR /build @@ -27,14 +27,16 @@ RUN git clone --single-branch --depth 1 \ WORKDIR /build/src RUN bash get_source.sh -ENV CC=/usr/bin/clang-19 CXX=/usr/bin/clang++-19 \ - CFLAGS="-O3 -flto -fwhole-program-vtables" \ - LDFLAGS="-Wl,-O1" +ENV CC=/usr/bin/clang CXX=/usr/bin/clang++ LD=/usr/bin/lld + # TODO: add as args to configure + # CFLAGS="-O3 -flto -fwhole-program-vtables" \ + # LDFLAGS="-Wl,-O1" RUN bash configure \ --with-boot-jdk=/build/bootjdk \ --with-openssl=system \ --with-toolchain-type=clang \ - --enable-jvm-feature-link-time-opt + --enable-jvm-feature-link-time-opt \ + --with-extra-ldflags="-fuse-ld=/usr/bin/lld" RUN make all JOBS=$(nproc) # jlink by advice from https://adoptium.net/blog/2021/10/jlink-to-produce-own-runtime/ From 86522ff4313f6f159ed571e0b81643db522006dd Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 13 Mar 2025 21:16:16 +0400 Subject: [PATCH 10/19] fix(clang): this time it must work --- Dockerfile.openj9 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 7709223..2c50aaf 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -8,7 +8,7 @@ RUN apt -qq update \ ant ant-contrib autoconf build-essential ca-certificates clang cmake cpio curl execstack file git \ libasound2-dev libcups2-dev libdwarf-dev libelf-dev libexpat1-dev libffi-dev libfontconfig libfontconfig1-dev \ libfreetype6-dev libnuma-dev libssl-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev \ - lld make nasm pkg-config python3 python3-dev rsync systemtap-sdt-dev unzip wget xvfb zip zlib1g-dev unzip \ + llvm-dev lld make nasm pkg-config python3 python3-dev rsync systemtap-sdt-dev unzip wget xvfb zip zlib1g-dev unzip \ && rm -rf /var/lib/apt/lists/* WORKDIR /build @@ -35,8 +35,7 @@ RUN bash configure \ --with-boot-jdk=/build/bootjdk \ --with-openssl=system \ --with-toolchain-type=clang \ - --enable-jvm-feature-link-time-opt \ - --with-extra-ldflags="-fuse-ld=/usr/bin/lld" + --enable-jvm-feature-link-time-opt RUN make all JOBS=$(nproc) # jlink by advice from https://adoptium.net/blog/2021/10/jlink-to-produce-own-runtime/ From dfe051d2c6a5b92c0f9ca588716e58fcc87e9323 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 13 Mar 2025 21:28:57 +0400 Subject: [PATCH 11/19] fix: ...pointer to non-trivially copyable type... --- Dockerfile.openj9 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 2c50aaf..39dfac8 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -31,11 +31,14 @@ ENV CC=/usr/bin/clang CXX=/usr/bin/clang++ LD=/usr/bin/lld # TODO: add as args to configure # CFLAGS="-O3 -flto -fwhole-program-vtables" \ # LDFLAGS="-Wl,-O1" +ENV CFLAGS="-Wno-error=nontrivial-memcall" RUN bash configure \ --with-boot-jdk=/build/bootjdk \ --with-openssl=system \ --with-toolchain-type=clang \ - --enable-jvm-feature-link-time-opt + --enable-jvm-feature-link-time-opt \ + --with-extra-cflags="$CFLAGS" \ + --with-extra-cxxflags="$CFLAGS" RUN make all JOBS=$(nproc) # jlink by advice from https://adoptium.net/blog/2021/10/jlink-to-produce-own-runtime/ From 04c4e3fecef059c226bf9e8bd1ac0081fc3b3441 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 14 Mar 2025 17:21:15 +0400 Subject: [PATCH 12/19] fix: switch back to gcc --- Dockerfile.openj9 | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 39dfac8..3652ef0 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -5,10 +5,10 @@ FROM ubuntu:25.04 AS build RUN apt -qq update \ && apt -qq upgrade -y \ && apt -qq install -y --no-install-recommends \ - ant ant-contrib autoconf build-essential ca-certificates clang cmake cpio curl execstack file git \ + ant ant-contrib autoconf build-essential ca-certificates cmake cpio curl execstack file gcc g++ git \ libasound2-dev libcups2-dev libdwarf-dev libelf-dev libexpat1-dev libffi-dev libfontconfig libfontconfig1-dev \ libfreetype6-dev libnuma-dev libssl-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev \ - llvm-dev lld make nasm pkg-config python3 python3-dev rsync systemtap-sdt-dev unzip wget xvfb zip zlib1g-dev unzip \ + make nasm pkg-config python3 python3-dev rsync systemtap-sdt-dev unzip wget xvfb zip zlib1g-dev unzip \ && rm -rf /var/lib/apt/lists/* WORKDIR /build @@ -27,18 +27,13 @@ RUN git clone --single-branch --depth 1 \ WORKDIR /build/src RUN bash get_source.sh -ENV CC=/usr/bin/clang CXX=/usr/bin/clang++ LD=/usr/bin/lld +ENV CC=/usr/bin/gcc CXX=/usr/bin/g++ # TODO: add as args to configure # CFLAGS="-O3 -flto -fwhole-program-vtables" \ # LDFLAGS="-Wl,-O1" -ENV CFLAGS="-Wno-error=nontrivial-memcall" RUN bash configure \ --with-boot-jdk=/build/bootjdk \ - --with-openssl=system \ - --with-toolchain-type=clang \ - --enable-jvm-feature-link-time-opt \ - --with-extra-cflags="$CFLAGS" \ - --with-extra-cxxflags="$CFLAGS" + --with-openssl=system RUN make all JOBS=$(nproc) # jlink by advice from https://adoptium.net/blog/2021/10/jlink-to-produce-own-runtime/ From 0a63082d3bb6061e74b8282872600643c1b1492d Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 14 Mar 2025 17:32:06 +0400 Subject: [PATCH 13/19] feat: replace custom bootjdk with ubuntu package --- Dockerfile.openj9 | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 3652ef0..8b98268 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -5,20 +5,15 @@ FROM ubuntu:25.04 AS build RUN apt -qq update \ && apt -qq upgrade -y \ && apt -qq install -y --no-install-recommends \ - ant ant-contrib autoconf build-essential ca-certificates cmake cpio curl execstack file gcc g++ git \ - libasound2-dev libcups2-dev libdwarf-dev libelf-dev libexpat1-dev libffi-dev libfontconfig libfontconfig1-dev \ - libfreetype6-dev libnuma-dev libssl-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev \ - make nasm pkg-config python3 python3-dev rsync systemtap-sdt-dev unzip wget xvfb zip zlib1g-dev unzip \ + ant ant-contrib autoconf ca-certificates cmake cpio file gcc g++ git \ + libasound2-dev libcups2-dev libdwarf-dev libelf-dev libexpat1-dev libffi-dev \ + libfontconfig libfontconfig1-dev libfreetype6-dev libnuma-dev libssl-dev \ + libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev \ + make nasm openjdk-21-jdk-headless pkg-config python3 python3-dev rsync \ + systemtap-sdt-dev xvfb zlib1g-dev \ && rm -rf /var/lib/apt/lists/* WORKDIR /build -RUN mkdir /build/bootjdk /build/dist \ - && wget --progress=dot:mega -O jdk21.tar.gz \ - https://api.adoptopenjdk.net/v3/binary/latest/21/ga/linux/x64/jdk/openj9/normal/adoptopenjdk \ - && tar -xzf jdk21.tar.gz --directory=/build/bootjdk --strip-components=1 \ - && rm -f jdk21.tar.gz - -RUN find /build/bootjdk -name '*.so' -type f -print0 | xargs -0 -- execstack -c RUN git clone --single-branch --depth 1 \ https://github.com/ibmruntimes/openj9-openjdk-jdk21.git \ @@ -32,7 +27,7 @@ ENV CC=/usr/bin/gcc CXX=/usr/bin/g++ # CFLAGS="-O3 -flto -fwhole-program-vtables" \ # LDFLAGS="-Wl,-O1" RUN bash configure \ - --with-boot-jdk=/build/bootjdk \ + --with-boot-jdk=/usr/lib/jvm/java-21-openjdk-amd64 \ --with-openssl=system RUN make all JOBS=$(nproc) From 95b6822a44352f28f187489a64fb2aa85518596b Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 14 Mar 2025 17:37:55 +0400 Subject: [PATCH 14/19] style: remove extra WORKDIR --- Dockerfile.openj9 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 8b98268..adbe627 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -31,8 +31,9 @@ RUN bash configure \ --with-openssl=system RUN make all JOBS=$(nproc) -# jlink by advice from https://adoptium.net/blog/2021/10/jlink-to-produce-own-runtime/ WORKDIR /build/src/build/linux-x86_64-server-release/images + +# jlink by advice from https://adoptium.net/blog/2021/10/jlink-to-produce-own-runtime/ RUN jdk/bin/jlink --strip-debug --no-man-pages --no-header-files --compress=2 \ --output jre \ --add-modules java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,\ @@ -44,7 +45,6 @@ jdk.nio.mapmode,jdk.random,jdk.sctp,jdk.security.auth,jdk.security.jgss,jdk.unsu jdk.xml.dom,jdk.zipfs,openj9.criu,openj9.cuda,openj9.dataaccess,openj9.gpu,openj9.jvm,\ openj9.sharedclasses,openj9.zosconditionhandling -WORKDIR /build/src/build/linux-x86_64-server-release/images RUN mv ./* /build/dist/ # ------ From 3f75cded588dc0b8781a6fd41de69b5e8c5fdbbd Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 14 Mar 2025 17:56:00 +0400 Subject: [PATCH 15/19] perf: add -O3 and lto --- Dockerfile.openj9 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index adbe627..44aee04 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -23,12 +23,14 @@ WORKDIR /build/src RUN bash get_source.sh ENV CC=/usr/bin/gcc CXX=/usr/bin/g++ - # TODO: add as args to configure - # CFLAGS="-O3 -flto -fwhole-program-vtables" \ - # LDFLAGS="-Wl,-O1" RUN bash configure \ --with-boot-jdk=/usr/lib/jvm/java-21-openjdk-amd64 \ - --with-openssl=system + --with-openssl=system \ + --with-extra-cflags="-O3 -flto=auto -fuse-linker-plugin" \ + --with-extra-cxxflags="-O3 -flto=auto -fuse-linker-plugin" \ + --with-extra-ldflags="-Wl,-O1" \ + --with-native-debug-symbols=none \ + --enable-jvm-feature-link-time-opt RUN make all JOBS=$(nproc) WORKDIR /build/src/build/linux-x86_64-server-release/images From 415afaee09ab7d0e40bd974a913484369aea9e37 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 14 Mar 2025 17:59:11 +0400 Subject: [PATCH 16/19] fix: apt-get, no readline --- Dockerfile.openj9 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 44aee04..0e86918 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -2,9 +2,10 @@ FROM ubuntu:25.04 AS build # partially copied from mkdocker.sh # Copyright IBM Corp (Eclipse Public License 2.0) -RUN apt -qq update \ - && apt -qq upgrade -y \ - && apt -qq install -y --no-install-recommends \ +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get -qq update \ + && apt-get -qq upgrade -y \ + && apt-get -qq install -y --no-install-recommends \ ant ant-contrib autoconf ca-certificates cmake cpio file gcc g++ git \ libasound2-dev libcups2-dev libdwarf-dev libelf-dev libexpat1-dev libffi-dev \ libfontconfig libfontconfig1-dev libfreetype6-dev libnuma-dev libssl-dev \ From 83b5771fdf77a6e6be8f411426d4f27851a8281f Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 14 Mar 2025 18:06:00 +0400 Subject: [PATCH 17/19] fix(deps): return zip&unzip --- Dockerfile.openj9 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 0e86918..4d42736 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -11,7 +11,7 @@ RUN apt-get -qq update \ libfontconfig libfontconfig1-dev libfreetype6-dev libnuma-dev libssl-dev \ libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev \ make nasm openjdk-21-jdk-headless pkg-config python3 python3-dev rsync \ - systemtap-sdt-dev xvfb zlib1g-dev \ + systemtap-sdt-dev unzip xvfb zip zlib1g-dev \ && rm -rf /var/lib/apt/lists/* WORKDIR /build From 1bcc578fa17f268f07b94e58a6a01913bd1b83be Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 14 Mar 2025 18:25:33 +0400 Subject: [PATCH 18/19] chore: cleanup action yml --- .forgejo/workflows/build_and_release.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.forgejo/workflows/build_and_release.yml b/.forgejo/workflows/build_and_release.yml index 695cf86..66787f4 100644 --- a/.forgejo/workflows/build_and_release.yml +++ b/.forgejo/workflows/build_and_release.yml @@ -2,11 +2,10 @@ name: Docker Image CI on: push: - pull_request: env: - REGISTRY: git.dc09.ru # Change to your registry (e.g., forgejo.example.com) + REGISTRY: git.dc09.ru GITHUB_TOKEN: ${{ secrets.FORGEJO_PASSWORD }} GITHUB_API_URL: https://git.dc09.ru GITHUB_BASE_REF: git.dc09.ru @@ -24,7 +23,7 @@ jobs: - dockerfile: 'Dockerfile.openj9' image_name: 'openj9' context: './' - build-args: ["WITH_JDK=false"] + build-args: [] - dockerfile: 'Dockerfile.piped' image_name: 'piped' context: './' @@ -60,7 +59,6 @@ jobs: github-token: ${{ secrets.FORGEJO_PASSWORD }} github-server: https://git.dc09.ru - - name: Build and push Docker image uses: docker/build-push-action@v5 with: @@ -69,4 +67,4 @@ jobs: push: ${{ github.event_name == 'push' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - build-args: ${{ matrix.images.build-args }} \ No newline at end of file + build-args: ${{ matrix.images.build-args }} From 1cec87ce45a15cab28f4a6e7db896ee6b7f909f7 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 14 Mar 2025 18:26:34 +0400 Subject: [PATCH 19/19] fix: do not fail if no volume provided --- Dockerfile.openj9 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index 4d42736..3070f9c 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -48,7 +48,7 @@ jdk.nio.mapmode,jdk.random,jdk.sctp,jdk.security.auth,jdk.security.jgss,jdk.unsu jdk.xml.dom,jdk.zipfs,openj9.criu,openj9.cuda,openj9.dataaccess,openj9.gpu,openj9.jvm,\ openj9.sharedclasses,openj9.zosconditionhandling -RUN mv ./* /build/dist/ +RUN mkdir -p /build/dist && mv ./* /build/dist/ # ------