cargo-ndk: Workaround for `.cmd` quoting bug on Windows leads to `command line is too long` errors
With our builds at Embark we’re currently blocked from being able to cross compile with cargo ndk on windows due to this recent workaround leading to a new error:
The following warnings were emitted during compilation:
warning: The command line is too long.
warning: Error: Errored with code 1
warning: The command line is too long.
warning: Error: Errored with code 1
error: failed to run custom build command for `physx-sys v0.11.1`
This is particularly awkward for us because the recent PR to parse --release
arguments is currently also required for our build system so we can’t revert to an older version of cargo ndk
and patch our NDK as a workaround.
I’m wondering if we could:
- ~~revert https://github.com/bbqsrc/cargo-ndk/pull/101~~
- ~~revert https://github.com/bbqsrc/cargo-ndk/pull/99~~
directly patch the.cmd
files
The change needed in the .cmd
files to workaround the original quoting bug turns out to be quite simple:
We need to change the if "%1" == "-cc1"
to if "%~1" == "-cc1"
to avoid double quotes when checking for a “-cc1” argument.
cargo ndk
could potentially check the .cmd
wrappers for the workaround and warn you about it, or it could apply the workaround directly (maybe with an option).
This would remove the need to springboard clang invocations through cargo ndk
and juggling hard links etc.
I can look at cooking a PR for something like this if it sounds reasonable?
edit: please see the discussion below for ideas for a better solution, including PR #108
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 20 (13 by maintainers)
Commits related to this issue
- Use cargo-ndk as a RUSTC_WRAPPER to pass --target to Clang This is an alternative workaround for #92 that's similar to the solution used in ndk-build except that the `-Clink-arg rustflag` is injected... — committed to rib/cargo-ndk by rib a year ago
- Use cargo-ndk as a RUSTC_WRAPPER to pass --target to Clang This is an alternative workaround for #92 that's similar to the solution used in ndk-build except that the `-Clink-arg rustflag` is injected... — committed to rib/cargo-ndk by rib a year ago
- Use cargo-ndk as a _LINKER wrapper to pass --target to Clang This is an alternative workaround for #92 that's similar to the solution used in ndk-build except that the `--target=<triple><api-level>` ... — committed to rib/cargo-ndk by rib a year ago
- Use cargo-ndk as a _LINKER wrapper to pass --target to Clang This is an alternative workaround for #92 that's similar to the solution used in ndk-build except that the `--target=<triple><api-level>` ... — committed to bbqsrc/cargo-ndk by rib a year ago
Considering that trying to pass
--target
to clang without the wrappers ends up opening a really big can of worms once we realize we need to start parsing all of Cargo’s config files I think for now that the approach of patching the NDK would be my preferred solution in the short term, as in: https://github.com/bbqsrc/cargo-ndk/pull/105