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

ndk-build: Switch NDK r23 -lgcc workaround to CARGO_ENCODED_RUSTFLAGS env var for paths with spaces #298

Merged

Conversation

EmilioLaiso
Copy link
Contributor

@EmilioLaiso EmilioLaiso commented Jun 16, 2022

On Windows user paths usually include people's full name, with a space. If they have their Rust project somewhere in their user profile cargo fails to parse the workaround path:

process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -L '"C:\Users\Bla' 'Haj\Desktop\Breda\target\cargo-apk-temp-extra-link-libraries"' ... (exit code: 1)

As per the documentation for RUSTFLAGS its contents are split by a very simple .split(" ") algorithm without caring for quotation delimiters or escape characters. To retain backwards compatibility this has been implemented in a new environment variable named CARGO_ENCODED_RUSTFLAGS, which separates by ASCII Unit Separators (0x1f) instead.

@MarijnS95 MarijnS95 force-pushed the ndk-r23-workaround-support-spaces branch from b53978c to 453a525 Compare June 16, 2022 14:22
…AGS` env var for paths with spaces

On Windows user paths usually include people's full name, with a space.
If they have their Rust project somewhere in their user profile `cargo`
fails to parse the workaround path:

    process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -L '"C:\Users\Bla' 'Haj\Desktop\Breda\target\cargo-apk-temp-extra-link-libraries"' ... (exit code: 1)

As per the [documentation for `RUSTFLAGS`] its contents are split by a
very simple `.split(" ")` algorithm without caring for quotation
delimiters or escape characters. To retain backwards compatibility this
has been implemented in a new environment variable named
`CARGO_ENCODED_RUSTFLAGS`, which separates by ASCII Unit Separators
(`0x1f`) instead.

[documentation for `RUSTFLAGS`]: https://doc.rust-lang.org/cargo/reference/environment-variables.html
@MarijnS95 MarijnS95 force-pushed the ndk-r23-workaround-support-spaces branch from 453a525 to 9438a9d Compare June 16, 2022 14:22
Copy link
Member

@MarijnS95 MarijnS95 left a comment

Choose a reason for hiding this comment

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

Thanks!

@MarijnS95
Copy link
Member

I'll merge this after adding some space-testing in the CI and seeing it fail first :)

@MarijnS95
Copy link
Member

I'd need to make too many changes to the CI to test paths with spaces, not going to bother now. And have some other work built on top of this PR, merging it now :)

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.

2 participants