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

Build fails with environment variable OUT_DIR not defined #33

Closed
pka opened this issue Mar 11, 2018 · 5 comments
Closed

Build fails with environment variable OUT_DIR not defined #33

pka opened this issue Mar 11, 2018 · 5 comments

Comments

@pka
Copy link

pka commented Mar 11, 2018

Release build fails for me with:

   Compiling mime_guess v2.0.0-alpha.4
error: environment variable `OUT_DIR` not defined
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/mime_guess-2.0.0-alpha.4/src/lib.rs:16:18
   |
16 | include!(concat!(env!("OUT_DIR"), "/mime_types_generated.rs"));
   |                  ^^^^^^^^^^^^^^^

error: couldn't read "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/mime_guess-2.0.0-alpha.4/src/0/mime_types_generated.rs": No such file or directory (os error 2)
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/mime_guess-2.0.0-alpha.4/src/lib.rs:16:1
   |
16 | include!(concat!(env!("OUT_DIR"), "/mime_types_generated.rs"));
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Build failed, waiting for other jobs to finish...
error: Could not compile `mime_guess`.

According to rust-lang/cargo#3368 replacing env!("OUT_DIR") with env::var("OUT_DIR") should solve the issue.

@pka pka changed the title Build fails environment variable OUT_DIR not defined Build fails with environment variable OUT_DIR not defined Mar 11, 2018
@abonander
Copy link
Owner

This invocation isn't in a build script, however. It's when building the main library.

@abonander
Copy link
Owner

@pka what is the output of cargo -V for you?

@pka
Copy link
Author

pka commented Mar 12, 2018

$ cargo -V
cargo 0.16.0-nightly (3568be9 2016-11-26)
$ rustc --version
rustc 1.26.0-nightly (e026b59cf 2018-03-03)

Versions from https://hub.docker.com/r/schickling/rust/

@abonander
Copy link
Owner

Wow, that Cargo version is crazy outdated! It's not picking up the implicit build script because it didn't look for them then. Why isn't the container using a version more appropriate to that release of Rust?

@pka
Copy link
Author

pka commented Mar 12, 2018

I made a PR to update the Docker container.
Thanks for investigating and sorry for the noise.

@pka pka closed this as completed Mar 12, 2018
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