我试图在Windows上为Android编译Protobuf 2.6.0。
我不得不说我需要一个staic Protobuf库才能与Android上的Qt 5一起使用。
在Cygwin bash中我运行下一个命令:
./configure --prefix=c:/Thirdparty/Android/protobuf/build \
--host=arm-linux-androideabi \
--disable-shared \
--enable-cross-compile \
--with-protoc=c:/Thirdparty/bin/protoc \
CC=c:/Thirdparty/Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc.exe \
CXX=c:/Thirdparty/Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++.exe \
LDFLAGS=-Lc:/Thirdparty/Android/NDK/platforms/android-5/arch-arm/usr/lib \
CPPFLAGS=-Ic:/Thirdparty/Android/NDK/platforms/android-5/arch-arm/usr/include
但我得到了下一个错误:
configure:3474: checking whether the C compiler works
configure:3496: c:/Thirdparty/Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc.exe \
-Ic:/Thirdparty/Android/NDK/platforms/android-5/arch-arm/usr/include \
-Lc:/Thirdparty/Android/NDK/platforms/android-5/arch-arm/usr/lib conftest.c >&5
c:/thirdparty/android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.exe:
error: cannot open crtbegin_dynamic.o: No such file or directory
c:/thirdparty/android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.exe:
error: cannot open crtend_android.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
我该怎么办?谢谢。
答案 0 :(得分:1)
我找到了解决方案。我不得不定义--sysroot =“”,就像这样:
LDFLAGS="-Lc:/Thirdparty/Android/NDK/platforms/android-5/arch-arm/usr/lib \
--sysroot=c:/Thirdparty/Android/NDK/platforms/android-5/arch-arm"