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

Use llvm-strip with support for our cross-compilation targets #23

Merged
merged 1 commit into from
Jan 6, 2025
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
13 changes: 6 additions & 7 deletions xbuild/src/command/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,12 @@ pub fn build(env: &BuildEnv) -> Result<()> {
std::fs::copy(&lib, unstripped_lib)
.expect("Could not copy lib before stripping its debug symbols");

std::process::Command::new("strip")
.arg("--strip-all")
.arg(&lib)
.spawn()
.expect("Could not strip debug symbols from lib")
.wait()
.expect("Stripping of debug symbols from lib failed");
let mut cmd = std::process::Command::new("llvm-strip");
cmd.arg(&lib);
let status = cmd
.status()
.with_context(|| format!("Could not run `{cmd:?}`"))?;
ensure!(status.success(), "Failed to strip library using `{cmd:?}`");
}

let ndk = env.android_ndk();
Expand Down
3 changes: 2 additions & 1 deletion xbuild/src/command/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ impl Default for Doctor {
checks: vec![
Check::new("clang", Some(VersionCheck::new("--version", 0, 2))),
Check::new("clang++", Some(VersionCheck::new("--version", 0, 2))),
Check::new("llvm-ar", None),
Check::new("llvm-ar", Some(VersionCheck::new("--version", 1, 4))),
Check::new("llvm-lib", None),
Check::new("llvm-strip", Some(VersionCheck::new("--version", 2, 4))),
Check::new("llvm-readobj", Some(VersionCheck::new("--version", 1, 4))),
Check::new("lld", Some(VersionCheck::new("-flavor ld --version", 0, 1))),
Check::new("lld-link", Some(VersionCheck::new("--version", 0, 1))),
Expand Down
2 changes: 1 addition & 1 deletion xbuild/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mod task;
/// Current NDK version xbuild should use for Android.
///
/// If this version is not available on a users machine xbuild will download it
/// from our releases: ['https://github.com/Traverse-Research/xbuild/releases'].
/// from our releases: https://github.com/Traverse-Research/xbuild/releases.
///
/// The actual version used is determined by whatever the "ubuntu-latest" image has installed.
const ANDROID_NDK_CURRENT: &str = "27.1.12297006";
Expand Down
Loading