Comments (4)
I filed this bug:
Feel free to fix ;)
from crate2nix.
This is a fun one. This is the build output:
these derivations will be built:
/nix/store/9dccznnszigsnlyqdjcdqk4xyizz6wjx-rust_anyhow-1.0.23.drv
/nix/store/kggvrg6lmzjw41gxr9hbxb56dnqa6km2-rust_with_anyhow-0.1.0.drv
building '/nix/store/9dccznnszigsnlyqdjcdqk4xyizz6wjx-rust_anyhow-1.0.23.drv'...
unpacking sources
unpacking source archive /nix/store/43ca92c955jib0gpxvdfwswsd5ppzivw-anyhow-1.0.23.tar.gz
source root is anyhow-1.0.23.tar.gz
patching sources
configuring
Building build.rs (anyhow)
Running rustc --crate-name build_script_build build.rs --crate-type bin -C opt-level=3 -C codegen-units=8 --edition 2018 --cfg feature="default" --cfg feature="std" --out-dir target/build/anyhow --emit=dep-info,link -L dependency=target/buildDeps --cap-lints allow --color always
error[E0432]: unresolved import `std::backtrace`
--> /build/anyhow-1.0.23.tar.gz/target/build/anyhow.out/lib.rs:5:14
|
5 | use std::backtrace::{Backtrace, BacktraceStatus};
| ^^^^^^^^^ could not find `backtrace` in `std`
error[E0407]: method `backtrace` is not a member of trait `Error`
--> /build/anyhow-1.0.23.tar.gz/target/build/anyhow.out/lib.rs:19:9
|
19 | / fn backtrace(&self) -> Option<&Backtrace> {
20 | | let backtrace = Backtrace::capture();
21 | | match backtrace.status() {
22 | | BacktraceStatus::Captured | BacktraceStatus::Disabled | _ => {}
23 | | }
24 | | unimplemented!()
25 | | }
| |_________^ not a member of trait `Error`
error[E0554]: #![feature] may not be used on the stable release channel
--> /build/anyhow-1.0.23.tar.gz/target/build/anyhow.out/lib.rs:2:5
|
2 | #![feature(backtrace)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0407, E0432, E0554.
For more information about an error, try `rustc --explain E0407`.
The build detection actually works well and fails.
building
Building src/lib.rs (anyhow)
Running rustc --crate-name anyhow src/lib.rs --crate-type lib -C opt-level=3 -C codegen-units=8 --edition 2018 -C metadata=5e47fda77d -C extra-filename=-5e47fda77d --cfg feature="default" --cfg feature="std" --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --cap-lints allow -L /build/anyhow-1.0.23.tar.gz/target/build/anyhow.out --color always
error[E0432]: unresolved import `std::backtrace`
--> src/lib.rs:5:14
|
5 | use std::backtrace::{Backtrace, BacktraceStatus};
| ^^^^^^^^^ could not find `backtrace` in `std`
error[E0407]: method `backtrace` is not a member of trait `Error`
--> src/lib.rs:19:9
|
19 | / fn backtrace(&self) -> Option<&Backtrace> {
20 | | let backtrace = Backtrace::capture();
21 | | match backtrace.status() {
22 | | BacktraceStatus::Captured | BacktraceStatus::Disabled | _ => {}
23 | | }
24 | | unimplemented!()
25 | | }
| |_________^ not a member of trait `Error`
error[E0554]: #![feature] may not be used on the stable release channel
--> src/lib.rs:2:5
|
2 | #![feature(backtrace)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0407, E0432, E0554.
For more information about an error, try `rustc --explain E0407`.
builder for '/nix/store/9dccznnszigsnlyqdjcdqk4xyizz6wjx-rust_anyhow-1.0.23.drv' failed with exit code 1
cannot build derivation '/nix/store/kggvrg6lmzjw41gxr9hbxb56dnqa6km2-rust_with_anyhow-0.1.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/kggvrg6lmzjw41gxr9hbxb56dnqa6km2-rust_with_anyhow-0.1.0.drv' failed
This is actually NOT line 2 of the lib.rs of anyhow.
https://github.com/dtolnay/anyhow/blob/1.0.23/src/lib.rs#L2
So why does the ultimate build fail?
Well, the output files of the build script are copied over the existing sources. So the rustc compiles the lib.rs from the build check:
Why does this code exist? I have no clue. Did an older version of cargo do the same?
from crate2nix.
Also created a quickfix: dtolnay/anyhow#49
from crate2nix.
NixOS/nixpkgs#74071 was fixed by @andir!
from crate2nix.
Related Issues (20)
- Support for build kinds (examples, benches, etc.)
- Building a GTK application fails without an error message HOT 2
- feature request: be able to override sourceFilter
- Use crate2nix generate for third-party projects HOT 7
- `CARGO_MANIFEST_LINKS` environment variable missing in build environment HOT 1
- Specify the toolchain used to build the main project HOT 6
- Panic when running `crate2nix generate` HOT 6
- crate2nix stumbles over arbitrary #[cfg] conditionals HOT 4
- error inheriting `version` from workspace root manifest's `workspace.package.version` HOT 1
- Set custom environment variables in `packages` and `devShells` HOT 1
- rustc 1.73 breaks crate2nix cross compilation HOT 5
- Cargo.nix includes references to ./crate2nix-sources with cargo workspaces HOT 1
- nixpkgs update breaks empty_cross test due to missing `rust` arguement HOT 7
- rstests adds a stray "/sources" to all globbed #[files] HOT 1
- Support path to Cargo.toml/Cargo.lock in fetched sources
- Tarball issue when building or trying to use template. HOT 1
- Error with dep that has a local dep
- Some sort of support for .cargo/config.toml ? HOT 1
- Overriding `crateConfig` for generated `Cargo.nix`
- Crate hash loading from Cargo.lock is broken in Rust 1.77
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 crate2nix.