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

cargo package with build script: "couldn't read build.rs: couldn't open file" #957

Closed
badboy opened this issue Nov 22, 2014 · 3 comments
Closed

Comments

@badboy
Copy link
Member

badboy commented Nov 22, 2014

I wanted to release a smal library that depends on an external library, that is bundled and compiled on build.
I took the build.rs template from the docu and it works fine building (and testing):

% cargo build --verbose  
   Compiling lzf v0.1.0 (file:///home/badboy/projects/lzf-rs)
     Running `rustc build.rs --crate-name build-script-build --crate-type bin -C prefer-dynamic -g --out-dir /home/badboy/projects/lzf-rs/target/build/lzf-fa9b537f6b98ac00 --dep-info /home/badboy/projects/lzf-rs/target/.fingerprint/lzf-fa9b537f6b98ac00/dep-bin-build-script-build -L /home/badboy/projects/lzf-rs/target -L /home/badboy/projects/lzf-rs/target/deps`
     Running `/home/badboy/projects/lzf-rs/target/build/lzf-fa9b537f6b98ac00/build-script-build`
     Running `rustc /home/badboy/projects/lzf-rs/src/lib.rs --crate-name lzf --crate-type lib -g -C metadata=fa9b537f6b98ac00 -C extra-filename=-fa9b537f6b98ac00 --out-dir /home/badboy/projects/lzf-rs/target --dep-info /home/badboy/projects/lzf-rs/target/.fingerprint/lzf-fa9b537f6b98ac00/dep-lib-lzf -L /home/badboy/projects/lzf-rs/target -L /home/badboy/projects/lzf-rs/target/deps -L /home/badboy/projects/lzf-rs/target/build/lzf-fa9b537f6b98ac00/out -l lzf:static`

But it fails as soon as I want to package everything:

% cargo package --verbose
   Packaging lzf v0.1.0 (file:///home/badboy/projects/lzf-rs)
   Archiving .gitignore
   Archiving .travis.yml
   Archiving Cargo.toml
   Archiving LICENSE
   Archiving README.md
   Archiving benches/bench_basic.rs
   Archiving lzf/Makefile
   Archiving lzf/lzf.h
   Archiving lzf/lzfP.h
   Archiving lzf/lzf_c.c
   Archiving lzf/lzf_d.c
   Verifying lzf v0.1.0 (file:///home/badboy/projects/lzf-rs)
   Compiling lzf v0.1.0 (file:///home/badboy/projects/lzf-rs)
     Running `rustc build.rs --crate-name build-script-build --crate-type bin -C prefer-dynamic -g --out-dir /home/badboy/projects/lzf-rs/target/build/lzf-fa9b537f6b98ac00 --dep-info /home/badboy/projects/lzf-rs/target/.fingerprint/lzf-fa9b537f6b98ac00/dep-bin-build-script-build -L /home/badboy/projects/lzf-rs/target -L /home/badboy/projects/lzf-rs/target/deps`
error: couldn't read build.rs: couldn't open file (no such file or directory (No such file or directory); path=build.rs; mode=open; access=read)
failed to verify package tarball

Caused by:
  Could not compile `lzf`.

Caused by:
  Process didn't exit successfully: `rustc build.rs --crate-name build-script-build --crate-type bin -C prefer-dynamic -g --out-dir /home/badboy/projects/lzf-rs/target/build/lzf-fa9b537f6b98ac00 --dep-info /home/badboy/projects/lzf-rs/target/.fingerprint/lzf-fa9b537f6b98ac00/dep-bin-build-script-build -L /home/badboy/projects/lzf-rs/target -L /home/badboy/projects/lzf-rs/target/deps` (status=101)

Bug or something I did wrong?

[~proj/lzf-rs (master*%)]% cargo --version
cargo 0.0.1-pre-nightly (b3ce593 2014-11-19 07:12:26 +0000)
[~proj/lzf-rs (master*%)]% rustc --version
rustc 0.13.0-nightly (770378a31 2014-11-20 23:02:01 +0000)
@badboy
Copy link
Member Author

badboy commented Nov 22, 2014

Ok, that's weird. I changed my build.rs to use the gcc crate now (instead of invoking make) and I now can't reproduce this, not even with the old build.rs

@badboy badboy closed this as completed Nov 22, 2014
@badboy
Copy link
Member Author

badboy commented Nov 22, 2014

Aaaah, cargo directly depends on what git tells it. I had a similar problem now and it vanishes as soon as I correctly git add all files.
Is this documented somewhere? If not, it should be.

@alexcrichton
Copy link
Member

I think this is actually a bug, covered in #797 though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants