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

Set empty RUSTFLAGS to ensure that no .cargo/config applies #51

Merged
merged 3 commits into from Apr 1, 2020

Conversation

phil-opp
Copy link
Member

@phil-opp phil-opp commented Apr 1, 2020

Without the RUSTFLAGS environment variable set, cargo looks at .cargo/config files in all parent directories. Such a file can contain a build.rustflags key that would then be applied to the bootloader build too. Since some rustflags can break the build (e.g. -C target-cpu=native), we should prevent that.

Creating a cargo/.config file with an empty build.rustflags key in the bootloader repository does not suffice for fixing this because cargo unifies arrays with the values defined in parent directories. So the only way to ensure that no rustflags are passed is to set the RUSTFLAGS environment variable to the empty string, exploiting the fact that it takes precedence over any build.rustflags key.

Fixes phil-opp/blog_os#770

Without the `RUSTFLAGS` environment variable set, cargo looks at `.cargo/config` files in all parent directories. Such a file can contain a `build.rustflags` key that would then be applied to the bootloader build too. Since some rustflags can break the build (e.g. `-C target-cpu=native`), we should prevent that.

Creating a `cargo/.config` file with an empty `build.rustflags` key in the bootloader repository does not suffice for fixing this because cargo unifies arrays with the values defined in parent directories. So the only way to ensure that no rustflags are passed is to set the RUSTFLAGS environment variable to the empty string, exploiting the fact that it takes precedence over any `build.rustflags` key.
phil-opp added 2 commits Apr 1, 2020
The 10.13 image was removed by Azure and no longer builds.
@phil-opp phil-opp merged commit d3b3905 into master Apr 1, 2020
8 checks passed
@bors bors bot deleted the fix-rustflags branch Apr 1, 2020
phil-opp added a commit that referenced this issue Apr 1, 2020
@phil-opp
Copy link
Member Author

phil-opp commented Apr 1, 2020

Released as version 0.7.9.

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

Successfully merging this pull request may close these issues.

1 participant