我正在尝试在Linux Mint 20 Ulyana (基于ubuntu焦点)中使用cmake (3.16.3)构建or-tools版本7.1
我正在遵循这里的说明,https://github.com/google/or-tools/blob/f3fd201e68cf75b7720ff5c3cadc599a1d02b54b/cmake/README.md
首先,我运行了cmake -H. -Bbuild -G "Unix Makefiles",但由于找不到依赖项,所以我用cmake -H. -Bbuild -G "Unix Makefiles" -DBUILD_DEPS=ON替换了它
但过了一段时间后,我得到了以下错误
[ 55%] No test step for 'Cbc_project'
[ 66%] Completed 'Cbc_project'
[100%] Built target Cbc_project
-- Building Cbc: ...DONE
-- Configuring done
CMake Error at ortools/constraint_solver/CMakeLists.txt:57 (add_dependencies):
The dependency target "absl::container" of target
"ortools_constraint_solver" does not exist.
CMake Error at ortools/glop/CMakeLists.txt:50 (add_dependencies):
The dependency target "absl::container" of target "ortools_glop" does not
exist.
CMake Error at ortools/linear_solver/CMakeLists.txt:54 (add_dependencies):
The dependency target "absl::container" of target "ortools_linear_solver"
does not exist.
CMake Error at ortools/sat/CMakeLists.txt:60 (add_dependencies):
The dependency target "absl::container" of target "ortools_sat" does not
exist.
CMake Error at ortools/constraint_solver/CMakeLists.txt:33 (target_compile_options):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_OPTIONS>
Target "absl::container" not found.
CMake Error at ortools/constraint_solver/CMakeLists.txt:45 (target_compile_definitions):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_DEFINITIONS>
Target "absl::container" not found.
CMake Error at ortools/constraint_solver/CMakeLists.txt:20 (target_include_directories):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_INCLUDE_DIRECTORIES>
Target "absl::container" not found.
CMake Error at ortools/constraint_solver/CMakeLists.txt:45 (target_compile_definitions):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_DEFINITIONS>
Target "absl::container" not found.
CMake Error at ortools/constraint_solver/CMakeLists.txt:20 (target_include_directories):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_INCLUDE_DIRECTORIES>
Target "absl::container" not found.
CMake Error at ortools/glop/CMakeLists.txt:30 (target_compile_options):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_OPTIONS>
Target "absl::container" not found.
CMake Error at ortools/glop/CMakeLists.txt:40 (target_compile_definitions):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_DEFINITIONS>
Target "absl::container" not found.
CMake Error at ortools/glop/CMakeLists.txt:19 (target_include_directories):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_INCLUDE_DIRECTORIES>
Target "absl::container" not found.
CMake Error at ortools/glop/CMakeLists.txt:40 (target_compile_definitions):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_DEFINITIONS>
Target "absl::container" not found.
CMake Error at ortools/glop/CMakeLists.txt:19 (target_include_directories):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_INCLUDE_DIRECTORIES>
Target "absl::container" not found.
CMake Error at ortools/linear_solver/CMakeLists.txt:32 (target_compile_options):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_OPTIONS>
Target "absl::container" not found.
CMake Error at ortools/linear_solver/CMakeLists.txt:43 (target_compile_definitions):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_DEFINITIONS>
Target "absl::container" not found.
CMake Error at ortools/linear_solver/CMakeLists.txt:20 (target_include_directories):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_INCLUDE_DIRECTORIES>
Target "absl::container" not found.
CMake Error at ortools/linear_solver/CMakeLists.txt:43 (target_compile_definitions):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_DEFINITIONS>
Target "absl::container" not found.
CMake Error at ortools/linear_solver/CMakeLists.txt:20 (target_include_directories):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_INCLUDE_DIRECTORIES>
Target "absl::container" not found.
CMake Error at ortools/sat/CMakeLists.txt:34 (target_compile_options):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_OPTIONS>
Target "absl::container" not found.
CMake Error at ortools/sat/CMakeLists.txt:47 (target_compile_definitions):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_DEFINITIONS>
Target "absl::container" not found.
CMake Error at ortools/sat/CMakeLists.txt:20 (target_include_directories):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_INCLUDE_DIRECTORIES>
Target "absl::container" not found.
CMake Error at ortools/sat/CMakeLists.txt:47 (target_compile_definitions):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_COMPILE_DEFINITIONS>
Target "absl::container" not found.
CMake Error at ortools/sat/CMakeLists.txt:20 (target_include_directories):
Error evaluating generator expression:
$<TARGET_PROPERTY:absl::container,INTERFACE_INCLUDE_DIRECTORIES>
Target "absl::container" not found.
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.提前谢谢你!
发布于 2021-11-14 13:20:28
CMake在7.1中没有完全实现。
为什么要停留在7.1上?为什么不在7.1中使用make?
发布于 2021-11-15 09:49:37
问题是abseil-cpp master已经丢弃了absl::container CMake目标。
总而言之,在v7.1中,当使用-DBUILD_DEPS=ON构建所有deps时,基于CMake的构建将使用abseil-cpp主分支ref:https://github.com/google/or-tools/blob/f3fd201e68cf75b7720ff5c3cadc599a1d02b54b/cmake/dependencies/CMakeLists.txt#L50-L59
但是从v7.1版本开始,absl::container目标就被删除了
空的absl::容器目标已从CMake构建中删除。此目标没有任何影响,并且可以安全地删除用户代码中对此目标的引用。请参阅:https://github.com/abseil/abseil-cpp/releases/tag/20210324.2
一种可能的解决方法是在cmake/dependencies/CMakeLists.txt#L50-L59中将标记master更改为20200923.3
,但正如所说,我们强烈建议您使用最新的稳定版本v9.1
https://stackoverflow.com/questions/69961930
复制相似问题