大家好,我正在尝试在 NDK 版本(android-ndk-r8-windows)上编译 protobuf-2.4.1 代码。
我在下面设置:
PREBUILT=/cygdrive/d/D_Drive/Project/Pr/CCore/Code/NDK/android-ndk-r8-windows/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3
PLATFORM=/cygdrive/d/D_Drive/Project/Pr/CCore/Code/NDK/android-ndk-r8-windows/android-ndk-r8/platforms/android-4/arch-arm/
export CC="/cygdrive/d/D_Drive/Project/Pr/CCore/Code/NDK/android-ndk-r8-windows/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-gcc"
export CFLAGS="-fPIC -DANDROID -nostdlib"
export ANDROID_ROOT="/cygdrive/d/D_Drive/Project/Pr/CCore/Code/NDK/android-ndk-r8-windows/android-ndk-r8"
export LDFLAGS="-Wl,-rpath-link=$ANDROID_ROOT/platforms/android-4/arch-arm/usr/lib/ -L$ANDROID_ROOT/platforms/android-4/arch-arm/usr/lib/"
export CPPFLAGS="-I$ANDROID_ROOT/platforms/android-4/arch-arm/usr/include/"
CPPFLAGS="-I$ANDROID_ROOT/platforms/android-4/arch-arm/usr/include/"
CPPFLAGS=$CPPFLAGS:"-I$ANDROID_ROOT/sources/cxx-stl/gnu-libstdc++/include/"
export CPPFLAGS
./configure --host=arm-eabi
我在进行 NDK 构建时遇到以下问题:
In file included from D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:33:
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.h:41:18: error: string: No such file or directory
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:37:18: error: vector: No such file or directory
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:48:2: error: #error "No suitable threading library available."
In file included from D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:33:
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.h:136: error: 'string' in namespace 'std' does not name a type
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.h:647: error: expected unqualified-id before '&' token
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.h:647: error: expected ')' before '&' token
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.h:647: error: 'google::protobuf::internal::LogMessage& google::protobuf::internal::LogMessage::operator<<(...)' must not have variable number of arguments
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.h:647: error: expected ';' before '&' token
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.h:663: error: 'string' in namespace 'std' does not name a type
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.h:742: error: expected unqualified-id before '&' token
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.h:742: error: expected ')' before '&' token
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.h:742: error: expected initializer before '&' token
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.h:757: error: expected constructor, destructor, or type conversion before '*' token
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: In function 'void google::protobuf::internal::VerifyVersion(int, int, const char*)':
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:62: error: 'VersionString' was not declared in this scope
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:74: error: 'VersionString' was not declared in this scope
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: At global scope:
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:84: error: 'string' does not name a type
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:108: error: ISO C++ forbids declaration of 'string' with no type
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:108: error: expected ',' or '...' before '&' token
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: In function 'void google::protobuf::internal::DefaultLogHandler(google::protobuf::LogLevel, const char*, int, int)':
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:114: error: 'message' was not declared in this scope
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: At global scope:
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:119: error: ISO C++ forbids declaration of 'string' with no type
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:119: error: expected ',' or '...' before '&' token
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:123: error: expected initializer before '*' token
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:141: error: ISO C++ forbids declaration of 'string' with no type
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:141: error: expected ',' or '...' before '&' token
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: In member function 'google::protobuf::internal::LogMessage& google::protobuf::internal::LogMessage::operator<<(int)':
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:142: error: 'message_' was not declared in this scope
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:142: error: 'value' was not declared in this scope
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: In member function 'google::protobuf::internal::LogMessage& google::protobuf::internal::LogMessage::operator<<(const char*)':
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:147: error: 'message_' was not declared in this scope
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: In member function 'google::protobuf::internal::LogMessage& google::protobuf::internal::LogMessage::operator<<(char)':
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:168: error: 'message_' was not declared in this scope
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: At global scope:
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:169: error: redefinition of 'google::protobuf::internal::LogMessage& google::protobuf::internal::LogMessage::operator<<(int)'
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:141: error: 'google::protobuf::internal::LogMessage& google::protobuf::internal::LogMessage::operator<<(int)' previously defined here
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: In member function 'google::protobuf::internal::LogMessage& google::protobuf::internal::LogMessage::operator<<(google::protobuf::uint)':
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:170: error: 'message_' was not declared in this scope
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: In member function 'google::protobuf::internal::LogMessage& google::protobuf::internal::LogMessage::operator<<(long int)':
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:171: error: 'message_' was not declared in this scope
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: In member function 'google::protobuf::internal::LogMessage& google::protobuf::internal::LogMessage::operator<<(long unsigned int)':
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:172: error: 'message_' was not declared in this scope
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: In member function 'google::protobuf::internal::LogMessage& google::protobuf::internal::LogMessage::operator<<(double)':
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:173: error: 'message_' was not declared in this scope
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: In member function 'void google::protobuf::internal::LogMessage::Finish()':
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:190: error: 'log_handler_' is not a member of 'google::protobuf::internal'
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:190: error: 'message_' was not declared in this scope
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc: At global scope:
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:208: error: expected constructor, destructor, or type conversion before '*' token
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:377: error: expected '}' at end of input
D:/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/jni/src/google/protobuf/stubs/common.cc:377: error: expected '}' at end of input
/cygdrive/d/D_Drive/Project/Pr/CCore/Code/NDK/android-ndk-r8-windows/android-ndk-r8/build/core/build-binary.mk:243: recipe for target `/cygdrive/d/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/obj/local/armeabi/objs/protobuf/src/google/protobuf/stubs/common.o' failed
make: *** [/cygdrive/d/D_Drive/Project/Pr/CCore/Code/NDK/eclipse-SDK-3.7.1-win32/eclipse/workspace/CMNC/obj/local/armeabi/objs/protobuf/src/google/protobuf/stubs/common.o] Error 1