RalfJung/cargo-careful

Build failure on rust-sfml: possibly newer version of crate `core`

RalfJung opened this issue · 17 comments

via reddit: running cargo careful test on https://github.com/jeremyletang/rust-sfml seems to result in an error

error[E0460]: found possibly newer version of crate `core` which `link_cplusplus` depends on
--> /home/dew/projects/github/rust-sfml/src/lib.rs:50:1
|
50 | extern crate link_cplusplus;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: perhaps that crate needs to be recompiled?

I'm the person from Reddit, in case you want me to help test and whatnot.

Same issue here, also happy to help. cargo clean doesn't help either.

@simonsan is that for the same crate or a different one?

How does this even work, where does that link_cplusplus crate come from? That name is not mentioned anywhere else in the repository...

EDIT: ah, it is called link-cplusplus. D'oh.

I cannot reproduce the problem, here it works fine:

$ cargo +nightly careful test
Preparing a sysroot (target: x86_64-unknown-linux-gnu)... done
   Compiling libc v0.2.133
   Compiling cc v1.0.73
   Compiling autocfg v1.1.0
   Compiling cfg-if v1.0.0
   Compiling glu-sys v0.1.4
   Compiling ppv-lite86 v0.2.16
   Compiling once_cell v1.15.0
   Compiling widestring v1.0.2
   Compiling bitflags v1.3.2
   Compiling num-traits v0.2.15
   Compiling link-cplusplus v1.0.7
   Compiling sfml v0.18.1 (/home/r/src/rust/tmp/rust-sfml)
   Compiling getrandom v0.2.7
   Compiling rand_core v0.6.4
   Compiling rand_chacha v0.3.1
   Compiling rand v0.8.5
    Finished test [unoptimized + debuginfo] target(s) in 18.76s
     Running unittests src/lib.rs (target/debug/deps/sfml-065dd18b8757122a)

running 3 tests
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
sfml-065dd18b8757122a: ../../src/xcb_io.c:175: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
error: test failed, to rerun pass `--lib`

well the tests fail but they do that even without careful.

Which OS and target are you on? I tried this on x86_64-unknown-linux-gnu.

I'm also on x86_64-unknown-linux-gnu, using Arch Linux, and SFML 2.5.1.

The tests pass for me without careful.

Do you have a global target dir set up for cargo or anything like that?

I don't have a global target dir, no. But I do change the target directory to /tmp/whatever-project.
I'm gonna try it with default target dir, see if that makes a difference.

I'm having the same issue with the default target dir.

Here is a full build log:

$ cargo careful test
Preparing a careful sysroot (target: x86_64-unknown-linux-gnu)... done
   Compiling libc v0.2.126
   Compiling cc v1.0.73
   Compiling cfg-if v1.0.0
   Compiling autocfg v1.1.0
   Compiling glu-sys v0.1.4
   Compiling ppv-lite86 v0.2.16
   Compiling widestring v1.0.2
   Compiling once_cell v1.13.0
   Compiling bitflags v1.3.2
   Compiling num-traits v0.2.15
   Compiling link-cplusplus v1.0.6
   Compiling sfml v0.18.1 (/home/dew/projects/github/rust-sfml)
   Compiling getrandom v0.2.7
   Compiling rand_core v0.6.3
   Compiling rand_chacha v0.3.1
   Compiling rand v0.8.5
    Finished test [unoptimized + debuginfo] target(s) in 13.43s
     Running unittests src/lib.rs (target/debug/deps/sfml-0c89914feeb897b1)

running 3 tests
test window::clipboard::identity_test ... ok
test audio::capture::test_devices ... ok
test window::context::test_settings ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s

   Doc-tests sfml
error[E0460]: found possibly newer version of crate `core` which `link_cplusplus` depends on
  --> /home/dew/projects/github/rust-sfml/src/lib.rs:50:1
   |
50 | extern crate link_cplusplus;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: perhaps that crate needs to be recompiled?
   = note: the following crate versions were found:
           crate `core`: /fasthome/dew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-05898138a596088a.rlib
           crate `link_cplusplus`: /home/dew/projects/github/rust-sfml/target/debug/deps/liblink_cplusplus-22452e976b210b65.rlib

error[E0460]: found possibly newer version of crate `core` which `num_traits` depends on
 --> /home/dew/projects/github/rust-sfml/src/graphics/rect.rs:2:5
  |
2 | use num_traits::AsPrimitive;
  |     ^^^^^^^^^^
  |
  = note: perhaps that crate needs to be recompiled?
  = note: the following crate versions were found:
          crate `core`: /fasthome/dew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-05898138a596088a.rlib
          crate `num_traits`: /home/dew/projects/github/rust-sfml/target/debug/deps/libnum_traits-07b3e0818f14fa6e.rlib

error[E0460]: found possibly newer version of crate `std` which `widestring` depends on
 --> /home/dew/projects/github/rust-sfml/src/system/string.rs:1:5
  |
1 | use widestring::{U32CStr, U32CString};
  |     ^^^^^^^^^^
  |
  = note: perhaps that crate needs to be recompiled?
  = note: the following crate versions were found:
          crate `std`: /fasthome/dew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-3dd5f78c3b43746e.rlib
          crate `std`: /fasthome/dew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-3dd5f78c3b43746e.so
          crate `widestring`: /home/dew/projects/github/rust-sfml/target/debug/deps/libwidestring-c0c9eaaefc70620c.rlib

error[E0460]: found possibly newer version of crate `core` which `num_traits` depends on
 --> /home/dew/projects/github/rust-sfml/src/system/vector2.rs:1:5
  |
1 | use num_traits::{AsPrimitive, CheckedDiv};
  |     ^^^^^^^^^^
  |
  = note: perhaps that crate needs to be recompiled?
  = note: the following crate versions were found:
          crate `core`: /fasthome/dew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-05898138a596088a.rlib
          crate `num_traits`: /home/dew/projects/github/rust-sfml/target/debug/deps/libnum_traits-07b3e0818f14fa6e.rlib

error[E0460]: found possibly newer version of crate `core` which `num_traits` depends on
 --> /home/dew/projects/github/rust-sfml/src/system/vector3.rs:8:5
  |
8 | use num_traits::{AsPrimitive, CheckedDiv};
  |     ^^^^^^^^^^
  |
  = note: perhaps that crate needs to be recompiled?
  = note: the following crate versions were found:
          crate `core`: /fasthome/dew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-05898138a596088a.rlib
          crate `num_traits`: /home/dew/projects/github/rust-sfml/target/debug/deps/libnum_traits-07b3e0818f14fa6e.rlib

error[E0460]: found possibly newer version of crate `std` which `once_cell` depends on
 --> /home/dew/projects/github/rust-sfml/src/window/thread_safety.rs:1:5
  |
1 | use once_cell::sync::OnceCell;
  |     ^^^^^^^^^
  |
  = note: perhaps that crate needs to be recompiled?
  = note: the following crate versions were found:
          crate `std`: /fasthome/dew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-3dd5f78c3b43746e.rlib
          crate `std`: /fasthome/dew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-3dd5f78c3b43746e.so
          crate `once_cell`: /home/dew/projects/github/rust-sfml/target/debug/deps/libonce_cell-3548c506bfdf571b.rlib

error[E0432]: unresolved import `self::text_style::TextStyle`
  --> /home/dew/projects/github/rust-sfml/src/graphics/mod.rs:25:5
   |
25 |     text_style::TextStyle,
   |     ^^^^^^^^^^^^^^^^^^^^^ no `TextStyle` in `graphics::text_style`

error[E0432]: unresolved import `crate::window::Style`
  --> /home/dew/projects/github/rust-sfml/src/graphics/render_window.rs:10:69
   |
10 |     window::{thread_safety, ContextSettings, Cursor, Event, Handle, Style, VideoMode},
   |                                                                     ^^^^^
   |                                                                     |
   |                                                                     no `Style` in `window`
   |                                                                     help: a similar name exists in the module (notice the capitalization): `style`

error[E0432]: unresolved import `self::style::Style`
 --> /home/dew/projects/github/rust-sfml/src/window/mod.rs:9:5
  |
9 |     style::Style,
  |     ^^^^^^^^^^^^ no `Style` in `window::style`

error[E0460]: found possibly newer version of crate `core` which `bitflags` depends on
 --> /home/dew/projects/github/rust-sfml/src/graphics/text_style.rs:3:1
  |
3 | bitflags::bitflags! {
  | ^^^^^^^^
  |
  = note: perhaps that crate needs to be recompiled?
  = note: the following crate versions were found:
          crate `core`: /fasthome/dew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-05898138a596088a.rlib
          crate `bitflags`: /home/dew/projects/github/rust-sfml/target/debug/deps/libbitflags-05dfd5b5d1225bed.rlib

error: cannot determine resolution for the macro `bitflags::bitflags`
 --> /home/dew/projects/github/rust-sfml/src/graphics/text_style.rs:3:1
  |
3 | bitflags::bitflags! {
  | ^^^^^^^^^^^^^^^^^^
  |
  = note: import resolution is stuck, try simplifying macro imports

error[E0460]: found possibly newer version of crate `core` which `bitflags` depends on
 --> /home/dew/projects/github/rust-sfml/src/window/style.rs:3:1
  |
3 | bitflags::bitflags! {
  | ^^^^^^^^
  |
  = note: perhaps that crate needs to be recompiled?
  = note: the following crate versions were found:
          crate `core`: /fasthome/dew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-05898138a596088a.rlib
          crate `bitflags`: /home/dew/projects/github/rust-sfml/target/debug/deps/libbitflags-05dfd5b5d1225bed.rlib

error: cannot determine resolution for the macro `bitflags::bitflags`
 --> /home/dew/projects/github/rust-sfml/src/window/style.rs:3:1
  |
3 | bitflags::bitflags! {
  | ^^^^^^^^^^^^^^^^^^
  |
  = note: import resolution is stuck, try simplifying macro imports

error[E0460]: found possibly newer version of crate `std` which `widestring` depends on
   --> /home/dew/projects/github/rust-sfml/src/ffi/system.rs:108:20
    |
108 |         let ustr = widestring::U32Str::from_slice(data);
    |                    ^^^^^^^^^^
    |
    = note: perhaps that crate needs to be recompiled?
    = note: the following crate versions were found:
            crate `std`: /fasthome/dew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-3dd5f78c3b43746e.rlib
            crate `std`: /fasthome/dew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-3dd5f78c3b43746e.so
            crate `widestring`: /home/dew/projects/github/rust-sfml/target/debug/deps/libwidestring-c0c9eaaefc70620c.rlib

error[E0412]: cannot find type `TextStyle` in this scope
  --> /home/dew/projects/github/rust-sfml/src/graphics/text_style.rs:20:18
   |
20 | impl Default for TextStyle {
   |                  ^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `Style` in this scope
  --> /home/dew/projects/github/rust-sfml/src/window/style.rs:22:18
   |
22 | impl Default for Style {
   |                  ^^^^^ not found in this scope

error: aborting due to 16 previous errors

Some errors have detailed explanations: E0412, E0432.
For more information about an error, try `rustc --explain E0412`.
error: doctest failed, to rerun pass `--doc`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2021 --crate-type lib --crate-name sfml --test /home/dew/projects/github/rust-sfml/src/lib.rs -L dependency=/home/dew/projects/github/rust-sfml/target/debug/deps -L dependency=/home/dew/projects/github/rust-sfml/target/debug/deps -L native=/home/dew/projects/github/rust-sfml/target/debug/build/link-cplusplus-7517e535596e121b/out -L native=/home/dew/projects/github/rust-sfml/target/debug/build/sfml-fa73e5a9d4907e6f/out --extern bitflags=/home/dew/projects/github/rust-sfml/target/debug/deps/libbitflags-05dfd5b5d1225bed.rlib --extern glu_sys=/home/dew/projects/github/rust-sfml/target/debug/deps/libglu_sys-7847322de8846df3.rlib --extern link_cplusplus=/home/dew/projects/github/rust-sfml/target/debug/deps/liblink_cplusplus-22452e976b210b65.rlib --extern num_traits=/home/dew/projects/github/rust-sfml/target/debug/deps/libnum_traits-07b3e0818f14fa6e.rlib --extern once_cell=/home/dew/projects/github/rust-sfml/target/debug/deps/libonce_cell-3548c506bfdf571b.rlib --extern rand=/home/dew/projects/github/rust-sfml/target/debug/deps/librand-8b4fba53a659176d.rlib --extern sfml=/home/dew/projects/github/rust-sfml/target/debug/deps/libsfml-88425e9a4f89963f.rlib --extern widestring=/home/dew/projects/github/rust-sfml/target/debug/deps/libwidestring-c0c9eaaefc70620c.rlib -C embed-bitcode=no --cfg 'feature="audio"' --cfg 'feature="bitflags"' --cfg 'feature="default"' --cfg 'feature="graphics"' --cfg 'feature="once_cell"' --cfg 'feature="window"' --error-format human` (exit status: 1)

Looks like the problem might be with Doc-Tests, but you don't get to that point because your tests fail.

Do the tests pass with cargo careful test -- --test-threads 1?

You can also try cargo careful test --doc, to only run doc-tests.

Ah, it's a rustdoc issue. Makes sense, I never tested doc tests...

Could you try installing the latest git version? At least according to my test suite, that seems to fix the issue.

cargo install cargo-careful --git https://github.com/RalfJung/cargo-careful

Thank you, it does solve it!

@simonsan is that for the same crate or a different one?

Different one, but woke up this morning, and it was indeed related to the doc tests! Thank you! 🤗