./gradlew buildNative fails: "ld: read-only segment has dynamic relocations" #300

Closed
opened 2025-12-30 01:23:16 +01:00 by adam · 3 comments
Owner

Originally created by @sin-ack on GitHub (Mar 7, 2025).

System information

OS: Gentoo Linux 2.17 amd64
Compiler version: gcc version 14.2.1 20241221 (Gentoo Hardened 14.2.1_p20241221 p7)
Java version: openjdk 21.0.6 2025-01-21
Pkl commit: 18e7a7e87e

Details

I get the following error when running ./gradlew buildNative:

Failed generating 'pkl-linux-amd64' after 1m 38s.

The build process encountered an unexpected error:

java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

Linker command executed:
/usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--version-script,/tmp/SVM-4119432723879714822/exported_symbols.list -Wl,-x -o /home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64 pkl-linux-amd64.o /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libextnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnio.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libmanagement_ext.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libjava.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libzip.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/libjvm.a -Wl,--export-dynamic -v -L/tmp/SVM-4119432723879714822 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/macros/truffle-svm/builder -lz -ldl -lpthread -lrt

Linker command output:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-14.2.1_p20241221/work/gcc-14-20241221/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 14.2.1_p20241221 p7' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-build-config=bootstrap-cet
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.1 20241221 (Gentoo Hardened 14.2.1_p20241221 p7)
COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64' '-v' '-L/tmp/SVM-4119432723879714822' '-L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc' '-L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64' '-L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/macros/truffle-svm/builder' '-mtune=generic' '-march=x86-64' '-dumpdir' '/home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64.'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/14/collect2 -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/ccmfE45K.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -o /home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64 -z noexecstack /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/tmp/SVM-4119432723879714822 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/macros/truffle-svm/builder -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. --gc-sections --version-script /tmp/SVM-4119432723879714822/exported_symbols.list -x pkl-linux-amd64.o /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libextnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnio.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libmanagement_ext.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libjava.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libzip.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/libjvm.a --export-dynamic -lz -ldl -lpthread -lrt -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: pkl-linux-amd64.o: warning: relocation in read-only section `.svm_heap'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: read-only segment has dynamic relocations
collect2: error: ld returned 1 exit status
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:202)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.runLinkerCommand(NativeImageViaCC.java:152)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:118)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:741)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:539)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:721)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:143)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:98)
Full build log
europa third-party/pkl ‹main› » ./gradlew buildNative
Downloading https://services.gradle.org/distributions/gradle-8.13-bin.zip
.............10%.............20%.............30%.............40%.............50%.............60%.............70%.............80%.............90%.............100%

Welcome to Gradle 8.13!

Here are the highlights of this release:
 - Daemon JVM auto-provisioning
 - Enhancements for Scala plugin and JUnit testing
 - Improvements for build authors and plugin developers

For more details see https://docs.gradle.org/8.13/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)
Type-safe project accessors is an incubating feature.

> Task :buildSrc:compileKotlin
w: file:///home/agni/repos/third-party/pkl/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts:26:7 'task(String, Action<in Task!>): Task' is deprecated. Deprecated in Java
w: file:///home/agni/repos/third-party/pkl/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts:35:7 'task(String, Action<in Task!>): Task' is deprecated. Deprecated in Java
w: file:///home/agni/repos/third-party/pkl/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts:52:7 'task(String, Action<in Task!>): Task' is deprecated. Deprecated in Java
w: file:///home/agni/repos/third-party/pkl/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts:67:7 'task(String, Action<in Task!>): Task' is deprecated. Deprecated in Java
w: file:///home/agni/repos/third-party/pkl/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts:77:7 'task(String, Action<in Task!>): Task' is deprecated. Deprecated in Java

> Task :downloadGraalVmAmd64
Download https://download.oracle.com/graalvm/21/archive/graalvm-jdk-21.0.5_linux-x64_bin.tar.gz

> Task :pkl-commons-test:generateKeys
Generating 3,072 bit RSA key pair and self-signed certificate (SHA384withRSA) with a validity of 90 days
        for: CN=localhost

> Task :pkl-commons-test:exportCerts
Certificate stored in file <localhost.pem>

> Task :downloadGraalVmAmd64
Downloaded GraalVm to /home/agni/.graalvm/graalvm-jdk-21.0.5_linux-x64_bin.tar.gz

