Skip to content

Conversation

@subkanthi
Copy link
Collaborator

@subkanthi subkanthi commented Jul 7, 2025

@subkanthi subkanthi linked an issue Jul 7, 2025 that may be closed by this pull request
@subkanthi subkanthi marked this pull request as ready for review July 8, 2025 15:43
Copy link
Collaborator

@shyiko shyiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Have you tried ice inserting data using produced binary?
  2. libc is dynamically linked (on amd64 we can use <arg>--static</arg><arg>--libc=musl</arg> but for arm64 there is no solution afaik)
  3. missing build for arm64
  4. missing dockerfiles for building native images (you'll likely need ghcr.io/graalvm/native-image-community)

@shyiko
Copy link
Collaborator

shyiko commented Aug 18, 2025

Converting to Draft per #42 (review)

@shyiko shyiko marked this pull request as draft August 18, 2025 17:13
@subkanthi subkanthi marked this pull request as ready for review November 20, 2025 01:20
Copy link
Collaborator

@shyiko shyiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# Install prerequisites
sdk env  # or ensure Java 21+ and GraalVM are available

# For amd64 (static with musl - no dependencies)
./build-native.sh
# Produces: ice/target/ice (static binary)

fails with

Error: Classes that should be initialized at run time got initialized during image building:
 ch.qos.logback.core.pattern.parser.Parser was unintentionally initialized at build time. To see why ch.qos.logback.core.pattern.parser.Parser got initialized use --trace-class-initialization=ch.qos.logback.core.pattern.parser.Parser
org.slf4j.LoggerFactory was unintentionally initialized at build time. To see why org.slf4j.LoggerFactory got initialized use --trace-class-initialization=org.slf4j.LoggerFactory
org.slf4j.helpers.Reporter was unintentionally initialized at build time. To see why org.slf4j.helpers.Reporter got initialized use --trace-class-initialization=org.slf4j.helpers.Reporter
ch.qos.logback.core.CoreConstants was unintentionally initialized at build time. To see why ch.qos.logback.core.CoreConstants got initialized use --trace-class-initialization=ch.qos.logback.core.CoreConstants
ch.qos.logback.core.util.Loader was unintentionally initialized at build time. To see why ch.qos.logback.core.util.Loader got initialized use --trace-class-initialization=ch.qos.logback.core.util.Loader
ch.qos.logback.classic.Level was unintentionally initialized at build time. To see why ch.qos.logback.classic.Level got initialized use --trace-class-initialization=ch.qos.logback.classic.Level
picocli.CommandLine$Help$Ansi was unintentionally initialized at build time. To see why picocli.CommandLine$Help$Ansi got initialized use --trace-class-initialization=picocli.CommandLine$Help$Ansi
ch.qos.logback.core.status.StatusBase was unintentionally initialized at build time. To see why ch.qos.logback.core.status.StatusBase got initialized use --trace-class-initialization=ch.qos.logback.core.status.StatusBase
ch.qos.logback.core.status.InfoStatus was unintentionally initialized at build time. To see why ch.qos.logback.core.status.InfoStatus got initialized use --trace-class-initialization=ch.qos.logback.core.status.InfoStatus
ch.qos.logback.core.util.StatusPrinter2 was unintentionally initialized at build time. To see why ch.qos.logback.core.util.StatusPrinter2 got initialized use --trace-class-initialization=ch.qos.logback.core.util.StatusPrinter2
ch.qos.logback.core.util.StatusPrinter was unintentionally initialized at build time. To see why ch.qos.logback.core.util.StatusPrinter got initialized use --trace-class-initialization=ch.qos.logback.core.util.StatusPrinter
ch.qos.logback.classic.PatternLayout was unintentionally initialized at build time. To see why ch.qos.logback.classic.PatternLayout got initialized use --trace-class-initialization=ch.qos.logback.classic.PatternLayout
ch.qos.logback.classic.Logger was unintentionally initialized at build time. To see why ch.qos.logback.classic.Logger got initialized use --trace-class-initialization=ch.qos.logback.classic.Logger
To see how the classes got initialized, use --trace-class-initialization=ch.qos.logback.core.pattern.parser.Parser,org.slf4j.LoggerFactory,org.slf4j.helpers.Reporter,ch.qos.logback.core.CoreConstants,ch.qos.logback.core.util.Loader,ch.qos.logback.classic.Level,picocli.CommandLine$Help$Ansi,ch.qos.logback.core.status.StatusBase,ch.qos.logback.core.status.InfoStatus,ch.qos.logback.core.util.StatusPrinter2,ch.qos.logback.core.util.StatusPrinter,ch.qos.logback.classic.PatternLayout,ch.qos.logback.classic.Logger
com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
 ch.qos.logback.core.pattern.parser.Parser was unintentionally initialized at build time. To see why ch.qos.logback.core.pattern.parser.Parser got initialized use --trace-class-initialization=ch.qos.logback.core.pattern.parser.Parser
org.slf4j.LoggerFactory was unintentionally initialized at build time. To see why org.slf4j.LoggerFactory got initialized use --trace-class-initialization=org.slf4j.LoggerFactory
org.slf4j.helpers.Reporter was unintentionally initialized at build time. To see why org.slf4j.helpers.Reporter got initialized use --trace-class-initialization=org.slf4j.helpers.Reporter
ch.qos.logback.core.CoreConstants was unintentionally initialized at build time. To see why ch.qos.logback.core.CoreConstants got initialized use --trace-class-initialization=ch.qos.logback.core.CoreConstants
ch.qos.logback.core.util.Loader was unintentionally initialized at build time. To see why ch.qos.logback.core.util.Loader got initialized use --trace-class-initialization=ch.qos.logback.core.util.Loader
ch.qos.logback.classic.Level was unintentionally initialized at build time. To see why ch.qos.logback.classic.Level got initialized use --trace-class-initialization=ch.qos.logback.classic.Level
picocli.CommandLine$Help$Ansi was unintentionally initialized at build time. To see why picocli.CommandLine$Help$Ansi got initialized use --trace-class-initialization=picocli.CommandLine$Help$Ansi
ch.qos.logback.core.status.StatusBase was unintentionally initialized at build time. To see why ch.qos.logback.core.status.StatusBase got initialized use --trace-class-initialization=ch.qos.logback.core.status.StatusBase
ch.qos.logback.core.status.InfoStatus was unintentionally initialized at build time. To see why ch.qos.logback.core.status.InfoStatus got initialized use --trace-class-initialization=ch.qos.logback.core.status.InfoStatus
ch.qos.logback.core.util.StatusPrinter2 was unintentionally initialized at build time. To see why ch.qos.logback.core.util.StatusPrinter2 got initialized use --trace-class-initialization=ch.qos.logback.core.util.StatusPrinter2
ch.qos.logback.core.util.StatusPrinter was unintentionally initialized at build time. To see why ch.qos.logback.core.util.StatusPrinter got initialized use --trace-class-initialization=ch.qos.logback.core.util.StatusPrinter
ch.qos.logback.classic.PatternLayout was unintentionally initialized at build time. To see why ch.qos.logback.classic.PatternLayout got initialized use --trace-class-initialization=ch.qos.logback.classic.PatternLayout
ch.qos.logback.classic.Logger was unintentionally initialized at build time. To see why ch.qos.logback.classic.Logger got initialized use --trace-class-initialization=ch.qos.logback.classic.Logger
To see how the classes got initialized, use --trace-class-initialization=ch.qos.logback.core.pattern.parser.Parser,org.slf4j.LoggerFactory,org.slf4j.helpers.Reporter,ch.qos.logback.core.CoreConstants,ch.qos.logback.core.util.Loader,ch.qos.logback.classic.Level,picocli.CommandLine$Help$Ansi,ch.qos.logback.core.status.StatusBase,ch.qos.logback.core.status.InfoStatus,ch.qos.logback.core.util.StatusPrinter2,ch.qos.logback.core.util.StatusPrinter,ch.qos.logback.classic.PatternLayout,ch.qos.logback.classic.Logger

@subkanthi subkanthi marked this pull request as draft November 21, 2025 15:22
@subkanthi
Copy link
Collaborator Author

subkanthi commented Nov 21, 2025

ARM testing
sudo apt-get install build-essential libz-dev zlib1g-dev

readelf -h ice
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Position-Independent Executable file)
  Machine:                           AArch64
  Version:                           0x1
  Entry point address:               0x41b000
  Start of program headers:          64 (bytes into file)
  Start of section headers:          159087904 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         9
  Size of section headers:           64 (bytes)
  Number of section headers:         36
  Section header string table index: 35

@subkanthi subkanthi requested a review from shyiko November 21, 2025 19:10
@subkanthi subkanthi marked this pull request as ready for review November 21, 2025 19:10
Copy link
Collaborator

@shyiko shyiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ubuntu 24.04 with /usr/lib/x86_64-linux-gnu/libz.a present (build-essential libz-dev zlib1g-dev musl-tools - all latest):

The build process encountered an unexpected error:

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

Based on the linker command output, possible reasons for this include:
1. It appears as though libz:.a is missing. Please install it.

Linker command executed:
<clipped>

Linker command output:
Using built-in specs.
Reading specs from /usr/lib/x86_64-linux-musl/musl-gcc.specs
rename spec cpp_options to old_cpp_options
COLLECT_GCC=x86_64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) 
COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' <clipped>
/usr/bin/ld: cannot find -lz: No such file or directory
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)

Can you please provide a Dockefile that can be used to build these? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ice: make a downloadable binary w/o Java dependencies

3 participants