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

Native Build Fails, when Reusing Existing Executable with Compression Enabled #41373

Closed
gcw-it opened this issue Jun 23, 2024 · 3 comments · Fixed by #41930
Closed

Native Build Fails, when Reusing Existing Executable with Compression Enabled #41373

gcw-it opened this issue Jun 23, 2024 · 3 comments · Fixed by #41930
Labels
area/native-image kind/bug Something isn't working
Milestone

Comments

@gcw-it
Copy link
Contributor

gcw-it commented Jun 23, 2024

Describe the bug

Building a native executable with <quarkus.native.reuse-existing>true</quarkus.native.reuse-existing> set, and compression enabled, leads to a failing build, when the artifact already exists.

Expected behavior

The plugin skips the compression step for the already compressed executable, and the build is finished without error.

Actual behavior

The build fails with:
Build step io.quarkus.deployment.pkg.steps.UpxCompressionBuildStep#compress threw an exception: java.lang.IllegalStateException: Unable to compress the native executable

How to Reproduce?

  1. quarkus create
  2. add the following properties to the native profile in pom.xml.
    <quarkus.native.container-build>true</quarkus.native.container-build>
    <quarkus.native.reuse-existing>true</quarkus.native.reuse-existing>
    <quarkus.native.compression.level>1</quarkus.native.compression.level>
  3. mvn package -DskipTests -Dnative
  4. When running the build a 2nd time (mvn package -DskipTests -Dnative) the build fails, because the plugin tries to recompress the already compressed executable.

Output of uname -a or ver

Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_X86_64 x86_64

Output of java -version

java 22.0.1 2024-04-16

Mandrel or GraalVM version (if different from Java)

quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-21

Quarkus version or git rev

3.11.3

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

Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)

Additional information

No response

@gcw-it gcw-it added area/native-image kind/bug Something isn't working labels Jun 23, 2024
Copy link

quarkus-bot bot commented Jun 23, 2024

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

@galderz
Copy link
Member

galderz commented Jul 8, 2024

@gcw-it Fancy trying to implement this yourself? UpxCompressionBuildStep could be enhanced to see if the binary is already there (and reuse existing is on) and check if the file is already compressed.

@gcw-it
Copy link
Contributor Author

gcw-it commented Jul 8, 2024

@galderz I could tackle this in the next few days, when I find some spare time (Probably on the weekend).

But first and foremost we should come to an understanding, what the expected behaviour should be.

Probably simplest and least surprising would be, to leave an existing artifact alone and skip the compression step.

If we go down the road to compress an existing uncompressed executable, if the compression settings have changed between builds, then we have to consider some other situations:

  • What happens, when the file is already compressed and the compression level is changed?
  • What happens to a compressed file, if compression is disabled?

In my opinion, the cleanest approach would be to take Reuse Existing Executable literally and leave the existing artifact alone.
What are your thoughts?

gcw-it added a commit to gcw-it/quarkus that referenced this issue Jul 11, 2024
gcw-it added a commit to gcw-it/quarkus that referenced this issue Jul 15, 2024
gcw-it added a commit to gcw-it/quarkus that referenced this issue Jul 15, 2024
@quarkus-bot quarkus-bot bot added this to the 3.14 - main milestone Jul 17, 2024
@gsmet gsmet modified the milestones: 3.14 - main, 3.13.0 Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/native-image kind/bug Something isn't working
Projects
None yet
3 participants