Fix call to rustc-objcopy to strip binary on Linux (#5066)
* Fix call to rustc-objcopy to strip binary on Linux Signed-off-by: Nico Burns <nico@nicoburns.com> * Print stdout and stderr if strip fails Signed-off-by: Nico Burns <nico@nicoburns.com> --------- Signed-off-by: Nico Burns <nico@nicoburns.com>
This commit is contained in:
1 parent
05b2dd400c
commit
552b553a44
2 files changed
+13
No files matched your search
@@ -3979,10 +3979,18 @@ impl BuildRequest {
|
||||
};
|
||||
if let Some(strip_arg) = strip_arg {
|
||||
let rustc_objcopy = self.workspace.rustc_objcopy();
|
||||
let dylib_path = self.workspace.rustc_objcopy_dylib_path();
|
||||
let mut command = Command::new(rustc_objcopy);
|
||||
command.env("LD_LIBRARY_PATH", &dylib_path);
|
||||
command.arg(strip_arg).arg(exe).arg(exe);
|
||||
let output = command.output().await?;
|
||||
if !output.status.success() {
|
||||
if let Ok(stdout) = std::str::from_utf8(&output.stdout) {
|
||||
tracing::error!("{}", stdout);
|
||||
}
|
||||
if let Ok(stderr) = std::str::from_utf8(&output.stderr) {
|
||||
tracing::error!("{}", stderr);
|
||||
}
|
||||
return Err(anyhow::anyhow!("Failed to strip binary"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,6 +285,11 @@ impl Workspace {
|
||||
.join("rust-objcopy")
|
||||
}
|
||||
|
||||
// ./rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib
|
||||
pub fn rustc_objcopy_dylib_path(&self) -> PathBuf {
|
||||
self.sysroot.join("lib")
|
||||
}
|
||||
|
||||
/// Find the "main" package in the workspace. There might not be one!
|
||||
pub fn find_main_package(&self, package: Option<String>) -> Result<NodeId> {
|
||||
if let Some(package) = package {
|
||||
|
||||
Reference in new issue
Block a user