I'm using cargo make to build the project. Part of my build process is to run cargo check and cargo clippy. However, when running cargo check, Rust complains that the OUT_DIR environment variable is not defined, which is needed for this source code:
include!(concat!(env!("OUT_DIR"), "/pciids.rs"));
This makes absolutely no sense to me, since the build script runs without any issues. Can somebody enlighten me as to why this is happening?
Okay, so I've solved the first problem but I'm now getting "can't find crate for std". This is despite the fact that any use of std is in my build script, only, and not anywhere else. I think Cargo is building my build script with no_std... I can't remember how to solve this but I know I've suffered this before. It only happens with my library target though, not my main binary target, at least from what I can see. I'm surprised this bug is still even a thing. Its choking on the log target, but in both Cargo.toml files, I have:
[dependencies.log]
default-features =false
version = "0.4.14"
Edit: I'm also building using a custom target profile, but Cargo still shouldn't be building any build scripts with that target profile but should be building them using the native one.
Regarding the OUT_DIR, know that —outside of cargo make-specific stuff— the env var is only present if you have a build.rs script. In your case, the libk/ crate does not seem to have one.
Regarding the std stuff, are you using resolver = "2"? There are bugs regarding the default "feature resolver" which make the features for build.rs scripts & procedural macros (and other target-specific deps and whatnot) to be unified all together, which the resolver = "2" solves.
Thanks, I had forgotten about that key. Adding that to both crates is now producing this weird compiler error with extprim that I didn't encounter before:
Compiling extprim v1.7.1
error[E0557]: feature has been removed
--> /home/ethin/.cargo/registry/src/github.com-1ecc6299db9ec823/extprim-1.7.1/src/lib.rs:58:81
|
58 | #![cfg_attr(extprim_channel="unstable", feature(llvm_asm, test, specialization, const_fn))]
| 8 caret characters feature has been removed
|
= note: split into finer-grained feature gates
Apparently, the syntex_syntax crate requires it. That crate, in turn, is needed by rustfmt. Is the "rustfmt" crate on crates.io the one that the rustfmt tool uses, or do I have to use another registry?
I don't believe rustfmt is published to crates.io any more because it uses rustc's internal APIs directly. So rustup distributes it alongside the version of rustc it is built for.