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

feat: use CARGO_ENCODED_RUSTFLAGS instead of RUSTFLAGS #1124

Merged
merged 1 commit into from
May 22, 2023

Conversation

ashutoshvarma
Copy link
Contributor

Summary

Use CARGO_ENCODED_RUSTFLAGS instead of RUSTFLAGS in contract-build crate. This does not affect/break anything.

Why?

I wanted to use contract-build inside cargo build script for compiling ink! contract fixtures for testing, here is a example build script - https://github.com/AstarNetwork/Astar/blob/e148ddf271577b4e36662afe4b9ec820c235a384/tests/xcm-simulator/build.rs. But with the current use of RUSTFLAGS it's not possible.

Since with Rust 1.55.0, RUSTFLAGS is not set for build scripts - rust-lang/cargo#10111. On top of that when cross-compiling (in our case wasm32-unknown-unknown), cargo does not apply RUSTFLAGS for build scripts by design. That means RUSTFLAGS will totally be ignored in build script environment, that includes setting env from inside build script.

Solution

Simply use CARGO_ENCODED_RUSTFLAGS instead - rust-lang/cargo#10111 (comment)

@cla-bot-2021
Copy link

cla-bot-2021 bot commented May 22, 2023

User @ashutoshvarma, please sign the CLA here.

Copy link
Collaborator

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@ascjones ascjones merged commit b5db479 into use-ink:master May 22, 2023
10 checks passed
@ashutoshvarma ashutoshvarma deleted the feat/encoded-rust-flags branch May 22, 2023 09:17
This was referenced Jul 26, 2023
@smiasojed smiasojed mentioned this pull request Mar 4, 2024
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.

None yet

2 participants