Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please update crossbeam crates to fix compile for custom -vendor- rust targets #104866

Closed
stefson opened this issue Nov 25, 2022 · 5 comments · Fixed by #105617
Closed

please update crossbeam crates to fix compile for custom -vendor- rust targets #104866

stefson opened this issue Nov 25, 2022 · 5 comments · Fixed by #105617
Labels
C-bug Category: This is a bug.

Comments

@stefson
Copy link

stefson commented Nov 25, 2022

hello everyone,

some linux targets use a custom vendor in their rustc, and it so happens that the crossbeam crate missdetects the target. Here is an example from librsvg when using powerpc-gentoo-linux-musl:

[...]
     Running `rustc --crate-name crossbeam_utils --edition=2018 /var/tmp/portage/gnome-base/librsvg-2.55.1/work/cargo_home/gentoo/crossbeam-utils-0.8.11/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="once_cell"' --cfg 'feature="std"' -C metadata=650926ecf19e73c2 -C extra-filename=-650926ecf19e73c2 --out-dir /var/tmp/portage/gnome-base/librsvg-2.55.1/work/librsvg-2.55.1-.ppc/target/release/deps -L dependency=/var/tmp/portage/gnome-base/librsvg-2.55.1/work/librsvg-2.55.1-.ppc/target/release/deps --extern cfg_if=/var/tmp/portage/gnome-base/librsvg-2.55.1/work/librsvg-2.55.1-.ppc/target/release/deps/libcfg_if-8b0eed1ca9f18504.rmeta --extern once_cell=/var/tmp/portage/gnome-base/librsvg-2.55.1/work/librsvg-2.55.1-.ppc/target/release/deps/libonce_cell-5ba52b14be4f5b16.rmeta --cap-lints allow`
error[E0432]: unresolved imports `core::sync::atomic::AtomicI64`, `core::sync::atomic::AtomicU64`
  --> /var/tmp/portage/gnome-base/librsvg-2.55.1/work/cargo_home/gentoo/crossbeam-utils-0.8.11/src/lib.rs:79:49
   |
79 |             pub(crate) use core::sync::atomic::{AtomicI64, AtomicU64};
   |                                                 ^^^^^^^^^  ^^^^^^^^^ no `AtomicU64` in `sync::atomic`
   |                                                 |
   |                                                 no `AtomicI64` in `sync::atomic`
   |
help: a similar name exists in the module
   |
79 |             pub(crate) use core::sync::atomic::{AtomicI8, AtomicU64};
   |                                                 ~~~~~~~~
help: a similar name exists in the module
   |
79 |             pub(crate) use core::sync::atomic::{AtomicI64, AtomicU8};
   |                                                            ~~~~~~~~

error[E0412]: cannot find type `AtomicU64` in module `core::sync::atomic`
    --> /var/tmp/portage/gnome-base/librsvg-2.55.1/work/cargo_home/gentoo/crossbeam-utils-0.8.11/src/atomic/consume.rs:78:14
     |
78   |   impl_atomic!(AtomicU64, u64);
     |                ^^^^^^^^^ help: a struct with a similar name exists: `AtomicU16`

error[E0412]: cannot find type `AtomicI64` in module `core::sync::atomic`
    --> /var/tmp/portage/gnome-base/librsvg-2.55.1/work/cargo_home/gentoo/crossbeam-utils-0.8.11/src/atomic/consume.rs:80:14
     |
80   |   impl_atomic!(AtomicI64, i64);
     |                ^^^^^^^^^ help: a struct with a similar name exists: `AtomicI16`

Some errors have detailed explanations: E0412, E0432.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `crossbeam-utils` due to 3 previous errors

