Comments (7)
For indexmap
in particular, it also has a cargo feature "std"
that bypasses the autocfg
check. If you add that dependency to your project with the feature enabled, cargo will unify features with the rest of your dependency tree.
But autocfg
is just running rustc
, and the expectation is that std
should be found in the sysroot. What does NixOS do differently there? If you manually run rustc
on a simple fn main() {}
, does that find std
?
from autocfg.
For
indexmap
in particular, it also has a cargo feature"std"
that bypasses theautocfg
check. If you add that dependency to your project with the feature enabled, cargo will unify features with the rest of your dependency tree.
That's a fix but not an solution.
But
autocfg
is just runningrustc
, and the expectation is thatstd
should be found in the sysroot. What does NixOS do differently there? If you manually runrustc
on a simplefn main() {}
, does that findstd
?
Yes I can compile using lain rustc just fine.
from autocfg.
Is there a wrapper or something that sets the sysroot or library search path? I'm not sure what's missing here...
from autocfg.
Seems to be my dev environment, with an shell(nix shell nixpkgs#cargo nixpkgs#rustc
) just containing cargo & rustc everything works as expected.
Could you point out the env variables I would have to check to get my dev environment
working once again? My sysroot looks fine in my eyes:
rustc --print sysroot
/nix/store/l49zzww7wl3qxnvx61jbcb5kwpcp31ln-rust-nightly-complete-2023-02-06
tree /nix/store/l49zzww7wl3qxnvx61jbcb5kwpcp31ln-rust-nightly-complete-2023-02-06 -L 2
/nix/store/l49zzww7wl3qxnvx61jbcb5kwpcp31ln-rust-nightly-complete-2023-02-06
├── bin
│ ├── cargo
│ ├── cargo-clippy
│ ├── cargo-fmt
│ ├── cargo-miri
│ ├── clippy-driver
│ ├── miri
│ ├── rls
│ ├── rust-analyzer
│ ├── rustc
│ ├── rustdoc
│ ├── rustfmt
│ ├── rust-gdb
│ ├── rust-gdbgui
│ └── rust-lldb
├── etc
│ └── bash_completion.d
├── lib
│ ├── libLLVM-15-rust-1.69.0-nightly.so -> /nix/store/hd29v2rlzvhi1snx0178475s0ffb2x9j-rustc-nightly-complete-2023-02-06/lib/libLLVM-15-rust-1.69.0-nightly.so
│ ├── librustc_driver-0d5965989a9dd9e8.so
│ ├── libstd-6e3768d17ed5c91f.so -> /nix/store/hd29v2rlzvhi1snx0178475s0ffb2x9j-rustc-nightly-complete-2023-02-06/lib/libstd-6e3768d17ed5c91f.so
│ ├── libtest-5df56ae6cfa4ea18.so -> /nix/store/hd29v2rlzvhi1snx0178475s0ffb2x9j-rustc-nightly-complete-2023-02-06/lib/libtest-5df56ae6cfa4ea18.so
│ └── rustlib
├── libexec
│ ├── cargo-credential-1password -> /nix/store/jpwjibja78sy7wq99l232ynm34hxka11-cargo-nightly-complete-2023-02-06/libexec/cargo-credential-1password
│ └── rust-analyzer-proc-macro-srv -> /nix/store/hd29v2rlzvhi1snx0178475s0ffb2x9j-rustc-nightly-complete-2023-02-06/libexec/rust-analyzer-proc-macro-srv
└── share
├── doc
├── man
└── zsh
echo $RUST_SRC_PATH
/nix/store/l49zzww7wl3qxnvx61jbcb5kwpcp31ln-rust-nightly-complete-2023-02-06/lib/rustlib
# running autocfg tests
cargo test
Finished test [unoptimized + debuginfo] target(s) in 0.01s
Running unittests src/lib.rs (target/debug/deps/autocfg-7098375cc8c07875)
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
error: aborting due to previous error
error: aborting due to previous error
error: aborting due to previous error
error[E0463]: can't find crate for `std`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.For more information about this error, try `rustc --explain E0463`.
For more information about this error, try `rustc --explain E0463`.
For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`
error: aborting due to previous error
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `core`
error[E0463]: can't find crate for `core`
error[E0463]: can't find crate for `core`
error[E0463]: can't find crate for `core`
error[E0463]: can't find crate for `core`
error[E0463]: can't find crate for `core`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `core`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `core`
error[E0463]: can't find crate for `core`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `core`
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0463`.
For more information about this error, try `rustc --explain E0463`.
For more information about this error, try `rustc --explain E0463`.error[E0463]: can't find crate for `compiler_builtins`
For more information about this error, try `rustc --explain E0463`.For more information about this error, try `rustc --explain E0463`.For more information about this error, try `rustc --explain E0463`.
For more information about this error, try `rustc --explain E0463`.
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0463`.For more information about this error, try `rustc --explain E0463`.
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `core`
error[E0463]: can't find crate for `compiler_builtins`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0463`.
warning: autocfg could not probe for `std`
warning: autocfg could not probe for `std`
warning: autocfg could not probe for `std`
warning: autocfg could not probe for `std`
warning: autocfg could not probe for `std`
warning: autocfg could not probe for `std`
warning: autocfg could not probe for `std`
warning: autocfg could not probe for `std`
warning: autocfg could not probe for `std`
warning: autocfg could not probe for `std`
warning: autocfg could not probe for `std`
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `doesnt_exist`
--> <anon>:1:1
|
1 | extern crate doesnt_exist as probe;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
--> <anon>:1:1
|
1 | extern crate std as probe;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
error: aborting due to previous error
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.For more information about this error, try `rustc --explain E0463`.
error: requires `sized` lang_item
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
error: aborting due to 2 previous errors
error: aborting due to 2 previous errors
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
For more information about this error, try `rustc --explain E0463`.
For more information about this error, try `rustc --explain E0463`.
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error
error[E0463]: can't find crate for `std`
For more information about this error, try `rustc --explain E0463`.
error: requires `sized` lang_item
error[E0463]: can't find crate for `alloc`
--> <anon>:1:1
|
1 | extern crate alloc as probe;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0463`.
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0463`.
error: test failed, to rerun pass `--lib`
unsetting RUST_SRC_PATH doesn't change anything though.
from autocfg.
Did you truncate that tree
at rustlib
, or is that empty? The $sysroot/lib
is used at runtime, but for builds rustc
will look in $sysroot/lib/rustlib/$target/lib
by default.
As for environment, RUSTFLAGS
would be the most obvious, but that should be supported. RUST_WRAPPER
would be my next bet, and that is not supported yet -- #26, but I do have a local branch for that. Beyond that, I don't know, check for anything with RUST
or CARGO
in the name.
from autocfg.
rustc
will look in$sysroot/lib/rustlib/$target/lib
by default.
I just remembered there's a concise command to find this, rustc --print target-libdir
.
from autocfg.
If you use toolchains shipped by rust-overlay, this should be fixed with oxalica/rust-overlay#134.
from autocfg.
Related Issues (20)
- Is there some way to hide the rustc output? HOT 6
- Can I probe for const generics support? HOT 3
- autocfg does not work in the presence of -Z build-std HOT 8
- hanging on aarch64 HOT 3
- error: could not compile `autocfg` HOT 4
- Backport CARGO_ENCODED_RUSTFLAGS to version 0.1 HOT 2
- Consider adding `--cap-lints=warn` to probe `rustc` invocations
- 'probe' does not work under Miri HOT 3
- Not compiling in Docker image running on M1 Mac using `--platform linux/amd64` HOT 3
- Build errors on riscv64-linux HOT 2
- Program unexpected panic when unwrap is used HOT 1
- Test for specific named feature in std? HOT 2
- autocfg still calls rustc without the wrapper HOT 13
- Test if a dependency contains a path or symbol HOT 2
- Racy failures in `test_wrappers`
- Add support for `--check-cfg` [Rust 1.80]
- test suite unreliable since v1.2.0 HOT 3
- Add a check for supporting `extern "x"` values
- Add a method to control the `--edition`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autocfg.