Use cargo-ndk as a RUSTC_WRAPPER to pass --target to Clang #107
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Okey, this is a another approach, inspired by what ndk-build does but avoiding touching
CARGO_ENCODED_RUSTFLAGS
, due to the huge can of worms that opensThis is an alternative workaround for #92 that's similar to the solution used in ndk-build except that the
-Clink-arg=
rustflag is injected via aRUSTC_WRAPPER
instead of trying to modifyCARGO_ENCODED_RUSTFLAGS
.It turned out to be practically impossible to be able to reliably set
CARGO_ENCODED_RUSTFLAGS
without risking trampling over rustflags that might be configured via Cargo (for exampletarget.<cfg>.rustflags
are especially difficult to read outside of cargo itself)This approach avoids hitting the command line length limitations of the current workaround and avoids needing temporary hard links or copying the cargo-ndk binary to the target/ directory.
Even though we've only seen quoting issues with the Windows
.cmd
wrappers this change to avoid using the wrapper scripts is being applied consistently for all platforms. E.g. considering the upstream recommendation to avoid the wrapper scripts if possible:https://android-review.googlesource.com/c/platform/ndk/+/2134712
Fixes: #92
Fixes: #104
Addresses: android/ndk#1856
--
With this approach we're again able to build our project at Embark which currently fails to compile due to the
command line is to long
errors mentioned in #104. This solution is also compatible with the way that we configure rustflags via.cargo/config.toml
.Compared to #105 it seems better to be side stepping the Clang wrappers entirely and then not needing to patch them.
Cc: @MarijnS95