Rollup merge of #139677 - jchecahi:profiler-builtin-rtlib-path-fix, r=kobzol
Fix profiler_builtins build script to handle full path to profiler lib LLVM_PROFILER_RT_LIB may be set to an absolute path (e.g., in Fedora builds), but `-l` expects a library name, not a path. After #138273, this caused builds to fail with a "could not find native static library" error. This patch updates the build script to split the path into directory and filename, using `cargo::rustc-link-search` for the directory and `cargo::rustc-link-lib=+verbatim` for the file. This allows profiler_builtins to correctly link the static library even when an absolute path is provided.
This commit is contained in:
commit
f2a2135dc6
1 changed files with 8 additions and 2 deletions
|
@ -9,8 +9,14 @@ use std::path::PathBuf;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
if let Ok(rt) = tracked_env_var("LLVM_PROFILER_RT_LIB") {
|
if let Ok(rt) = tracked_env_var("LLVM_PROFILER_RT_LIB") {
|
||||||
println!("cargo::rustc-link-lib=static:+verbatim={rt}");
|
let rt = PathBuf::from(rt);
|
||||||
return;
|
if let Some(lib) = rt.file_name() {
|
||||||
|
if let Some(dir) = rt.parent() {
|
||||||
|
println!("cargo::rustc-link-search=native={}", dir.display());
|
||||||
|
}
|
||||||
|
println!("cargo::rustc-link-lib=static:+verbatim={}", lib.to_str().unwrap());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let target_os = env::var("CARGO_CFG_TARGET_OS").expect("CARGO_CFG_TARGET_OS was not set");
|
let target_os = env::var("CARGO_CFG_TARGET_OS").expect("CARGO_CFG_TARGET_OS was not set");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue