-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Only use objcopy
in Linux environments
#20297
Conversation
Thanks for your pull request! The title of your pull request does not follow our editorial rules. Could you have a look?
|
objcopy
in Linux environments #13856objcopy
in Linux environments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @galderz , the patch looks good but I am afraid the warning message in
quarkus/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildRunner.java
Lines 79 to 83 in 0d9d2e4
if (!debugSymbolsEnabled) { | |
log.warn( | |
"objcopy executable not found in PATH. Debug symbols will therefore not be separated from the executable."); | |
log.warn("That also means that resulting native executable is larger as it embeds the debug symbols."); | |
} |
What do you think about applying something like the following as well?
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildRunner.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildRunner.java
index d299db7a66..fa0703e27b 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildRunner.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildRunner.java
@@ -12,6 +12,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import org.apache.commons.lang3.SystemUtils;
import org.jboss.logging.Logger;
import io.quarkus.deployment.util.ProcessUtil;
@@ -75,12 +76,10 @@ public abstract class NativeImageBuildRunner {
// Strip debug symbols regardless, because the underlying JDK might contain them
objcopy("--strip-debug", resultingExecutableName);
}
- } else {
- if (!debugSymbolsEnabled) {
- log.warn(
- "objcopy executable not found in PATH. Debug symbols will therefore not be separated from the executable.");
- log.warn("That also means that resulting native executable is larger as it embeds the debug symbols.");
- }
+ } else if (SystemUtils.IS_OS_LINUX){
+ log.warn(
+ "objcopy executable not found in PATH. Debug symbols will therefore not be separated from the executable.");
+ log.warn("That also means that resulting native executable is larger as it embeds the debug symbols.");
}
return new Result(0, objcopyExists);
} finally {
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
index 75ba060b0e..a251cc9733 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
@@ -228,12 +228,7 @@ public class NativeImageBuildStep {
final Path finalSources = outputTargetBuildItem.getOutputDirectory().resolve(sources);
IoUtils.copy(generatedSources, finalSources);
IoUtils.recursiveDelete(generatedSources);
- } else {
- log.warn(
- "objcopy executable not found in PATH. Debug symbols therefore cannot be placed into the dedicated directory.");
- log.warn("That also means that resulting native executable is larger as it embeds the debug symbols.");
}
-
}
System.setProperty("native.image.path", finalExecutablePath.toAbsolutePath().toString());
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building d682129
Full information is available in the Build summary check run. Failures⚙️ Gradle Tests - JDK 11 #- Failing: integration-tests/gradle
📦 integration-tests/gradle✖
⚙️ JVM Tests - JDK 11 Windows #- Failing: extensions/amazon-lambda/deployment
! Skipped: docs extensions/amazon-lambda-http/deployment extensions/amazon-lambda-rest/deployment and 6 more 📦 extensions/amazon-lambda/deployment✖
|
d682129
to
430fce8
Compare
@zakkak Fixed the warning messages. See updated commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks Galder
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building 430fce8
Failures⚙️ Initial JDK 11 Build #- Failing: core/deployment
! Skipped: core/test-extension/deployment core/test-extension/runtime devtools/bom-descriptor-json and 606 more 📦 core/deployment✖ |
log.warn( | ||
"objcopy executable not found in PATH. Debug symbols therefore cannot be placed into the dedicated directory."); | ||
log.warn("That also means that resulting native executable is larger as it embeds the debug symbols."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, it looks like you were a bit more aggressive here, we need that }
back :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix this shortly.
* `objcopy` invocations in macOS make the executable crash on startup. * Debug info is only available for Linux, so avoid `objcopy` altogether on macOS, even if present in PATH. * Updated documentation to avoid confusion. * Adjusted warning messages about `objcopy`.
430fce8
to
7c12f02
Compare
I rebased and fixed the compilation issue. Let's see how CI goes. |
Likely not necessary as @zakkak can best explain |
Thx for fixing it @gsmet |
It'd be nice to backport it. It'd stop people from asking us what is going with this (Max asked us yesterday). |
Backport to |
@geoand Yeah backport to |
It should be straightforward, but I'll let you if/when the time comes |
Addresses macOS issues in #13856.
objcopy
invocations in macOS make the executable crash on startup.so avoid
objcopy
altogether on macOS,even if present in PATH.