如何为Windows构建NDK LLVM工具链?

时间:2015-07-08 04:53:11

标签: android-ndk clang llvm

我正在尝试为Windows 64位构建NDK LLVM工具链。

我已经通过"download-toolchain-sources.sh"下载了源代码。

首先,我尝试在Windows-7-64bits操作系统上的cygwin64 bash中运行"build-llvm.sh"

我的命令是:

sh build-llvm.sh --verbose --build-out=/cygdrive/d/g//toolchain-llvm --platform=android-14 --try-64 -j4 /cygdrive/d/g/android-toolchain /cygdrive/p/android/android-ndk-r10e llvm-3.5

我有两个错误:

1

ERROR: Unsupported HOST_TAG: cygwin-x86_64

2

Makefile:152: D:/cygdrive/d/g/android-toolchain/llvm-3.5/llvm/Makefile.rules: No such file or directory
make: *** No rule to make target `D:/cygdrive/d/g/android-toolchain/llvm-3.5/llvm/Makefile.rules'.  Stop.

然后,我尝试在安装了mingw64的Ubuntu64上运行"build-llvm.sh"

我的命令是:

build-llvm.sh --verbose --build-out=~/toolchain-llvm-out --platform=android-14 --try-64 -j4 --mingw /media/sf_android-toolchain-src ~/android-ndk-r10e llvm-3.5

我收到以下错误:

Found mingw toolchain: /usr/bin/x86_64-w64-mingw32-gcc
WARNING: The shell running this script isn't bash.  Although we try to avoid bashism in scripts, things can happen.
WARNING: The shell running this script isn't bash.  Although we try to avoid bashism in scripts, things can happen.
WARNING: The shell running this script isn't bash.  Although we try to avoid bashism in scripts, things can happen.
WARNING: The shell running this script isn't bash.  Although we try to avoid bashism in scripts, things can happen.
WARNING: The shell running this script isn't bash.  Although we try to avoid bashism in scripts, things can happen.
Using mingw64 wrapper: /tmp/ndk-root/build/mingw64-wrapper/x86_64-pc-mingw32msvc-gcc
Using specific build directory: ~/toolchain-llvm-out
To follow build in another terminal, please use: tail -F /home/yifan/toolchain-llvm-out/config.log
Using source directory: /media/sf_android-toolchain-src
Using NDK directory: /home/yifan/android-ndk-r10e
Generating 64-bit Windows binaries
Using toolchain path: /home/yifan/android-ndk-r10e/toolchains/llvm-3.5/prebuilt/windows-x86_64
Using toolchain prefix: /home/yifan/android-ndk-r10e/toolchains/llvm-3.5/prebuilt/windows-x86_64/bin/
Configure: llvm-3.5 toolchain build
## COMMAND: cp -a /home/yifan/android-ndk-r10e/tests/abcc/jni/Abcc.cpp /media/sf_android-toolchain-src/llvm-3.5/llvm/tools/ndk-bc2native
## COMMAND: cp -a /home/yifan/android-ndk-r10e/tests/abcc/jni/Abcc.h /media/sf_android-toolchain-src/llvm-3.5/llvm/tools/ndk-bc2native
## COMMAND: cp -a /home/yifan/android-ndk-r10e/tests/abcc/jni/host/Abcc_host.cpp /home/yifan/android-ndk-r10e/tests/abcc/jni/host/main.cpp /media/sf_android-toolchain-src/llvm-3.5/llvm/tools/ndk-bc2native
## COMMAND: cp -a /home/yifan/android-ndk-r10e/tests/abcc/jni/host/Abcc_host.h /media/sf_android-toolchain-src/llvm-3.5/llvm/tools/ndk-bc2native
## COMMAND: cp -a /home/yifan/android-ndk-r10e/tests/abcc/jni/llvm_35.h /media/sf_android-toolchain-src/llvm-3.5/llvm/tools/ndk-bc2native/llvm_version.h
## COMMAND: cp -a /home/yifan/android-ndk-r10e/tests/abcc/jni/mman-win32/mman.c /home/yifan/android-ndk-r10e/tests/abcc/jni/mman-win32/mman.h /media/sf_android-toolchain-src/llvm-3.5/llvm/tools/ndk-bc2native
## COMMAND: /media/sf_android-toolchain-src/llvm-3.5/llvm/configure --prefix=/home/yifan/toolchain-llvm-out/prefix --host=x86_64-pc-mingw32msvc --build=x86_64-linux-gnu --with-bug-report-url=http://source.android.com/source/report-bugs.html --enable-targets=arm,mips,x86,aarch64 --enable-optimized --with-binutils-include=/media/sf_android-toolchain-src/binutils/binutils-2.25/include
checking for x86_64-pc-mingw32msvc-clang... no
checking for x86_64-pc-mingw32msvc-gcc... x86_64-pc-mingw32msvc-gcc
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables... .exe
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-pc-mingw32msvc-gcc accepts -g... yes
checking for x86_64-pc-mingw32msvc-gcc option to accept ISO C89... none needed
checking for x86_64-pc-mingw32msvc-clang++... no
checking for x86_64-pc-mingw32msvc-g++... x86_64-pc-mingw32msvc-g++
checking whether we are using the GNU C++ compiler... no
checking whether x86_64-pc-mingw32msvc-g++ accepts -g... no
checking how to run the C preprocessor... x86_64-pc-mingw32msvc-gcc -E
checking whether GCC or Clang is our host compiler... unknown
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-mingw32msvc
checking target system type... x86_64-pc-mingw32msvc
checking type of operating system we're going to host on... MingW
checking type of operating system we're going to target... MingW
checking target architecture... x86_64
checking for executable suffix on build platform... checking for x86_64-linux-gnu-gcc... x86_64-linux-gnu-gcc
configure: error: installation or configuration problem: compiler cannot create executables.
ERROR: Couldn't configure llvm toolchain

我读了toolchain-llvm-out / llvm中生成的config.log。 它说:

configure:4364: x86_64-linux-gnu-gcc -o conftest -O2 -I/toolchain-llvm-out/prefix/include -DDISABLE_FUTIMENS -L/toolchain-llvm-out/prefix/lib -static-libstdc++ -static-libgcc -static conftest.c  1>&5
/tmp/ndk-root/build/mingw64-wrapper/x86_64-linux-gnu-gcc: 3: /tmp/ndk-root/build/mingw64-wrapper/x86_64-linux-gnu-gcc: /android-ndk-r10e/../prebuilts/tools/gcc-sdk/gcc: not found
configure:4367: $? = 127
configure:4376: error: installation or configuration problem: compiler cannot create executables.

找不到"/android-ndk-r10e/../prebuilts/tools/gcc-sdk/gcc“。 它是什么?这个位置在NDK本身之外。 它应该在那里吗?

关于bash的警告也很奇怪,因为我确信它在bash中运行。

$ echo $SHELL
/bin/bash
$ echo $BASH_VERSION
4.2.25(1)-release

我希望我至少可以在Ubuntu上构建它。请帮忙。感谢。

0 个答案:

没有答案