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

Dynamically linked library path resolution with cargo clif test --doc differs from cargo test --doc #1505

Closed
janhohenheim opened this issue Jul 4, 2024 · 3 comments

Comments

@janhohenheim
Copy link

In bevyengine/bevy#14129, we discovered an issue when running cargo test --doc on Windows when linking Bevy dynamically. See that issue for a reproducible minimal example.

In bevyengine/bevy-website#1522, I added a workaround to Bevy's documentation, namely:

In order to run cargo test --doc, you must also add the path returned by rustc --print target-libdir to your PATH environment variable.

This fixes this issue when running cargo test --doc, but cargo clif test --doc still results in a dynamic library resolution error:

Test executable failed (exit code: 0xc0000135).
@bjorn3
Copy link
Member

bjorn3 commented Jul 4, 2024

cargo-clif uses a separate sysroot. I think you can use rustc-clif --print target-libdir where rustc-clif is the executable right next to the cargo-clif you used for running tests.

@janhohenheim
Copy link
Author

janhohenheim commented Jul 4, 2024

I've added the output of that command to my PATH and tried running doc tests in a project I happened to have open. Good news: the path resolution works! Bad news: some tests fail with the following:

Test executable failed (exit code: 0xc000001d).

stderr:
thread 'main' panicked at D:\a\rustc_codegen_cranelift\rustc_codegen_cranelift\build\stdlib\library\std\src\sync\once.rs:217:20:
assertion failed: state_and_queue.addr() & STATE_MASK == RUNNING
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'll try seeing if this also happens on the linked minimal example.

@janhohenheim
Copy link
Author

I did not manage to get the exact error message, but another one. Opening a new issue since this one is resolved at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants