github下载不了glog可以上gitcode或者gitee
https://blog.csdn.net/hhaijiuwo/article/details/119876307
-
Could not find a package configuration file... GflagsConfig.cmake gflags-config.cmake 解决方法
https://blog.csdn.net/qq_39779233/article/details/123970672 -
Could not find a package configuration file... GflagsConfig.cmake gflags-config.cmake
https://blog.csdn.net/qq_39779233/article/details/125400866
NDK交叉编译glog
- CMakeLists.txt修改
1.注释set (CMAKE_DEBUG_POSTFIX d)
2.注释logging_unittest.cc
相关的编译,否则报错
# add_executable (logging_unittest
# src/logging_unittest.cc
# )
# target_link_libraries (logging_unittest PRIVATE ${_GLOG_TEST_LIBS})
# add_test (NAME logging COMMAND logging_unittest)
# set_tests_properties (logging PROPERTIES TIMEOUT 30)
# # MacOS diff is not deterministic: use the output to determine whether the
# # test passed.
# set_tests_properties (logging PROPERTIES PASS_REGULAR_EXPRESSION ".*\nPASS\n.*")
#
# # FIXME: Skip flaky test
# set_tests_properties (logging PROPERTIES SKIP_REGULAR_EXPRESSION
# "Check failed: time_ns within LogTimes::LOG_PERIOD_TOL_NS of LogTimes::LOG_PERIOD_NS")
#
# if (APPLE)
# # FIXME: Skip flaky test
# set_property (TEST logging APPEND PROPERTY SKIP_REGULAR_EXPRESSION
# "unexpected new.*PASS\nTest with golden file failed. We'll try to show the diff:")
# endif (APPLE)
- 利用NDK制作编译脚本
mkdir -p build
cd build
rm -rf *
export CMAKE_BUILD_TYPE=Debug
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=/etc/opt/pkg/android-ndk-r25c/build/cmake/android.toolchain.cmake \
-DANDROID_ABI="arm64-v8a" \
-DANDROID_NATIVE_API_LEVEL=android-24 \
make -j4
- 引用libglog的项目要引用andorid的log库
target_link_libraries(lxc_socket_server log)
否则报错:(注意到glog里也有引用,但是没有用。)
但是如果打静态链接可执行文件包,CMakeLists.txt里设置SET(CMAKE_EXE_LINKER_FLAGS "-static")
之后编译又会报错:
0 条评论