Skip to content

Commit d37b8e3

Browse files
committed
tests: disable Linux linker version script for rustc <1.90.0
rustc <1.90.0 does not handle the version_script used in the Linux test code -- skip using a version script with rustc <1.90.0 since this is not testing essential functionality. this cset can be reverted once the msrv for cxx moves past 1.89.0
1 parent 3505129 commit d37b8e3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tests/shared_library/library/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ cxx = { path = "../../.." }
1818
cxx-gen = { path = "../../../gen/lib" }
1919
cc = "1.0"
2020
proc-macro2 = "1.0"
21+
rustc_version = "0.4"

tests/shared_library/library/build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::env;
22
use std::fs;
33
use std::io::Write;
44
use std::path::PathBuf;
5+
use rustc_version::{version, Version};
56

67
fn main() {
78
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
@@ -90,7 +91,11 @@ fn main() {
9091
let version_script_path = out_dir.join("libtest_library.version");
9192
fs::write(&version_script_path, version_script).unwrap();
9293

93-
println!("cargo:rustc-cdylib-link-arg=-Wl,--version-script={}", version_script_path.display());
94+
let curr = version().unwrap();
95+
let is_broken_version_script = curr < Version::parse("1.90.0").unwrap();
96+
if !is_broken_version_script {
97+
println!("cargo:rustc-cdylib-link-arg=-Wl,--version-script={}", version_script_path.display());
98+
}
9499
println!("cargo:rustc-cdylib-link-arg=-Wl,--allow-shlib-undefined");
95100
}
96101

0 commit comments

Comments
 (0)