> Task :installGraalVmAmd64
Extracting /home/agni/.graalvm/graalvm-jdk-21.0.5_linux-x64_bin.tar.gz into /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127
Installing native-image into /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127
Creating symlink /home/agni/.graalvm/graalvm-jdk-21.0.5_linux-x64_bin for /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127

> Task :pkl-core:compileJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :pkl-core:compileTestKotlin
w: file:///home/agni/repos/third-party/pkl/pkl-core/src/test/kotlin/org/pkl/core/parser/ParserComparisonTestInterface.kt:21:8 'class ANTLRInputStream : Any, UnicodeCharStream, CharStream' is deprecated. Deprecated in Java.
w: file:///home/agni/repos/third-party/pkl/pkl-core/src/test/kotlin/org/pkl/core/parser/ParserComparisonTestInterface.kt:86:26 'constructor(p0: String!): ANTLRInputStream' is deprecated. Deprecated in Java.
w: file:///home/agni/repos/third-party/pkl/pkl-core/src/test/kotlin/org/pkl/core/parser/ParserComparisonTestInterface.kt:105:28 'constructor(p0: String!): ANTLRInputStream' is deprecated. Deprecated in Java.

> Task :pkl-cli:linuxExecutableAmd64
========================================================================================================================
GraalVM Native Image: Generating 'pkl-linux-amd64' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing...                                                                                    (8.3s @ 0.18GB)
 Java version: 21.0.5+9-LTS, vendor version: Oracle GraalVM 21.0.5+9.1
 Graal compiler: optimization level: b, target machine: compatibility, PGO: off
 C compiler: gcc (pc, x86_64, 14.2.1)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 4 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
 - com.oracle.svm.truffle.TruffleBaseFeature: Provides support for Truffle languages
 - com.oracle.svm.truffle.TruffleFeature: Provides support for Truffle runtime compilation
 - org.graalvm.home.HomeFinderFeature: Finds GraalVM paths and its version number
------------------------------------------------------------------------------------------------------------------------
 6 experimental option(s) unlocked:
 - '-H:-ParseRuntimeOptions' (origin(s): command line)
 - '-H:+EnforceMaxRuntimeCompileMethods' (origin(s): command line)
 - '-H:IncludeResourceBundles' (origin(s): command line)
 - '-H:ResourceConfigurationResources' (origin(s): 'META-INF/native-image/org.jline/jline-terminal-jansi/native-image.properties' in 'file:///home/agni/.gradle/caches/modules-2/files-2.1/org.jline/jline-terminal-jansi/3.23.0/61359f811cd57ed31cd9b93f6792e2e64c63695d/jline-terminal-jansi-3.23.0.jar', 'META-INF/native-image/org.jline/jline-terminal/native-image.properties' in 'file:///home/agni/.gradle/caches/modules-2/files-2.1/org.jline/jline-terminal/3.23.0/8cce141b54352ab3d8dbd0d78665ffa0116ba167/jline-terminal-3.23.0.jar')
 - '-H:IncludeResources' (origin(s): command line, command line, command line)
 - '-H:ReflectionConfigurationResources' (origin(s): 'META-INF/native-image/org.jline/jline-terminal-jansi/native-image.properties' in 'file:///home/agni/.gradle/caches/modules-2/files-2.1/org.jline/jline-terminal-jansi/3.23.0/61359f811cd57ed31cd9b93f6792e2e64c63695d/jline-terminal-jansi-3.23.0.jar', 'META-INF/native-image/org.jline/jline-terminal/native-image.properties' in 'file:///home/agni/.gradle/caches/modules-2/files-2.1/org.jline/jline-terminal/3.23.0/8cce141b54352ab3d8dbd0d78665ffa0116ba167/jline-terminal-3.23.0.jar')
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 23.42GB of memory (75.6% of 31.00GB system memory, determined at start)
 - 32 thread(s) (100.0% of 32 available processor(s), determined at start)
[2/8] Performing analysis...  [********]                                                                (35.8s @ 1.94GB)
   17,932 reachable types   (93.1% of   19,253 total)
   25,127 reachable fields  (61.4% of   40,894 total)
   90,497 reachable methods (65.0% of  139,190 total)
    3,931 runtime compiled methods ( 2.8% of  139,190 total)
    4,937 types,   320 fields, and 2,427 methods registered for reflection
       77 types,   187 fields, and   138 methods registered for JNI access
        4 native libraries: dl, pthread, rt, z
