我正在尝试编译boringssl库,以便可以在Android项目中使用它(在Ubuntu 18.04上构建)。我正在遵循此链接中的构建步骤。
amy@test-ubuntu18:~/android_test/boringssl/build$ cmake -DANDROID_ABI=arm64-v8a -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=21 -GNinja ..
CMake Error at CMakeLists.txt:14 (enable_language):
The CMAKE_C_COMPILER:
/home/amy/android_test/android-ndk-r21-beta2/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
is not a full path to an existing compiler tool.
这是我的环境设置:
amy@test-ubuntu18:~/android_test/boringssl/build$ echo $ANDROID_NDK
/home/amy/android_test/android-ndk-r21-beta2
amy@test-ubuntu18:~/android_test/boringssl/build$ echo $CC
/usr/bin/gcc
amy@test-ubuntu18:~/android_test/boringssl/build$ echo $CXX
/usr/bin/g++
这些工具确实存在于我的 /usr/bin 中
amy@test-ubuntu18:~/android_test/boringssl/build$ ls -l /usr/bin/*g{cc,++}*
-rwxr-xr-x 1 root root 428 May 7 2006 /usr/bin/c89-gcc
-rwxr-xr-x 1 root root 454 Apr 11 2011 /usr/bin/c99-gcc
lrwxrwxrwx 1 root root 27 May 16 2018 /usr/bin/clang++ -> ../lib/llvm-6.0/bin/clang++
lrwxrwxrwx 1 root root 27 Apr 5 2018 /usr/bin/clang++-6.0 -> ../lib/llvm-6.0/bin/clang++
lrwxrwxrwx 1 root root 25 Apr 10 2019 /usr/bin/clang++-8 -> ../lib/llvm-8/bin/clang++
lrwxrwxrwx 1 root root 5 May 20 2019 /usr/bin/g++ -> g++-7
lrwxrwxrwx 1 root root 22 May 8 2019 /usr/bin/g++-7 -> x86_64-linux-gnu-g++-7
lrwxrwxrwx 1 root root 5 May 20 2019 /usr/bin/gcc -> gcc-7
lrwxrwxrwx 1 root root 22 May 8 2019 /usr/bin/gcc-7 -> x86_64-linux-gnu-gcc-7
lrwxrwxrwx 1 root root 8 May 20 2019 /usr/bin/gcc-ar -> gcc-ar-7
lrwxrwxrwx 1 root root 25 May 8 2019 /usr/bin/gcc-ar-7 -> x86_64-linux-gnu-gcc-ar-7
lrwxrwxrwx 1 root root 8 May 20 2019 /usr/bin/gcc-nm -> gcc-nm-7
lrwxrwxrwx 1 root root 25 May 8 2019 /usr/bin/gcc-nm-7 -> x86_64-linux-gnu-gcc-nm-7
lrwxrwxrwx 1 root root 12 May 20 2019 /usr/bin/gcc-ranlib -> gcc-ranlib-7
lrwxrwxrwx 1 root root 29 May 8 2019 /usr/bin/gcc-ranlib-7 -> x86_64-linux-gnu-gcc-ranlib-7
lrwxrwxrwx 1 root root 5 May 20 2019 /usr/bin/x86_64-linux-gnu-g++ -> g++-7
-rwxr-xr-x 1 root root 1010624 May 8 2019 /usr/bin/x86_64-linux-gnu-g++-7
lrwxrwxrwx 1 root root 5 May 20 2019 /usr/bin/x86_64-linux-gnu-gcc -> gcc-7
-rwxr-xr-x 1 root root 1010624 May 8 2019 /usr/bin/x86_64-linux-gnu-gcc-7
lrwxrwxrwx 1 root root 8 May 20 2019 /usr/bin/x86_64-linux-gnu-gcc-ar -> gcc-ar-7
-rwxr-xr-x 1 root root 27104 May 8 2019 /usr/bin/x86_64-linux-gnu-gcc-ar-7
lrwxrwxrwx 1 root root 8 May 20 2019 /usr/bin/x86_64-linux-gnu-gcc-nm -> gcc-nm-7
-rwxr-xr-x 1 root root 27104 May 8 2019 /usr/bin/x86_64-linux-gnu-gcc-nm-7
lrwxrwxrwx 1 root root 12 May 20 2019 /usr/bin/x86_64-linux-gnu-gcc-ranlib -> gcc-ranlib-7
-rwxr-xr-x 1 root root 27104 May 8 2019 /usr/bin/x86_64-linux-gnu-gcc-ranlib-7
下面列出了工具的版本:
amy@test-ubuntu18:~/android_test/boringssl/build$ ninja --version
1.8.2
amy@test-ubuntu18:~/android_test/boringssl/build$ cmake --version
cmake version 3.15.2
尝试了this issue中提到的建议,但没有用。
错误说“/home/amy/android_test/android-ndk-r21-beta2/toolchains/llvm/prebuilt/linux-x86_64/bin/clang”不是完整路径,所以我检查了路径中的内容(我没有请参阅其中列出的“linux-x86_64”):
$ls -l /home/amy/android_test/android-ndk-r21-beta2/toolchains/llvm/prebuilt/
drwxrwxr-x 13 amy amy 4096 Jan 3 15:35 windows-x86_64