Giter Club home page Giter Club logo

Comments (7)

cuviper avatar cuviper commented on June 12, 2024

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.

shimunn avatar shimunn commented on June 12, 2024

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.

That's a fix but not an solution.

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?

Yes I can compile using lain rustc just fine.

from autocfg.

cuviper avatar cuviper commented on June 12, 2024

Is there a wrapper or something that sets the sysroot or library search path? I'm not sure what's missing here...

from autocfg.

shimunn avatar shimunn commented on June 12, 2024

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.

cuviper avatar cuviper commented on June 12, 2024

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.

cuviper avatar cuviper commented on June 12, 2024

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.

zhaofengli avatar zhaofengli commented on June 12, 2024

If you use toolchains shipped by rust-overlay, this should be fixed with oxalica/rust-overlay#134.

from autocfg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.