安装版本大于20230802.1的abseil失败
Closed this issue · 5 comments
Xmake 版本
v2.9.2+master.a298a7d88
操作系统版本和架构
Windows 11 家庭中文版 22H2 22621.3737
描述问题
安装abseil>时,cmake报错:
CMake Error at CMake/AbseilHelpers.cmake:317 (target_link_libraries):
The link interface of target "test_allocator" contains:
GTest::gmock
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
absl/container/CMakeLists.txt:206 (absl_cc_library)
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_BUILD_TYPE
CMAKE_C_FLAGS_RELEASE
CMake Generate step failed. Build files cannot be regenerated correctly.
HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
if you want to get more verbose errors, please see:
-> C:\Users\Junity\AppData\Local\.xmake\cache\packages\2406\a\abseil\20240116.1\installdir.failed\logs\install.txt
C:\Users\Junity\AppData\Local.xmake\cache\packages\2406\a\abseil\20240116.1\installdir.failed\logs\install.txt内容如下:
CMake Error at CMake/AbseilHelpers.cmake:317 (target_link_libraries):
The link interface of target "test_allocator" contains:
GTest::gmock
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
absl/container/CMakeLists.txt:206 (absl_cc_library)
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_BUILD_TYPE
CMAKE_C_FLAGS_RELEASE
CMake Generate step failed. Build files cannot be regenerated correctly.
HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Configuring done (5.7s)
-- Generating done (1.0s)
abseil<=20230802.1可以正常安装
期待的结果
abseil被成功安装
工程配置
abseil由protobuf-cpp引入,配置如下:
add_requires("uwebsockets","easyloggingpp","nlohmann_json","argparse")
target("server")
set_kind("binary")
add_packages("uwebsockets","easyloggingpp","nlohmann_json","argparse","protobuf-cpp")
add_rules("protobuf.cpp")
add_files("src/*.cpp")
add_files("$(projectdir)/protocol/*.proto")
add_includedirs("include")
add_includedirs("$(projectdir)/protocol")
set_languages("cxx17")
add_defines("VERSION=\"1.0\"")
set_rundir("$(projectdir)/test")
附加信息和错误日志
似乎是abseil自身的问题,我尝试过直接拉取abseil并使用cmake构建,但同样失败。由于其它依赖abseil的库(如protobuf-cpp)默认使用最新版的abseil,这个问题可能会导致所有依赖abseil的库无法构建
现在我的解决方案是修改abseil的xmake.lua,将新版本删去
Bot detected the issue body's language is not English, translate it automatically.
Title: Failed to install abseil with version greater than 20230802.1
Bot detected the issue body's language is not English, translate it automatically.
Now my solution is to modify abseil's xmake.lua and delete the new version
可以 add_requireconfs("protobuf-cpp.abseil", {version = "xxx", override = true})
改写依赖版本
或者提个 pr 过来改进下包
Bot detected the issue body's language is not English, translate it automatically.
You can rewrite the dependency version with add_requireconfs("protobuf-cpp.abseil", {version = "xxx", override = true})