我试图在Windows中为Android编译protobuf 2.6.1。我正在使用MinGw并从https://developers.google.com/protocol-buffers/docs/downloads
下载了protobuf来源我可以毫无问题地运行以下配置脚本。
./configure --host=arm-linux-androideabi --disable-shared
--enable-cross-compile CC=C:/Android/android-ndk-r10/toolchain
/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-
androideabi-gcc.exe CXX=C:/Android/android-ndk-r10/toolchains/arm-linux-
androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-
g++.exe LDFLAGS="-LC:/Android/android-ndk-r10/platforms/android-19/arch-
arm/usr/lib --sysroot=C:/Android/android-ndk-r10/platforms/android-
19/arch-arm" CPPFLAGS=-IC:/Android/android-ndk-r10/platforms/android-
19/arch-arm/usr/include
当我运行make命令时,会显示以下错误。
$ make
C:/MinGW/msys/1.0/bin/make all-recursive
make[1]: Entering directory 'C:/MinGW/msys/1.0/home/VENKRAJ/protobuf'
Making all in .
make[2]: Entering directory 'C:/MinGW/msys/1.0/home/VENKRAJ/protobuf'
make[2]: Nothing to be done for 'all-am'.
make[2]: Leaving directory 'C:/MinGW/msys/1.0/home/VENKRAJ/protobuf'
Making all in src
make[2]: Entering directory 'C:/MinGW/msys/1.0/home/VENKRAJ/protobuf/src'
depbase=`echo google/protobuf/compiler/main.o | sed 's|[^/]*$|.deps
/&|;s|\.o$||'
`;\
C:/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.8/prebuilt
/windows-x86_64/bin/arm-linux-androideabi-g++.exe -DHAVE_CONFIG_H -I.
-I.. -IC:/Android/android-ndk-r10/platforms/android-19/arch-arm/usr
/include -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
-O2 -g -DNDEBUG -MT google/protobuf/compiler/main.o -MD -MP -MF
$depbase.Tpo -c -o google/protobuf/compiler/main.o google/protobuf
/compiler/main.cc &&\mv -f $depbase.Tpo $depbase.Po
In file included from ./google/protobuf/compiler
/command_line_interface.h:41:0,from google/protobuf/compiler/main.cc:33:
./google/protobuf/stubs/common.h:40:19: fatal error: cstddef: No such
file or directory
#include <cstddef>
^
compilation terminated.
Makefile:2039: recipe for target 'google/protobuf/compiler/main.o' failed
make[2]: *** [google/protobuf/compiler/main.o] Error 1
make[2]: Leaving directory 'C:/MinGW/msys/1.0/home/VENKRAJ/protobuf/src'
Makefile:700: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory 'C:/MinGW/msys/1.0/home/VENKRAJ/protobuf'
Makefile:606: recipe for target 'all' failed
make: *** [all] Error 2
请让我知道我哪里出错了。
答案 0 :(得分:0)
尝试运行
make clean
或
make distclean
并重新运行
./配置
请