cargo-contract icon indicating copy to clipboard operation
cargo-contract copied to clipboard

Build ignores RUSTFLAGS

Open athei opened this issue 4 years ago • 3 comments

cargo contract build ignores flags passed in through the RUSTFLAGS environment variable. Variables passed in through the cargo config are also ignored. The reason is likely that they are overridden here: https://github.com/paritytech/cargo-contract/blob/f8f048fbace9c10bb414fb4da0df91df772a12d8/src/cmd/build.rs#L57-L61

They should be merged with the pre-existing options where pre-existing options take precedence in case of conflicts.

Likely a similar change is necessary for metadata generation.

athei avatar Nov 04 '20 11:11 athei

can we close this issue now that this PR has been merged that uses CARGO_ENCODED_RUSTFLAGS instead of RUSTFLAGS in contract-build crate?

ltfschoen avatar May 29 '23 06:05 ltfschoen

I don't know if cargo merged those two or if one takes precedence in the presence of both. If the former is true we can close this.

athei avatar Jun 19 '23 15:06 athei

Indeed we would need to confirm which is true, the docs are not enlightening. Even if the former is true the issue will still exist for CARGO_ENCODED_RUSTFLAGS.

ascjones avatar Jun 19 '23 16:06 ascjones