[3/8] Building universe...                                                                               (7.6s @ 2.62GB)
[4/8] Parsing methods...      [**]                                                                       (4.8s @ 3.13GB)
[5/8] Inlining methods...     [****]                                                                     (2.9s @ 1.74GB)
[6/8] Compiling methods...    [****]                                                                    (14.9s @ 4.20GB)
[7/8] Laying out methods...   [***]                                                                      (7.9s @ 2.38GB)

[8/8] Creating image...       [****]                                                                     (0.0s @ 2.22GB)
------------------------------------------------------------------------------------------------------------------------
                       9.7s (9.6% of total time) in 114 GCs | Peak RSS: 6.02GB | CPU load: 10.00
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /home/agni/repos/third-party/pkl/pkl-cli/build/executable/svm_err_b_20250307T131854.405_pid3557.md (build_info)
========================================================================================================================
Failed generating 'pkl-linux-amd64' after 1m 38s.

The build process encountered an unexpected error:

java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

Linker command executed:
/usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--version-script,/tmp/SVM-4119432723879714822/exported_symbols.list -Wl,-x -o /home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64 pkl-linux-amd64.o /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libextnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnio.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libmanagement_ext.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libjava.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libzip.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/libjvm.a -Wl,--export-dynamic -v -L/tmp/SVM-4119432723879714822 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/macros/truffle-svm/builder -lz -ldl -lpthread -lrt

Linker command output:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-14.2.1_p20241221/work/gcc-14-20241221/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 14.2.1_p20241221 p7' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-build-config=bootstrap-cet
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.1 20241221 (Gentoo Hardened 14.2.1_p20241221 p7)
COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64' '-v' '-L/tmp/SVM-4119432723879714822' '-L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc' '-L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64' '-L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/macros/truffle-svm/builder' '-mtune=generic' '-march=x86-64' '-dumpdir' '/home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64.'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/14/collect2 -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/ccmfE45K.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -o /home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64 -z noexecstack /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/tmp/SVM-4119432723879714822 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/macros/truffle-svm/builder -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. --gc-sections --version-script /tmp/SVM-4119432723879714822/exported_symbols.list -x pkl-linux-amd64.o /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libextnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnio.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libmanagement_ext.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libjava.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libzip.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/libjvm.a --export-dynamic -lz -ldl -lpthread -lrt -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: pkl-linux-amd64.o: warning: relocation in read-only section `.svm_heap'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: read-only segment has dynamic relocations
collect2: error: ld returned 1 exit status
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:202)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.runLinkerCommand(NativeImageViaCC.java:152)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:118)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:741)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:539)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:721)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:143)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:98)


> Task :pkl-cli:linuxExecutableAmd64 FAILED

[Incubating] Problems report is available at: file:///home/agni/repos/third-party/pkl/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':pkl-cli:linuxExecutableAmd64'.
> Process 'command '/home/agni/.graalvm/graalvm-jdk-21.0.5_linux-x64_bin/bin/native-image'' finished with non-zero exit value 1

