Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildRustCrate fails to build rustversion 1.0.2 #78412

Closed
nagisa opened this issue Jan 24, 2020 · 1 comment · Fixed by #78706
Closed

buildRustCrate fails to build rustversion 1.0.2 #78412

nagisa opened this issue Jan 24, 2020 · 1 comment · Fixed by #78706
Labels
0.kind: bug Something is broken 6.topic: rust

Comments

@nagisa
Copy link
Contributor

nagisa commented Jan 24, 2020

Describe the bug

buildRustCrate will clobber the source directory of the rustversion crate and it will subsequently fail to build with an error like this:

builder for '/nix/store/qzmcgmdyl3vhsj3y5gzfc1miqjxmddxn-rust_rustversion-1.0.2.drv' failed with exit code 1; last 10 log lines:
  Building src/lib.rs (rustversion)
  Running rustc --crate-name rustversion src/lib.rs --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --cap-lints allow -C opt-level=3 -C codegen-units=16 --extern proc_macro2=/nix/store/p0aydc61mn5r4nw4l3c3zmpz1cv4dh4d-rust_proc-macro2-1.0.8-lib/lib/libproc_macro2-436ab8affb.rlib --extern quote=/nix/store/18vbqj8sj4dpnrr7dm19l2vaiail59y6-rust_quote-1.0.2-lib/lib/libquote-3ffc3269a3.rlib --extern syn=/nix/store/2mplqk67f8kfjnl1c2qnmy4md9sz2lf3-rust_syn-1.0.14-lib/lib/libsyn-121d03fbaa.rlib --cfg feature="default" --edition 2018 -C metadata=9fc8a6261b -C extra-filename=-9fc8a6261b --crate-type proc-macro -L /build/rustversion-1.0.2/target/build/rustversion.out --color always
  error: expected one of `!` or `::`, found `{`
   --> src/version.rs:1:9
    |
  1 | Version {
    |         ^ expected one of `!` or `::`

  error: aborting due to previous error

The reason this happens is because:

  1. rustversion's build script generates $OUT_DIR/version.rs;
  2. buildRustCrate copies it over the original src/version.rs.

To Reproduce
Steps to reproduce the behavior:

  1. crate2nix a crate dependent on rustversion (or maybe rustversion itself?)
  2. nix build

Expected behavior

The original source file should not be replaced. I don’t believe this copying code should exist at all.

cc @andir

@kolloch
Copy link
Contributor

kolloch commented Jan 26, 2020

This might be a duplicate of #74071

andir added a commit to andir/nixpkgs that referenced this issue Jan 28, 2020
`build.rs` files might create files. Those files are supposed to go into
`OUT_DIR` (envirionment variable) and not be overlayed onto the source
tree.
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this issue Jan 30, 2020
`build.rs` files might create files. Those files are supposed to go into
`OUT_DIR` (envirionment variable) and not be overlayed onto the source
tree.

(cherry picked from commit a57d0fe)
jpgu-epam pushed a commit to jpgu-epam/nixpkgs that referenced this issue Feb 4, 2020
`build.rs` files might create files. Those files are supposed to go into
`OUT_DIR` (envirionment variable) and not be overlayed onto the source
tree.
purcell pushed a commit to purcell/nixpkgs that referenced this issue Feb 13, 2020
`build.rs` files might create files. Those files are supposed to go into
`OUT_DIR` (envirionment variable) and not be overlayed onto the source
tree.

(cherry picked from commit a57d0fe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: rust
Projects
None yet
3 participants