How to build android standalone toolchain in windows 7

醉酒当歌 提交于 2019-11-29 11:31:02
$ E:>Installed_SDKs/android-ndk-r9d/build/tools/make-standalone-toolchain.sh --platform=android-14 --arch=mips --system=windows-x86_64

generates /tmp/ndk-/mipsel-linux-android-4.6.tar.bz2 for me; now I can unpack this file to E:\Installed_SDKs\android-ndk-r8\build\tools\mytool and live happily ever after.

Short version:

replace expr -- with expr in file $NDK_HOME/build/tools/prebuilt-common.sh with text editor of your choice. Then run as documented.

Long version:

The syntax errors you see in the output coming from android ndk implementation of argument parser. People who wrote this script decided to use expr command with regular expressions to parse arguments instead of using echo $1 | grep .... It certainly looks much cleaner (even though echo-grep used in other script from ndk), but expr is not the most standart command. It has a set of arguments common to all implementations as detailed in POSIX specification and everything else could be implemented differently or not implemented at all.

If you look inside file $NDK_HOME/build/tools/prebuilt-common.sh at line 392 (could depend on NDK version) you code like this:

param=`expr -- "$1" : '^\([^\-].*\)$'`

Notice how arguments of expr are separated by --. This is not specified in POSIX specification of expr. It's not even mentioned in any Linux man. It just works because some host systems have expr command that recognizes -- as "stop parsing arguments". So this is clearly a case of using an undocumented functionality.

You seem to use Git-bash - version of bash that comes with mingw32-git an distributed by git-scm.org. This version does not support expr -- syntax to the whole argument parsing library breaks. In order to fix it - just replace all expr -- with expr in prebuilt-common.sh file. It will still throw some warnings at you, but the script should work.

When it comes to cross compilation of library which are written in C we require NDK. But Compiling such type of Library on windows is very difficult and sometimes stuck and its always frustrating. I advise you to try the compilation on Linux. It will definitely be compiled. Linux/Mac are the best platforms for cross compilation. I hope it should help

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!