* 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 4m 43s
65 actionable tasks: 65 executed
Originally created by @sin-ack on GitHub (Mar 7, 2025). ### System information OS: Gentoo Linux 2.17 amd64 Compiler version: gcc version 14.2.1 20241221 (Gentoo Hardened 14.2.1_p20241221 p7) Java version: openjdk 21.0.6 2025-01-21 Pkl commit: 18e7a7e87efab5afa0fdbf992fe415c84f07bf26 # Details I get the following error when running `./gradlew buildNative`: ``` Failed generating 'pkl-linux-amd64' after 1m 38s. The build process encountered an unexpected error: java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1 Linker command executed: /usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--version-script,/tmp/SVM-4119432723879714822/exported_symbols.list -Wl,-x -o /home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64 pkl-linux-amd64.o /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libextnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnio.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libmanagement_ext.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libjava.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libzip.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/libjvm.a -Wl,--export-dynamic -v -L/tmp/SVM-4119432723879714822 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/macros/truffle-svm/builder -lz -ldl -lpthread -lrt Linker command output: Using built-in specs. COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-14.2.1_p20241221/work/gcc-14-20241221/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 14.2.1_p20241221 p7' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-build-config=bootstrap-cet Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.2.1 20241221 (Gentoo Hardened 14.2.1_p20241221 p7) COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64' '-v' '-L/tmp/SVM-4119432723879714822' '-L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc' '-L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64' '-L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/macros/truffle-svm/builder' '-mtune=generic' '-march=x86-64' '-dumpdir' '/home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64.' /usr/libexec/gcc/x86_64-pc-linux-gnu/14/collect2 -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/ccmfE45K.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -o /home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64 -z noexecstack /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/tmp/SVM-4119432723879714822 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/macros/truffle-svm/builder -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. --gc-sections --version-script /tmp/SVM-4119432723879714822/exported_symbols.list -x pkl-linux-amd64.o /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libextnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnio.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libmanagement_ext.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libjava.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libzip.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/libjvm.a --export-dynamic -lz -ldl -lpthread -lrt -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: pkl-linux-amd64.o: warning: relocation in read-only section `.svm_heap' /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: read-only segment has dynamic relocations collect2: error: ld returned 1 exit status at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:202) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.runLinkerCommand(NativeImageViaCC.java:152) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:118) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:741) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:539) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:721) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:143) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:98) ``` <details> <summary>Full build log</summary> ``` europa third-party/pkl ‹main› » ./gradlew buildNative Downloading https://services.gradle.org/distributions/gradle-8.13-bin.zip .............10%.............20%.............30%.............40%.............50%.............60%.............70%.............80%.............90%.............100% Welcome to Gradle 8.13! Here are the highlights of this release: - Daemon JVM auto-provisioning - Enhancements for Scala plugin and JUnit testing - Improvements for build authors and plugin developers For more details see https://docs.gradle.org/8.13/release-notes.html Starting a Gradle Daemon (subsequent builds will be faster) Type-safe project accessors is an incubating feature. > Task :buildSrc:compileKotlin w: file:///home/agni/repos/third-party/pkl/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts:26:7 'task(String, Action<in Task!>): Task' is deprecated. Deprecated in Java w: file:///home/agni/repos/third-party/pkl/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts:35:7 'task(String, Action<in Task!>): Task' is deprecated. Deprecated in Java w: file:///home/agni/repos/third-party/pkl/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts:52:7 'task(String, Action<in Task!>): Task' is deprecated. Deprecated in Java w: file:///home/agni/repos/third-party/pkl/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts:67:7 'task(String, Action<in Task!>): Task' is deprecated. Deprecated in Java w: file:///home/agni/repos/third-party/pkl/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts:77:7 'task(String, Action<in Task!>): Task' is deprecated. Deprecated in Java > Task :downloadGraalVmAmd64 Download https://download.oracle.com/graalvm/21/archive/graalvm-jdk-21.0.5_linux-x64_bin.tar.gz > Task :pkl-commons-test:generateKeys Generating 3,072 bit RSA key pair and self-signed certificate (SHA384withRSA) with a validity of 90 days for: CN=localhost > Task :pkl-commons-test:exportCerts Certificate stored in file <localhost.pem> > Task :downloadGraalVmAmd64 Downloaded GraalVm to /home/agni/.graalvm/graalvm-jdk-21.0.5_linux-x64_bin.tar.gz > Task :installGraalVmAmd64 Extracting /home/agni/.graalvm/graalvm-jdk-21.0.5_linux-x64_bin.tar.gz into /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127 Installing native-image into /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127 Creating symlink /home/agni/.graalvm/graalvm-jdk-21.0.5_linux-x64_bin for /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127 > Task :pkl-core:compileJava Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. > Task :pkl-core:compileTestKotlin w: file:///home/agni/repos/third-party/pkl/pkl-core/src/test/kotlin/org/pkl/core/parser/ParserComparisonTestInterface.kt:21:8 'class ANTLRInputStream : Any, UnicodeCharStream, CharStream' is deprecated. Deprecated in Java. w: file:///home/agni/repos/third-party/pkl/pkl-core/src/test/kotlin/org/pkl/core/parser/ParserComparisonTestInterface.kt:86:26 'constructor(p0: String!): ANTLRInputStream' is deprecated. Deprecated in Java. w: file:///home/agni/repos/third-party/pkl/pkl-core/src/test/kotlin/org/pkl/core/parser/ParserComparisonTestInterface.kt:105:28 'constructor(p0: String!): ANTLRInputStream' is deprecated. Deprecated in Java. > Task :pkl-cli:linuxExecutableAmd64 ======================================================================================================================== GraalVM Native Image: Generating 'pkl-linux-amd64' (executable)... ======================================================================================================================== For detailed information and explanations on the build output, visit: https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md ------------------------------------------------------------------------------------------------------------------------ [1/8] Initializing... (8.3s @ 0.18GB) Java version: 21.0.5+9-LTS, vendor version: Oracle GraalVM 21.0.5+9.1 Graal compiler: optimization level: b, target machine: compatibility, PGO: off C compiler: gcc (pc, x86_64, 14.2.1) Garbage collector: Serial GC (max heap size: 80% of RAM) 4 user-specific feature(s): - com.oracle.svm.thirdparty.gson.GsonFeature - com.oracle.svm.truffle.TruffleBaseFeature: Provides support for Truffle languages - com.oracle.svm.truffle.TruffleFeature: Provides support for Truffle runtime compilation - org.graalvm.home.HomeFinderFeature: Finds GraalVM paths and its version number ------------------------------------------------------------------------------------------------------------------------ 6 experimental option(s) unlocked: - '-H:-ParseRuntimeOptions' (origin(s): command line) - '-H:+EnforceMaxRuntimeCompileMethods' (origin(s): command line) - '-H:IncludeResourceBundles' (origin(s): command line) - '-H:ResourceConfigurationResources' (origin(s): 'META-INF/native-image/org.jline/jline-terminal-jansi/native-image.properties' in 'file:///home/agni/.gradle/caches/modules-2/files-2.1/org.jline/jline-terminal-jansi/3.23.0/61359f811cd57ed31cd9b93f6792e2e64c63695d/jline-terminal-jansi-3.23.0.jar', 'META-INF/native-image/org.jline/jline-terminal/native-image.properties' in 'file:///home/agni/.gradle/caches/modules-2/files-2.1/org.jline/jline-terminal/3.23.0/8cce141b54352ab3d8dbd0d78665ffa0116ba167/jline-terminal-3.23.0.jar') - '-H:IncludeResources' (origin(s): command line, command line, command line) - '-H:ReflectionConfigurationResources' (origin(s): 'META-INF/native-image/org.jline/jline-terminal-jansi/native-image.properties' in 'file:///home/agni/.gradle/caches/modules-2/files-2.1/org.jline/jline-terminal-jansi/3.23.0/61359f811cd57ed31cd9b93f6792e2e64c63695d/jline-terminal-jansi-3.23.0.jar', 'META-INF/native-image/org.jline/jline-terminal/native-image.properties' in 'file:///home/agni/.gradle/caches/modules-2/files-2.1/org.jline/jline-terminal/3.23.0/8cce141b54352ab3d8dbd0d78665ffa0116ba167/jline-terminal-3.23.0.jar') ------------------------------------------------------------------------------------------------------------------------ Build resources: - 23.42GB of memory (75.6% of 31.00GB system memory, determined at start) - 32 thread(s) (100.0% of 32 available processor(s), determined at start) [2/8] Performing analysis... [********] (35.8s @ 1.94GB) 17,932 reachable types (93.1% of 19,253 total) 25,127 reachable fields (61.4% of 40,894 total) 90,497 reachable methods (65.0% of 139,190 total) 3,931 runtime compiled methods ( 2.8% of 139,190 total) 4,937 types, 320 fields, and 2,427 methods registered for reflection 77 types, 187 fields, and 138 methods registered for JNI access 4 native libraries: dl, pthread, rt, z [3/8] Building universe... (7.6s @ 2.62GB) [4/8] Parsing methods... [**] (4.8s @ 3.13GB) [5/8] Inlining methods... [****] (2.9s @ 1.74GB) [6/8] Compiling methods... [****] (14.9s @ 4.20GB) [7/8] Laying out methods... [***] (7.9s @ 2.38GB) [8/8] Creating image... [****] (0.0s @ 2.22GB) ------------------------------------------------------------------------------------------------------------------------ 9.7s (9.6% of total time) in 114 GCs | Peak RSS: 6.02GB | CPU load: 10.00 ------------------------------------------------------------------------------------------------------------------------ Produced artifacts: /home/agni/repos/third-party/pkl/pkl-cli/build/executable/svm_err_b_20250307T131854.405_pid3557.md (build_info) ======================================================================================================================== Failed generating 'pkl-linux-amd64' after 1m 38s. The build process encountered an unexpected error: java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1 Linker command executed: /usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--version-script,/tmp/SVM-4119432723879714822/exported_symbols.list -Wl,-x -o /home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64 pkl-linux-amd64.o /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libextnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnio.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libmanagement_ext.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libjava.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libzip.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/libjvm.a -Wl,--export-dynamic -v -L/tmp/SVM-4119432723879714822 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/macros/truffle-svm/builder -lz -ldl -lpthread -lrt Linker command output: Using built-in specs. COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-14.2.1_p20241221/work/gcc-14-20241221/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 14.2.1_p20241221 p7' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-build-config=bootstrap-cet Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.2.1 20241221 (Gentoo Hardened 14.2.1_p20241221 p7) COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64' '-v' '-L/tmp/SVM-4119432723879714822' '-L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc' '-L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64' '-L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/macros/truffle-svm/builder' '-mtune=generic' '-march=x86-64' '-dumpdir' '/home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64.' /usr/libexec/gcc/x86_64-pc-linux-gnu/14/collect2 -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/ccmfE45K.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -o /home/agni/repos/third-party/pkl/pkl-cli/build/executable/pkl-linux-amd64 -z noexecstack /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/tmp/SVM-4119432723879714822 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64 -L/home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/macros/truffle-svm/builder -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. --gc-sections --version-script /tmp/SVM-4119432723879714822/exported_symbols.list -x pkl-linux-amd64.o /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libextnet.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libnio.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libmanagement_ext.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libjava.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/static/linux-amd64/glibc/libzip.a /home/agni/.graalvm/b6e4d27e-768c-4d54-9f45-e506097f1127/lib/svm/clibraries/linux-amd64/libjvm.a --export-dynamic -lz -ldl -lpthread -lrt -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: pkl-linux-amd64.o: warning: relocation in read-only section `.svm_heap' /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: read-only segment has dynamic relocations collect2: error: ld returned 1 exit status at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:202) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.runLinkerCommand(NativeImageViaCC.java:152) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:118) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:741) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:539) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:721) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:143) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:98) > Task :pkl-cli:linuxExecutableAmd64 FAILED [Incubating] Problems report is available at: file:///home/agni/repos/third-party/pkl/build/reports/problems/problems-report.html FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':pkl-cli:linuxExecutableAmd64'. > Process 'command '/home/agni/.graalvm/graalvm-jdk-21.0.5_linux-x64_bin/bin/native-image'' finished with non-zero exit value 1 * 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 4m 43s 65 actionable tasks: 65 executed ``` </details>
adam closed this issue 2025-12-30 01:23:16 +01:00
Author
Owner

