Skip to content

Commit cd5446d

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

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -4990,6 +4990,7 @@ version = "0.0.0"
49904990
dependencies = [
49914991
"addr2line",
49924992
"alloc",
4993+
"cc",
49934994
"cfg-if",
49944995
"compiler_builtins",
49954996
"core",

library/std/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ object = { version = "0.32.0", default-features = false, optional = true, featur
3535
[dev-dependencies]
3636
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
3737
rand_xorshift = "0.3.0"
38+
# Dependency of the `backtrace` crate's build script
39+
cc = "1.0.67"
3840

3941
[target.'cfg(any(all(target_family = "wasm", target_os = "unknown"), target_os = "xous", all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
4042
dlmalloc = { version = "0.2.4", features = ['rustc-dep-of-std'] }

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");
@@ -58,4 +64,6 @@ fn main() {
5864
}
5965
println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
6066
println!("cargo:rustc-cfg=backtrace_in_libstd");
67+
68+
backtrace_build_rs::main();
6169
}

0 commit comments

Comments
 (0)