quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.82k stars 2.69k forks source link

Building a native image with the --bundle-create build arg fails #38204

Closed tenaf0 closed 10 months ago

tenaf0 commented 10 months ago

Describe the bug

I have created a base quarkus project (with quarkus create), and added a quarkus.native.additional-build-args option specifying --bundle-create=someName.nib (both with and without an additional ,dry-build "flag"). Issuing ./mvnw package -Dnative results in an exception being thrown, even though the build/creation of nib file seems to have been successful -- I get the following files in target:

├── quarkus.nib
└── quarkus.output
    ├── default
    │   ├── code-with-quarkus-1.0.0-SNAPSHOT-runner
    └── other
        └── code-with-quarkus-1.0.0-SNAPSHOT-runner-build-output-stats.json

So I believe the only problem is that quarkus's build expects a binary at a given location, while this graal native image argument uses a different location instead.

Expected behavior

A build that returns without exception.

Actual behavior

I get the following exception:

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] objcopy --strip-debug code-with-quarkus-1.0.0-SNAPSHOT-runner
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:24 min
[INFO] Finished at: 2024-01-15T23:27:33+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.6.5:build (default) on project code-with-quarkus: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:301)
[ERROR]         at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:1583)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] Caused by: java.nio.file.NoSuchFileException: /home/florian/Documents/git/graal-enterprise/vm-enterprise/tests/native-image/obfuscation/code-with-quarkus/target/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar/code-with-quarkus-1.0.0-SNAPSHOT-runner
[ERROR]         at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
[ERROR]         at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
[ERROR]         at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
[ERROR]         at java.base/sun.nio.fs.UnixFileSystem.copy(UnixFileSystem.java:1005)
[ERROR]         at java.base/sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:300)
[ERROR]         at java.base/java.nio.file.Files.copy(Files.java:1304)
[ERROR]         at io.quarkus.bootstrap.util.IoUtils.copy(IoUtils.java:149)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:260)
[ERROR]         ... 9 more
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

How to Reproduce?

  1. quarkus create
  2. Add <quarkus.native.additional-build-args>--bundle-create=quarkus.nib</quarkus.native.additional-build-args> to pom.xml (also, possibly with =quarkus.nib,dry-build)
  3. ./mvnw package -Dnative

Output of uname -a or ver

Linux fedora 6.5.11-300

Output of java -version

21 GraalVM

Mandrel or GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.6.5

Build tool (ie. output of mvnw --version or gradlew --version)

3.9.6

Additional information

No response

quarkus-bot[bot] commented 10 months ago

/cc @Karm (mandrel), @galderz (mandrel), @zakkak (mandrel,native-image)

zakkak commented 10 months ago

Hi @tenaf0 , indeed this is currently not supported.

You can find a feature request regarding adding this feature here. You can subscribe to it to get updates on any progress on that. PRs are also welcome :)

I am closing this issue in favor of https://github.com/quarkusio/quarkus/issues/36192

tenaf0 commented 10 months ago

Hi @zakkak , thanks, I apologize for not looking hard enough to find that issue!