jeremyczhen / fdbus

FDBus - Fast Distributed Bus
https://blog.csdn.net/jeremy_cz/article/details/89060291
161 stars 85 forks source link

ndk编译出现clang++: error: linker command failed with exit code 1 #26

Open shuiyueIII opened 3 years ago

shuiyueIII commented 3 years ago

ubuntu系统,ndk20b命令如下: cd ~/workspace git clone https://github.com/protocolbuffers/protobuf.git protobuf-host cd protobuf-host && git submodule update --init --recursive && cd .. cp protobuf-host protobuf-target -r

cd ./protobuf-target;mkdir -p build/install;cd build

cmake -DCMAKE_INSTALL_PREFIX=install -DBUILD_SHARED_LIBS=1 -DANDROID_LINKER_FLAGS="-landroid -llog" -Dprotobuf_BUILD_PROTOC_BINARIES=0 -Dprotobuf_BUILD_TESTS=0 -DCMAKE_TOOLCHAIN_FILE=~/android-ndk-r20b/build/cmake/android.toolchain.cmake ../cmake

PATH=~/workspace/protobuf-target/build/install/bin:$PATH make -j4 install 报错如下 [ 52%] Linking CXX shared library libcommon_base.so /home/asd/workspace/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lpthread /home/asd/fdbus/fdbus/CBaseClient.cpp:96: error: undefined reference to 'android_log_print' /home/asd/fdbus/fdbus/CBaseClient.cpp:100: error: undefined reference to 'android_log_print' /home/asd/fdbus/fdbus/CBaseClient.cpp:105: error: undefined reference to 'android_log_print' /home/asd/fdbus/fdbus/CBaseClient.cpp:182: error: undefined reference to 'android_log_print' clang++: error: linker command failed with exit code 1 (use -v to see invocation) CMakeFiles/common_base.dir/build.make:1056: recipe for target 'libcommon_base.so' failed make[2]: *** [libcommon_base.so] Error 1 CMakeFiles/Makefile2:321: recipe for target 'CMakeFiles/common_base.dir/all' failed

jeremyczhen commented 3 years ago

还没有在ndk下编译过。fdbus有android.bp,ndk下可以用android.bp编译吗?