Commit 97231f9
[build] Add error for spaces in Android NDK path (#2092)
Add an error early in the preparation targets to let contributors know
that having spaces in the Android NDK path will cause an error later in
the build. For example, before this change, a build run under a user
named "Windows User" would hit the following error:
'C:\Users\Windows' is not recognized as an internal or external
command, operable program or batch file.
C:\source\xamarin-android\src\sqlite-xamarin\sqlite-xamarin.targets
(27,5): error MSB3073: The command "
"C:\Users\Windows User\android-toolchain\ndk\ndk-build.cmd"
SQLITE_SOURCE_DIR="C:\source\xamarin-android\external\sqlite"
APP_ABI="armeabi-v7a x86""
exited with code 1.
As a follow-up to the related conversation in
#2075, I tried a few
steps to resolve this issue. Unfortunately, it turns out that the
limitation goes beyond the `ndk-build.cmd` batch files. Even if the
build skipped those .cmd files and called `make.exe` directly, it would
still fail because android-toolchain\ndk\build\core\build-local.mk and
the other related `make` include files *also* assume the NDK path
contains no spaces:
C:\Users\Windows User\android-toolchain\ndk\build\\..\build\core\
build-local.mk:48: User/android-toolchain/ndk/build//../build/core/
init.mk: No such file or directory
C:\Users\Windows User\android-toolchain\ndk\build\\..\build\core\
build-local.mk:199: /add-application.mk: No such file or directory
C:\Users\Windows User\android-toolchain\ndk\build\\..\build\core\
build-local.mk:213: /setup-imports.mk: No such file or directory
C:\Users\Windows User\android-toolchain\ndk\build\\..\build\core\
build-local.mk:213: /setup-imports.mk: No such file or directory
make: *** No rule to make target `/build-all.mk'. Stop.
In fact, if you try to work around this issue with the .mk files by
setting the working directory for `make.exe` to the NDK directory and
using a relative rather than absolute path for build-local.mk, then the
NDK outputs its own error explaining that spaces in the NDK path are not
allowed:
Android NDK: Your Android application project path contains spaces:
'C:/Users User/android-toolchain'
build\core\build-local.mk:158: *** Android NDK: Aborting. . Stop.
Android NDK: The Android NDK build cannot work here. Please move
your project to a different location.1 parent e972c08 commit 97231f9
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
0 commit comments