Bug 14904

Summary: Make rust target identification better in crossbeam
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Randy MacLeod <randy.macleod>
Component: devtools / tool chainAssignee: Randy MacLeod <randy.macleod>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher
Version: 4.1   
Target Milestone: 4.2 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Randy MacLeod 2022-08-25 19:10:03 UTC
The full title is:
   Make rust target identification better in crossbeam and Rust generally


As discussed on the oe-core email list:
   https://lore.kernel.org/openembedded-core/20220825104851.3258387-1-richard.purdie@linuxfoundation.org/T/#t

"The upstreamable version of the patch would probably be something which
splits the target names in no_atomics up into components and matched on
subsections of it rather than the whole string."

Likely change the 'unknown' section seen in:
    https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-utils
to match anything in when used in:
   https://github.com/crossbeam-rs/crossbeam/blob/master/crossbeam-utils/build.rs#L47
   

In this case, I'll start with opening an issue or better still sending a PR to:
   https://github.com/crossbeam-rs/crossbeam/
Comment 1 Randy MacLeod 2022-10-27 14:02:59 UTC
Use Rust globing to wildcard the vendor part of the triplet.
Comment 2 Randy MacLeod 2022-12-22 17:37:46 UTC
Alex K sent a patch and it has been merged upstream:

https://github.com/crossbeam-rs/crossbeam/pull/922

but that's still not integrated as of rust-1.66:
$ rg Ok.*target tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/vendor/crossbeam*
tmp/work/core2-64-poky-linux/rust/1.66.0-r0/rustc-1.66.0-src/vendor/crossbeam-utils/build.rs
33:        Ok(target) => target,
...


$ cd ../crossbeam.git
$ git log --oneline -1 e78e511e
e78e511 When building for linux, replace all vendors with 'unknown'

$ git tag --contains e78e511e
crossbeam-skiplist-0.1.0

$ git branch -a --contains e78e511e
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/cross
  remotes/origin/epoch-fix-sb-violations
  remotes/origin/master
  remotes/origin/skiplist-reexport
  remotes/origin/staging
  remotes/origin/taiki-e/scoped-thread2
Comment 3 Randy MacLeod 2023-02-07 19:51:56 UTC
This was fixed upstream by adding the function convert_custom_linux_target()
and is part of rust-1.67 or ealier:

$ rg convert_custom_linux_target tmp/work/core2-64-poky-linux/rust/1.67.0-r0/rustc-1.67.0-src/
tmp/work/core2-64-poky-linux/rust/1.67.0-r0/rustc-1.67.0-src/vendor/crossbeam-utils/build-common.rs
6:fn convert_custom_linux_target(target: String) -> String {

tmp/work/core2-64-poky-linux/rust/1.67.0-r0/rustc-1.67.0-src/vendor/crossbeam-utils/build.rs
34:        Ok(target) => convert_custom_linux_target(target),

tmp/work/core2-64-poky-linux/rust/1.67.0-r0/rustc-1.67.0-src/vendor/crossbeam-epoch/build-common.rs
6:fn convert_custom_linux_target(target: String) -> String {

tmp/work/core2-64-poky-linux/rust/1.67.0-r0/rustc-1.67.0-src/vendor/crossbeam-epoch/build.rs
22:        Ok(target) => convert_custom_linux_target(target),