Skip to content

Wrong handling of leading spaces in cargo build script arguments #3992

@gergondet-woven

Description

@gergondet-woven

When updating to rules_rust 0.70.0 we saw failures when building the ring crates (I don't think the crate is very relevant here) while using toolchains_arm_gnu

In the output of the failed compilation, we can see the following environment variable is set:

CFLAGS='-DNDEBUG -O2 -isystem${pwd}/ external/toolchains_arm_gnu++arm_toolchain+aarch64_none_linux_gnu_linux_x86_64/aarch64-none-linux-gnu/include/c++/13.2.1 [more include flags]' 

The problem here is the space that's inserted between ${pwd}/ and the remainder of the path

I believe this was introduced in #3832 which has been included for the first time in 0.70.0

We have fixed the issue in a local rules_rust patch which strips the argument before prefixing ${pwd}/ in cargo_build_script.bzl. I'm happy to open a PR with the changes if you think that's the right approach but as we're hitting a stream of national holidays here it will take a little time 😅

Thanks for the continuous work that goes into this repo!

Metadata

Metadata

Assignees

No one assigned

    Labels

    cargoneeds-triageThe ticket needs maintainer attention.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions