java - How to build libprotobuf-lite.so -
i'm trying protobuf lib communicate between java , jni layer in android. source code guided here. added source file in jni>source_sirectory. if perform ndk-build generate .so file prompt following error log:
[armeabi] sharedlibrary : libprotobuf-lite.so jni/src/google/protobuf/stubs/common.cc:201: error: undefined reference 'google::protobuf::util::status::tostring() const' jni/src/google/protobuf/stubs/common.cc:207: error: undefined reference 'google::protobuf::operator<<(std::ostream&, google::protobuf::uint128 const&)' jni/src/google/protobuf/arena.h:622: error: undefined reference 'google::protobuf::arena::allocatealigned(std::type_info const*, unsigned int)' jni/src/google/protobuf/arena.h:624: error: undefined reference 'google::protobuf::arena::addlistnode(void*, void (*)(void*))' jni/src/google/protobuf/arena.h:462: error: undefined reference 'google::protobuf::arena::addlistnode(void*, void (*)(void*))' jni/src/google/protobuf/arena.h:617: error: undefined reference 'google::protobuf::arena::allocatealigned(std::type_info const*, unsigned int)' jni/src/google/protobuf/arena.h:617: error: undefined reference 'google::protobuf::arena::allocatealigned(std::type_info const*, unsigned int)' jni/src/google/protobuf/arena.h:617: error: undefined reference 'google::protobuf::arena::allocatealigned(std::type_info const*, unsigned int)' jni/src/google/protobuf/arena.h:633: error: undefined reference 'google::protobuf::arena::addlistnode(void*, void (*)(void*))' jni/src/google/protobuf/arena.h:624: error: undefined reference 'google::protobuf::arena::addlistnode(void*, void (*)(void*))' jni/src/google/protobuf/wire_format_lite.cc:514: error: undefined reference 'google::protobuf::internal::isstructurallyvalidutf8(char const*, int)' jni/src/google/protobuf/wire_format_lite.cc:527: error: undefined reference 'google::protobuf::stringprintf(char const*, ...)' collect2: error: ld returned 1 exit status
any suggestion if i'm missing here?
proto buffer generated c/c++ code dependent on google's support code, installed alongside proto buffer compiler. means c/c++ dependent on protobuf's support code, why linkage errors - apparently did not link google's proto buffer support library alongside other linked resources when generating shared object.
i created eclipse build jni .so libraries, added -lprotobuf flag linker, can seen here (search makefile, scroll linker section). hope help.
Comments
Post a Comment