@bioball commented on GitHub (Mar 7, 2025):

This looks related: https://github.com/oracle/graal/issues/4076. See remediation here: https://github.com/oracle/graal/issues/4076#issuecomment-1304037035

By the way: buildNative will try to build two executables, using musl (statically linked) and glibc (dynamically linked), which we call alpine-linux and linux, respectively (if it finds the musl toolchain on the machine).

Do you intend to build both? You can also choose to only build the dynamically linked executable with ./gradlew linuxExecutableAmd64.

@bioball commented on GitHub (Mar 7, 2025): This looks related: https://github.com/oracle/graal/issues/4076. See remediation here: https://github.com/oracle/graal/issues/4076#issuecomment-1304037035 By the way: `buildNative` will try to build two executables, using musl (statically linked) and glibc (dynamically linked), which we call alpine-linux and linux, respectively (if it finds the musl toolchain on the machine). Do you intend to build both? You can also choose to only build the dynamically linked executable with `./gradlew linuxExecutableAmd64`.
Author
Owner

@sin-ack commented on GitHub (Mar 8, 2025):

Thanks for the tip re: variant; I think building the glibc version should be fine for now. Should this be kept open as a tracking issue or should it be closed?

@sin-ack commented on GitHub (Mar 8, 2025): Thanks for the tip re: variant; I think building the glibc version should be fine for now. Should this be kept open as a tracking issue or should it be closed?
Author
Owner

@bioball commented on GitHub (Mar 8, 2025):

I don't think this one is on us to fix; it's something to do with native-image. I'll close this issue. Thanks!

@bioball commented on GitHub (Mar 8, 2025): I don't think this one is on us to fix; it's something to do with native-image. I'll close this issue. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#300