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

Tests involving cdylib fail when cross-compiling to musl - not enough binary artifacts #58

Closed
Shnatsel opened this issue Aug 5, 2022 · 2 comments
Labels
tests An issue with the test infrastructure

Comments

@Shnatsel
Copy link
Member

Shnatsel commented Aug 5, 2022

Steps to reproduce:

rustup target add x86_64-unknown-linux-musl
AUDITABLE_TEST_TARGET=x86_64-unknown-linux-musl cargo test --all-features

The test test_cargo_auditable_workspaces fails:

---- test_cargo_auditable_workspaces stdout ----
Test fixture binary map: {"binary_and_cdylib_crate": ["/home/shnatsel/Code/cargo-auditable/cargo-auditable/tests/fixtures/workspace/target/x86_64-unknown-linux-musl/debug/binary_and_cdylib_crate"], "crate_with_features": ["/home/shnatsel/Code/cargo-auditable/cargo-auditable/tests/fixtures/workspace/target/x86_64-unknown-linux-musl/debug/crate_with_features_bin"]}
/home/shnatsel/Code/cargo-auditable/cargo-auditable/tests/fixtures/workspace/target/x86_64-unknown-linux-musl/debug/binary_and_cdylib_crate dependency info: VersionInfo { packages: [Package { name: "binary_and_cdylib_crate", version: Version { major: 0, minor: 1, patch: 0 }, source: "local", kind: Runtime, dependencies: [1], features: [] }, Package { name: "library_crate", version: Version { major: 0, minor: 1, patch: 0 }, source: "local", kind: Runtime, dependencies: [], features: [] }] }
thread 'test_cargo_auditable_workspaces' panicked at 'assertion failed: crate_with_features_bins.len() == 2', cargo-auditable/tests/it.rs:149:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@Shnatsel Shnatsel added help wanted Extra attention is needed tests An issue with the test infrastructure labels Aug 5, 2022
@tofay
Copy link
Contributor

tofay commented Aug 5, 2022

cdylib's aren't produced by default with musl targets - rust-lang/rust#59302. I think for now we should update the tests to not look for cdylibs on musl - I can do that this weekend.

@Shnatsel
Copy link
Member Author

Shnatsel commented Aug 5, 2022

Hmm, apparently RUSTFLAGS="-C target-feature=-crt-static" is needed to produce a cdylib. It's mentioned in the issue you linked, but rust-lang/cargo#8607 spells it out explicitly.

I'll go ahead and update the tests now that I understand what to change. Thanks!

@Shnatsel Shnatsel removed the help wanted Extra attention is needed label Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests An issue with the test infrastructure
Projects
None yet
Development

No branches or pull requests

2 participants