Open abbec opened 9 months ago
Do you have a Nix expression that can reproduce this?
Sure,
$ nix-shell -p pkgsCross.mingwW64.buildPackages.cargo pkgsCross.mingwW64.buildPackages.clippy --run "cargo init && cargo clippy --target x86_64-pc-windows-gnu"
Created binary (application) package
Checking rust-repro v0.1.0 (/var/tmp/rust-repro)
error[E0463]: can't find crate for `std`
|
= note: the `x86_64-pc-windows-gnu` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-pc-windows-gnu`
error: cannot find macro `println` in this scope
--> src/main.rs:2:5
|
2 | println!("Hello, world!");
| ^^^^^^^
error: requires `sized` lang_item
For more information about this error, try `rustc --explain E0463`.
error: could not compile `rust-repro` (bin "rust-repro") due to 3 previous errors
Note the path used in LD_LIBRARY_PATH which is also in the output from clippy-driver --print=sysroot:
do not be fooled by the name. With the cross compilation optimization rustc the $target- prefix can not be relied upon. You'd have to actually check the contents of that store path to be sure it does not contain the cross std library.
Note the path used in LD_LIBRARY_PATH which is also in the output from clippy-driver --print=sysroot:
do not be fooled by the name. With the cross compilation optimization rustc the $target- prefix can not be relied upon. You'd have to actually check the contents of that store path to be sure it does not contain the cross std library.
It does not though.
Fair. so we need a wrapper for clippy-driver that inserts the correct sysroot
Fair. so we need a wrapper for clippy-driver that inserts the correct sysroot
Did a hacky workaround that did just that, which seems to do the trick.
Describe the bug
Since #176694, clippy does not work because it uses the non-cross sysroot.
Steps To Reproduce
pkgsCross.mingwW64.buildPackages.cargo
to build a cratepkgsCross.mingwW64.buildPackages.clippy
on the same crateExpected behavior
Both 1) and 2) should find the rust std crate.
Additional context
Clippy fails with
Note the path used in
LD_LIBRARY_PATH
which is also in the output fromclippy-driver --print=sysroot
:This should be
Notify maintainers
@mehmooda @alyssais @SuperSandro2000 @Mindavi @yu-re-ka @basvandijk
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.