-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Failed testing proc-macros built with -Zbuild-std
#14735
Labels
A-proc-macro
Area: compiling proc-macros
C-bug
Category: bug
S-triage
Status: This issue is waiting on initial triage.
Z-build-std
Nightly: build-std
Comments
madsmtm
added
C-bug
Category: bug
S-triage
Status: This issue is waiting on initial triage.
labels
Oct 27, 2024
This was referenced Oct 27, 2024
ehuss
added
Z-build-std
Nightly: build-std
A-proc-macro
Area: compiling proc-macros
labels
Oct 27, 2024
I can confirm that this also happens on linux, looks like it started with the 2024-10-06 nightly
|
fredszaq
added a commit
to sonos/dinghy
that referenced
this issue
Nov 18, 2024
this should fix #238 while we wait for a proper fix for rust-lang/cargo#14735
kali
pushed a commit
to sonos/dinghy
that referenced
this issue
Nov 18, 2024
this should fix #238 while we wait for a proper fix for rust-lang/cargo#14735
github-merge-queue bot
pushed a commit
that referenced
this issue
Nov 26, 2024
### What does this PR try to resolve? Fixes #14735 rust-lang/rust#131188 removes libstd.so from sysroot so `cargo test -Zbuild-std` no longer links to it. That results in a "Library not loaded: @rpath/libstd-[HASH].dylib" when testing a proc macro. This is a pretty niche use case, though it can be easily reproduced by running `cargo test -Zbuild-std` in any proc-macro package. Like in [serde-rs/serde](https://github.com/serde-rs/serde/tree/b9dbfcb4ac3b7a663d9efc6eb1387c62302a6fb4) running it would fail. This patch adds a special case that if it is `cargo run/test` against a proc-macro, fill in std dynamic library search path for it. ### How should we test and review this PR? ``` CARGO_RUN_BUILD_STD_TESTS=1 cargo +nightly t --test build-std test_proc_macro ``` or ``` git clone https://github.com/serde-rs/serde cd serde git switch -d b9dbfcb4ac3b7a663d9efc6eb1387c62302a6fb4 cargo +nightly t --test build-std ``` ### Additional information
fredszaq
added a commit
to sonos/dinghy
that referenced
this issue
Nov 26, 2024
This reverts commit 3244bc9. This can be reenabled as rust-lang/cargo#14735 was fixed via rust-lang/cargo#14850
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-proc-macro
Area: compiling proc-macros
C-bug
Category: bug
S-triage
Status: This issue is waiting on initial triage.
Z-build-std
Nightly: build-std
Problem
When testing proc-macros with
-Zbuild-std
, the binary under test fails to load the standard library (at least on macOS):Steps
Notes
This started happening since rust-lang/rust#131188, because now
$HOME/.rustup/toolchains/$TOOLCHAIN/lib
(which cargo is adding to theDYLD_FALLBACK_LIBRARY_PATH
/LD_LIBRARY_PATH
) no longer includeslibstd-*.dylib
, that is only present in$HOME/.rustup/toolchains/$TOOLCHAIN-$HOST/lib/rustlib/$HOST/lib
(which Cargo normally adds, but doesn't add when using-Zbuild-std
).This was found in sonos/dinghy#238.
Possible Solution(s)
Not sure, perhaps the code that sets
DYLD_FALLBACK_LIBRARY_PATH
/LD_LIBRARY_PATH
cargo/src/cargo/core/compiler/compilation.rs
Lines 293 to 339 in 80d82ca
Version
cargo 1.84.0-nightly (cf53cc5 2024-10-18)
release: 1.84.0-nightly
commit-hash: cf53cc5
commit-date: 2024-10-18
host: aarch64-apple-darwin
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.7.1 (sys:0.4.74+curl-8.9.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Mac OS 14.7.0 [64-bit]
The text was updated successfully, but these errors were encountered: