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

Improve logging and documentation about objcopy dependency #13582

Merged
merged 1 commit into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, NativeImageSourceJa
}
// Strip debug symbols regardless, because the underlying JDK might contain them
objcopy("--strip-debug", finalPath.toString());
} else {
log.warn("objcopy executable not found in PATH. Debug symbols will not be separated from executable.");
log.warn("That will result in a larger native image with debug symbols embedded in it.");
}

return new NativeImageBuildItem(finalPath);
Expand Down Expand Up @@ -657,7 +660,6 @@ private boolean objcopyExists(Map<String, String> env) {
}
}

log.debug("Cannot find executable (objcopy) to separate symbols from executable.");
return false;
}

Expand Down
19 changes: 19 additions & 0 deletions docs/src/main/asciidoc/building-native-image.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,25 @@ To generate debug symbols,
add `-Dquarkus.native.debug.enabled=true` flag when generating the native executable.
You will find the debug symbols for the native executable in a `.debug` file next to the native executable.

[NOTE]
====
The generation of the `.debug` file depends on `objcopy`.
On common Linux distributions and macOS you will need to install the `binutils` package:

[source,bash]
----
# dnf (rpm-based)
sudo dnf install binutils
# Debian-based distributions
sudo apt-get install binutils
# macOS
brew install binutils
export PATH=/usr/local/opt/binutils/bin:$PATH
----

When `objcopy` is not available debug symbols are embedded in the executable.
====

Aside from debug symbols,
setting `-Dquarkus.native.debug.enabled=true` flag generates a cache of source files
for any JDK runtime classes, GraalVM classes and application classes resolved during native executable generation.
Expand Down