Caused by:
  process didn't exit successfully: `rustc --crate-name crossbeam_utils --edition=2018 /var/tmp/portage/gnome-base/librsvg-2.55.1/work/cargo_home/gentoo/crossbeam-utils-0.8.11/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="once_cell"' --cfg 'feature="std"' -C metadata=650926ecf19e73c2 -C extra-filename=-650926ecf19e73c2 --out-dir /var/tmp/portage/gnome-base/librsvg-2.55.1/work/librsvg-2.55.1-.ppc/target/release/deps -L dependency=/var/tmp/portage/gnome-base/librsvg-2.55.1/work/librsvg-2.55.1-.ppc/target/release/deps --extern cfg_if=/var/tmp/portage/gnome-base/librsvg-2.55.1/work/librsvg-2.55.1-.ppc/target/release/deps/libcfg_if-8b0eed1ca9f18504.rmeta --extern once_cell=/var/tmp/portage/gnome-base/librsvg-2.55.1/work/librsvg-2.55.1-.ppc/target/release/deps/libonce_cell-5ba52b14be4f5b16.rmeta --cap-lints allow` (exit status: 1)
make[2]: *** [Makefile:1554: librsvg_c_api.la] Error 101

there is a fix for the missdetection, which was merged in crossbeam-rs/crossbeam#922

that fix was backported to crossbeam-utils 0.8.13, crossbeam-queue 0.3.7, and crossbeam-epoch 0.9.12

can you please consider to update the rust vendored crates to a fixed state?

thank you

@stefson stefson added the C-bug Category: This is a bug. label Nov 25, 2022
@bjorn3
Copy link
Member

bjorn3 commented Dec 12, 2022

Those errors are while compiling librsvg, right? You will have to ask librsvg to update those dependencies. Rustc has nothing to do with this.

@stefson
Copy link
Author

stefson commented Dec 12, 2022

librsvg uses the same crate, and has the same bug which they fixed in their main branch by updating the crossbeam-utils crate to a fixed version.

rust definitely does vendor the crossbeam-utils crate in ../rustc-1.65.0-src/vendor/crossbeam-utils-0.8.8

I can ask the original reporter for a build log of rust bootstrapping? He has to use this patch:

diff --git a/vendor/crossbeam-utils/no_atomic.rs b/rustc-1.62.1-src-new/vendor/crossbeam-utils/no_atomic.rs
index 390019e..f7a5fe4 100644
--- a/vendor/crossbeam-utils/no_atomic.rs
+++ b/vendor/crossbeam-utils/no_atomic.rs
@@ -43,6 +43,7 @@ const NO_ATOMIC_64: &[&str] = &[
     "powerpc-unknown-linux-gnu",
     "powerpc-unknown-linux-gnuspe",
     "powerpc-unknown-linux-musl",
+    "powerpc-gentoo-linux-musl",
     "powerpc-unknown-netbsd",
     "powerpc-unknown-openbsd",
     "powerpc-wrs-vxworks",

@bjorn3
Copy link
Member

bjorn3 commented Dec 12, 2022

Right, rustc does use it. That version is only used when compiling rustc itself though. Librsvg will use the one vendored by librsvg. I can make a PR to update rustc, but I don't think that will fix building librsvg.

@stefson
Copy link
Author

stefson commented Dec 12, 2022

librsvg already fixed this in main branch.

Yes, the compile when bootstraping rustc does fail at the moment the crossbeam crate is made use of.

fixed versions are: crossbeam-utils 0.8.13, crossbeam-queue 0.3.7, and crossbeam-epoch 0.9.12

by the way, do you happen to know why there is also another folder of crossbeam-utils vendored, lacking any version number? ../rustc-1.65.0-src/vendor/crossbeam-utils

@bjorn3
Copy link
Member

bjorn3 commented Dec 12, 2022

It seems that cargo vendor only appends a version identifier when there are multiple versions of the same crate. In addition it seems to skip the version identifier for exactly 1 of the versions even if there are multiple versions. For example when I try cargo vendor in a crate that uses two versions of ahash I get:

   Vendoring ahash v0.7.6 (/home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.7.6) to vendor/ahash-0.7.6
   Vendoring ahash v0.8.2 (/home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.8.2) to vendor/ahash
[...]

@bors bors closed this as completed in ff016a5 Dec 18, 2022
RalfJung pushed a commit to RalfJung/miri that referenced this issue Dec 24, 2022
Update crossbeam

This fixes builds for Gentoo

This should fix rust-lang/rust#104866 (cc `@stefson)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants