Repository: sonos/dinghy (language: rust)

Issue:
WathOS CI broken
Hey @simlay, would you have an idea about what's wrong in there ? It looks like cargo tries to test proc-macros tests, which obviously wont work on a X-platform settings...

https://github.com/sonos/dinghy/actions/runs/11321297897


Discussion / hints:
looks like this started with the nightly from october 5th, so probably something in there https://github.com/rust-lang/rust/commits/master/?since=2024-10-03&until=2024-10-05

there is this https://github.com/rust-lang/rust/commit/d0a467a89f513c1eaef5e99cb446c66dc37c2837
that bumps cargo with these new changes https://github.com/rust-lang/cargo/compare/80d82ca22abbee5fb7b51fa1abeb1ae34e99e88a...ad074abe3a18ce8444c06f962ceecfd056acfc73 maybe something in there causing problems ? the interesting thing is that we don't see this on the regular builds for witch we also du runs using nightly toolchains
Huh. This is definitely weird. With the `nightly-2024-10-05-aarch64-apple-darwin` toolchain, things work as expected but with `nightly-2024-10-06-aarch64-apple-darwin` it fails with `Library not loaded: @rpath/libstd-e61cddebfd02205d.dylib`. Digging more into it, it's definitely failing on [the "tests" (there is nothing in the src/lib.rs) of`test-proc-macro`](https://github.com/sonos/dinghy/tree/a7e23772c6c7e098f87813944863a48b2f3ca77d/test-ws/test-proc-macro) subcrate in the `test-ws`. I feel like there's a mild chance of https://github.com/rust-lang/rust/pull/131016 might be the issue. @madsmtm might have some thoughts.
Hmm, I doubt that https://github.com/rust-lang/rust/pull/131016 is the problem, like I noted there:
> the difference is only observable if you manually unarchive the `rlib` (and the format of that is explicitly unspecified).

I'll try to get a proper `rustc` bisection going later today.
Took a while, but I found the culprit, it is https://github.com/rust-lang/rust/pull/131188 - things work again if I copy the `libstd-*.dylib` file from `/lib/rustlib/aarch64-apple-darwin/lib/libstd-*.dylib` to `/lib/libstd-*.dylib` inside my toolchain installation (`~/.rustup/toolchains/*-aarch64-apple-darwin`).

I believe that PR is correct, and that Dinghy was wrong before to be relying on that file being available, though I'm not sure how to fix it?
It seems like Cargo is adding `$HOME/.rustup/toolchains/*-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib` to `DYLD_FALLBACK_LIBRARY_PATH` when running `cargo test` normally, but when using `-Zbuild-std` it for some reason isn't doing that.

The issue can be reproduced with just:
```console
cd test-ws
cargo +nightly-2024-10-10 test -ptest-proc-macro --lib -Zbuild-std --target=aarch64-apple-darwin
```
I've opened https://github.com/rust-lang/cargo/issues/14735, in the meantime I think the best thing that Dinghy can do is disable this test when using `-Zbuild-std`

Fix patch:
diff --git a/.travis.apple-third-tier.sh b/.travis.apple-third-tier.sh
index 6e05cf2..64cdcaa 100755
--- a/.travis.apple-third-tier.sh
+++ b/.travis.apple-third-tier.sh
@@ -25,14 +25,17 @@ tests_sequence_unstable_target() {
     # There's something odd with using the .cargo/config runner attribute and
     # workspaces when the runner uses `cargo run --manifest-path ../Cargo.toml
     # --bin cargo-dinghy ...`
+    # TODO 2024/11/18 adding explict `--workspace --exclude test-proc-macro` to the cargo commands here
+    # TODO as a workaround for https://github.com/rust-lang/cargo/issues/14735 this should be removed when the issue
+    # TODO is resolved
     title "testing from project directory for rust target $1 on device $2"
     title "testing from workspace directory"
     ( \
         cd test-ws \
         && cargo clean \
-        && $CARGO_DINGHY   -d $1 -p $2 +nightly test -Zbuild-std pass \
-        && ! $CARGO_DINGHY -d $1 -p $2 +nightly test -Zbuild-std fails \
-        && ! $CARGO_DINGHY -d $1 -p $2 +nightly test -Zbuild-std \
+        && $CARGO_DINGHY   -d $1 -p $2 +nightly test --workspace --exclude test-proc-macro -Zbuild-std pass \
+        && ! $CARGO_DINGHY -d $1 -p $2 +nightly test --workspace --exclude test-proc-macro -Zbuild-std fails \
+        && ! $CARGO_DINGHY -d $1 -p $2 +nightly test --workspace --exclude test-proc-macro -Zbuild-std \
     )
 
     title "testing from project directory"


Test patch: