Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create native debug build in Gradle #19079

Closed
andlinger opened this issue Jul 29, 2021 · 11 comments · Fixed by #19087
Closed

Unable to create native debug build in Gradle #19079

andlinger opened this issue Jul 29, 2021 · 11 comments · Fixed by #19087
Assignees
Labels
area/gradle Gradle area/kotlin kind/bug Something isn't working
Milestone

Comments

@andlinger
Copy link
Contributor

Describe the bug

I wanted to create a native debug build in Gradle. I attached the following arguments to the 'build' task:
-Dquarkus.package.type=native -Dquarkus.native.debug.enabled=true

However, the following exception happens at the end of the build:

> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:223)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1476)
        at java.base/java.lang.Thread.run(Thread.java:829)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
  Caused by: java.nio.file.NoSuchFileException: /Users/user/quarkus-backend/backend/build/backend-1.0.0-SNAPSHOT-native-image-source-jar/sources
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
        at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
        at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:149)
        at java.base/java.nio.file.Files.readAttributes(Files.java:1764)
        at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:225)
        at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
        at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
        at java.base/java.nio.file.Files.walkFileTree(Files.java:2717)
        at io.quarkus.bootstrap.util.IoUtils.copy(IoUtils.java:126)
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:213)

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

Darwin hostname 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08) OpenJDK 64-Bit Server VM GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.0.3.Final

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

------------------------------------------------------------ Gradle 7.1.1 ------------------------------------------------------------ Build time: 2021-07-02 12:16:43 UTC Revision: 774525a055494e0ece39f522ac7ad17498ce032c Kotlin: 1.4.31 Groovy: 3.0.7 Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020 JVM: 11.0.12 (GraalVM Community 11.0.12+6-jvmci-21.2-b08) OS: Mac OS X 11.5 x86_64

Additional information

No response

@andlinger andlinger added the kind/bug Something isn't working label Jul 29, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 29, 2021

/cc @evanchooly, @glefloch, @quarkusio/devtools

@geoand
Copy link
Contributor

geoand commented Jul 29, 2021

I was not able to reproduce this with a new project downloaded from code.quarkus.io

@andlinger
Copy link
Contributor Author

Which means?

@geoand
Copy link
Contributor

geoand commented Jul 29, 2021

That you'll need to attach a sample project and provide more information for us

@andlinger
Copy link
Contributor Author

I just tried to download a new project from code.quarkus.io. Here the problem happens too.

Execution failed for task ':quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:227)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1476)
        at java.base/java.lang.Thread.run(Thread.java:829)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
  Caused by: java.nio.file.NoSuchFileException: /Users/user/Downloads/code-with-quarkus/build/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar/sources
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
        at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
        at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:149)
        at java.base/java.nio.file.Files.readAttributes(Files.java:1764)
        at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:225)
        at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
        at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
        at java.base/java.nio.file.Files.walkFileTree(Files.java:2717)
        at io.quarkus.bootstrap.util.IoUtils.copy(IoUtils.java:126)
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:217)
        ... 11 more

@geoand
Copy link
Contributor

geoand commented Jul 29, 2021

I can't reproduce it. Maybe @glefloch can or has an idea about what might be going on

@glefloch
Copy link
Member

I can reproduce the error when adding the -Dquarkus.native.debug.enabled=true option. It looks like the file build/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar/code-with-quarkus-1.0.0-SNAPSHOT-runner.debug does not exist.

@geoand should it be generated by the native-image tool?

@andlinger
Copy link
Contributor Author

The fact that the .debug file is not found can, according to the documentation, also be due to the fact that "objcopy" is not installed or not in the PATH. I have encountered this error before.

@geoand
Copy link
Contributor

geoand commented Jul 29, 2021

I'll take a look

@geoand
Copy link
Contributor

geoand commented Jul 29, 2021

I was able to reproduce it and I'll come up with a fix soon

@geoand
Copy link
Contributor

geoand commented Jul 29, 2021

#19087 takes care of the issue

geoand added a commit that referenced this issue Jul 29, 2021
Ensure that building native image doesn't fail when objcopy is missing
@quarkus-bot quarkus-bot bot added this to the 2.2 - main milestone Jul 29, 2021
@gsmet gsmet modified the milestones: 2.2 - main, 2.1.1.Final Aug 3, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle area/kotlin kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants