Problem
dx serve --android fails before cargo runs:
Build failed: Failed to encode RUSTFLAGS
1: flag in rustflags must not contain its separator (' ')
Cause
The Android rustflags for clang_rt.builtins are built as a single string:
format!(
"-L{} -lstatic=clang_rt.builtins-{}-android",
clang_builtins_target.join("lib").join("linux").display(),
rt_builtins(&triple)
)
Fichier : packages/cli/src/build/android.rs
Fonction : BuildRequest::android_env_vars()
That string always contains a space (two flags concatenated). If the NDK path itself also has a space (Android SDK, username with space, etc.), cargo-config2 encode_space_separated rejects it.
Expected
Split into two flags and encode with CARGO_ENCODED_RUSTFLAGS (\x1f), which allows spaces in paths.
Reproduction
NDK path with a space
dx compilation error
$ dx serve android
...
[dev] Build failed: Failed to encode RUSTFLAGS
1: flag in rustflags must not contain its separator (' ')
Workaround
Symlink the SDK/NDK to a path without spaces (/opt/android/sdk).
Problem
dx serve --androidfails before cargo runs:Build failed: Failed to encode RUSTFLAGS
Cause
The Android rustflags for
clang_rt.builtinsare built as a single string:Fichier : packages/cli/src/build/android.rs
Fonction : BuildRequest::android_env_vars()
That string always contains a space (two flags concatenated). If the NDK path itself also has a space (Android SDK, username with space, etc.), cargo-config2 encode_space_separated rejects it.
Expected
Split into two flags and encode with CARGO_ENCODED_RUSTFLAGS (\x1f), which allows spaces in paths.
Reproduction
NDK path with a space
dx compilation error
$ dx serve android ... [dev] Build failed: Failed to encode RUSTFLAGS 1: flag in rustflags must not contain its separator (' ')Workaround
Symlink the SDK/NDK to a path without spaces (/opt/android/sdk).