Skip to content

Commit 3906e9a

Browse files
committed
Invoke backtrace-rs buildscript in std buildscript
Based on #99883 by @Arc-blroth Depends on rust-lang/backtrace-rs#556 and rust-lang/cc-rs#705
1 parent 1e836d1 commit 3906e9a

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -4862,6 +4862,7 @@ version = "0.0.0"
48624862
dependencies = [
48634863
"addr2line",
48644864
"alloc",
4865+
"cc",
48654866
"cfg-if",
48664867
"compiler_builtins",
48674868
"core",

library/std/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ object = { version = "0.31.1", default-features = false, optional = true, featur
3636
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
3737
rand_xorshift = "0.3.0"
3838

39+
[build-dependencies]
40+
# Dependency of the `backtrace` crate
41+
cc = "1.0.67"
42+
3943
[target.'cfg(any(all(target_family = "wasm", target_os = "unknown"), all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
4044
dlmalloc = { version = "0.2.3", features = ['rustc-dep-of-std'] }
4145

library/std/build.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
use std::env;
22

3+
// backtrace-rs requires a feature check on Android targets, so
4+
// we need to run its build.rs as well.
5+
#[allow(unused_extern_crates)]
6+
#[path = "../backtrace/build.rs"]
7+
mod backtrace_build_rs;
8+
39
fn main() {
410
println!("cargo:rerun-if-changed=build.rs");
511
let target = env::var("TARGET").expect("TARGET was not set");
@@ -56,4 +62,6 @@ fn main() {
5662
}
5763
println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
5864
println!("cargo:rustc-cfg=backtrace_in_libstd");
65+
66+
backtrace_build_rs::main();
5967
}

0 commit comments

Comments
 (0)