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.rs: Migrate to CARGO_ENCODED_RUSTFLAGS #159

Merged
merged 1 commit into from Sep 16, 2021

Conversation

mkroening
Copy link
Member

@mkroening mkroening commented Sep 16, 2021

Fixes #158.

Cargo introduced CARGO_ENCODED_RUSTFLAGS in rust-lang/cargo#9601 to make setting flags less error prone – it encodes arguments separated by 0x1f (ASCII Unit Separator), instead of white spaces (old RUSTFLAGS).

CARGO_ENCODED_RUSTFLAGS are preferred over the old RUSTFLAGS in cargo. For build scripts, cargo converts its RUSTFLAGS to CARGO_ENCODED_RUSTFLAGS. For unset RUSTFLAGS it is set to an empty string. Thus our build script would call cargo for building libhermit-rs with a set – but empty – CARGO_ENCODED_RUSTFLAGS, which takes precedence over our prepared RUSTFLAGS. Specifically this caused our -Zmutable-noalias=no flag to be ignored, causing the same network issue as #128 again.

This PR adjusts our build script to make direct use of CARGO_ENCODED_RUSTFLAGS, the new and preferred way of handling flags in build scripts. This causes our flags to be correctly handled again.

Copy link
Contributor

@stlankes stlankes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@bors
Copy link
Contributor

bors bot commented Sep 16, 2021

@bors bors bot merged commit a1a3157 into hermit-os:master Sep 16, 2021
@mkroening mkroening deleted the cargo-encoded-rustflags branch September 16, 2021 21:39
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.

Network broke with toolchain upgrade
2 participants