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

environment variable CFG_RELEASE_CHANNEL not defined #4230

Closed
Timmmm opened this issue Jun 3, 2020 · 6 comments
Closed

environment variable CFG_RELEASE_CHANNEL not defined #4230

Timmmm opened this issue Jun 3, 2020 · 6 comments

Comments

@Timmmm
Copy link
Contributor

Timmmm commented Jun 3, 2020

I'm trying to build the latest version on Mac with this command:

CARGO_NET_GIT_FETCH_WITH_CLI=true cargo +nightly install --force --branch master --git https://github.com/rust-lang/rustfmt.git

But it gives the following errors:

   Compiling rustc-ap-rustc_parse v659.0.0
error: environment variable `CFG_RELEASE_CHANNEL` not defined
   --> /Users/me/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/rustc-ap-rustc_attr-659.0.0/builtin.rs:655:27
    |
655 |             let channel = env!("CFG_RELEASE_CHANNEL");
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: environment variable `CFG_RELEASE` not defined
   --> /Users/me/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/rustc-ap-rustc_attr-659.0.0/builtin.rs:657:48
    |
657 |             let rustc_version = Version::parse(env!("CFG_RELEASE")).unwrap();
    |                                                ^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

Any ideas? I found it mentioned in #4174 but that seems to imply that it has been fixed. Am I missing something?

@Timmmm
Copy link
Contributor Author

Timmmm commented Jun 3, 2020

This comment suggests I need rustc version rustc 1.45.0-nightly (d79f1bd31 2020-05-17) but I have a later one:

✗ ~/.rustup/toolchains/nightly-x86_64-apple-darwin/bin/rustc --version
rustc 1.45.0-nightly (fe10f1a49 2020-06-02)

@calebcartwright
Copy link
Member

You're going to have to set the environment variables (CFG_RELEASE_CHANNEL and CFG_RELEASE) in order to build rustfmt from source due to recent upstream changes in the rustc tree.

We've updated the Contributing docs to call this out, though looks like we forgot to update the corresponding section in the readme
https://github.com/rust-lang/rustfmt/blob/master/Contributing.md#building-and-testing

@Timmmm
Copy link
Contributor Author

Timmmm commented Jun 4, 2020

Ah cool, I changed the command to this:

CFG_RELEASE_CHANNEL=nightly CFG_RELEASE=nightly CARGO_NET_GIT_FETCH_WITH_CLI=true cargo +nightly install --force --branch master --git https://github.com/rust-lang/rustfmt.git

And it compiled successfully! But then gives this error:

    Finished release [optimized] target(s) in 1m 47s
error: no binaries are available for install using the selected features

Any ideas?

@Timmmm
Copy link
Contributor Author

Timmmm commented Jun 4, 2020

Ah I see it doesn't build anything by default. This command works perfectly - might be worth adding to the Readme?

CFG_RELEASE_CHANNEL=nightly CFG_RELEASE=nightly CARGO_NET_GIT_FETCH_WITH_CLI=true cargo +nightly install --force --branch master --git https://github.com/rust-lang/rustfmt.git --features "rustfmt cargo-fmt"

@Timmmm Timmmm closed this as completed Jun 4, 2020
@ahl
Copy link
Contributor

ahl commented Jun 4, 2020

We've updated the Contributing docs to call this out, though looks like we forgot to update the corresponding section in the readme
https://github.com/rust-lang/rustfmt/blob/master/Contributing.md#building-and-testing

Should the main README.md be updated to refer to these docs? This is what it currently says:

## How to build and test

`cargo build` to build.

`cargo test --manifest-path rustfmt-core/Cargo.toml` to run all tests.

@calebcartwright
Copy link
Member

Yes. I'm going to update this (and a few other minor items) in the docs later today

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

3 participants