From e78e511e30031785253f767caf37e7efa0d08191 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Tue, 1 Nov 2022 20:53:26 +0100 Subject: [PATCH 1/2] When building for linux, replace all vendors with 'unknown' Some build systems such as the Yocto project define custom rust targets, of the form 'arch-somevendor-linux-gnu/musl' (only the 'somevendor' part is custom, the rest matches rust's definitions). This causes mismatches with crossbeam's lists of targets which are built from the standard rust target list, and always have 'unknown' as the vendor. This change simply replaces such custom vendors with 'unknown' when the third component of the target is 'linux'. --- build-common.rs | 13 +++++++++++++ crossbeam-epoch/build-common.rs | 1 + crossbeam-epoch/build.rs | 3 ++- crossbeam-queue/build-common.rs | 1 + crossbeam-queue/build.rs | 3 ++- crossbeam-skiplist/build-common.rs | 1 + crossbeam-skiplist/build.rs | 3 ++- crossbeam-utils/build-common.rs | 1 + crossbeam-utils/build.rs | 3 ++- 9 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 build-common.rs create mode 120000 crossbeam-epoch/build-common.rs create mode 120000 crossbeam-queue/build-common.rs create mode 120000 crossbeam-skiplist/build-common.rs create mode 120000 crossbeam-utils/build-common.rs diff --git a/build-common.rs b/build-common.rs new file mode 100644 index 000000000..664098ec3 --- /dev/null +++ b/build-common.rs @@ -0,0 +1,13 @@ +// The target triplets have the form of 'arch-vendor-system'. +// +// When building for Linux (e.g. the 'system' part is +// 'linux-something'), replace the vendor with 'unknown' +// so that mapping to rust standard targets happens correctly. +fn convert_custom_linux_target(target: String) -> String { + let mut parts: Vec<&str> = target.split('-').collect(); + let system = parts[2]; + if system == "linux" { + parts[1] = "unknown"; + }; + parts.join("-") +} diff --git a/crossbeam-epoch/build-common.rs b/crossbeam-epoch/build-common.rs new file mode 120000 index 000000000..929510c73 --- /dev/null +++ b/crossbeam-epoch/build-common.rs @@ -0,0 +1 @@ +../build-common.rs \ No newline at end of file diff --git a/crossbeam-epoch/build.rs b/crossbeam-epoch/build.rs index b3bd15a5a..978141aa5 100644 --- a/crossbeam-epoch/build.rs +++ b/crossbeam-epoch/build.rs @@ -15,10 +15,11 @@ use std::env; include!("no_atomic.rs"); +include!("build-common.rs"); fn main() { let target = match env::var("TARGET") { - Ok(target) => target, + Ok(target) => convert_custom_linux_target(target), Err(e) => { println!( "cargo:warning={}: unable to get TARGET environment variable: {}", diff --git a/crossbeam-queue/build-common.rs b/crossbeam-queue/build-common.rs new file mode 120000 index 000000000..929510c73 --- /dev/null +++ b/crossbeam-queue/build-common.rs @@ -0,0 +1 @@ +../build-common.rs \ No newline at end of file diff --git a/crossbeam-queue/build.rs b/crossbeam-queue/build.rs index d0eb3f313..6975dd8c2 100644 --- a/crossbeam-queue/build.rs +++ b/crossbeam-queue/build.rs @@ -15,10 +15,11 @@ use std::env; include!("no_atomic.rs"); +include!("build-common.rs"); fn main() { let target = match env::var("TARGET") { - Ok(target) => target, + Ok(target) => convert_custom_linux_target(target), Err(e) => { println!( "cargo:warning={}: unable to get TARGET environment variable: {}", diff --git a/crossbeam-skiplist/build-common.rs b/crossbeam-skiplist/build-common.rs new file mode 120000 index 000000000..929510c73 --- /dev/null +++ b/crossbeam-skiplist/build-common.rs @@ -0,0 +1 @@ +../build-common.rs \ No newline at end of file diff --git a/crossbeam-skiplist/build.rs b/crossbeam-skiplist/build.rs index d0eb3f313..6975dd8c2 100644 --- a/crossbeam-skiplist/build.rs +++ b/crossbeam-skiplist/build.rs @@ -15,10 +15,11 @@ use std::env; include!("no_atomic.rs"); +include!("build-common.rs"); fn main() { let target = match env::var("TARGET") { - Ok(target) => target, + Ok(target) => convert_custom_linux_target(target), Err(e) => { println!( "cargo:warning={}: unable to get TARGET environment variable: {}", diff --git a/crossbeam-utils/build-common.rs b/crossbeam-utils/build-common.rs new file mode 120000 index 000000000..929510c73 --- /dev/null +++ b/crossbeam-utils/build-common.rs @@ -0,0 +1 @@ +../build-common.rs \ No newline at end of file diff --git a/crossbeam-utils/build.rs b/crossbeam-utils/build.rs index dd6604792..617162fb5 100644 --- a/crossbeam-utils/build.rs +++ b/crossbeam-utils/build.rs @@ -27,10 +27,11 @@ use std::env; include!("no_atomic.rs"); +include!("build-common.rs"); fn main() { let target = match env::var("TARGET") { - Ok(target) => target, + Ok(target) => convert_custom_linux_target(target), Err(e) => { println!( "cargo:warning={}: unable to get TARGET environment variable: {}", From ac18a14c198a7524d460afce9bae3a1fa817cc79 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 16 Nov 2022 16:10:04 -0500 Subject: [PATCH 2/2] crossbeam-epoch: Bump memoffset to 0.7 --- crossbeam-epoch/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crossbeam-epoch/Cargo.toml b/crossbeam-epoch/Cargo.toml index 0d7a8988d..fb5af2263 100644 --- a/crossbeam-epoch/Cargo.toml +++ b/crossbeam-epoch/Cargo.toml @@ -38,7 +38,7 @@ autocfg = "1" [dependencies] cfg-if = "1" -memoffset = "0.6" +memoffset = "0.7" scopeguard = { version = "1.1", default-features = false } # Enable the use of loom for concurrency testing.