CMake Error at cmake_install.cmake:(file) Multiple conflicting paths found for ...

I try to work with install(RUNTIME_DEPENDENCY_SET … )

install(TARGETS ${PROJECT_NAME} RUNTIME COMPONENT ${PROJECT_NAME})
install(IMPORTED_RUNTIME_ARTIFACTS ${PROJECT_NAME} RUNTIME_DEPENDENCY_SET runtime_dependency_set
        RUNTIME
)
install(RUNTIME_DEPENDENCY_SET runtime_dependency_set RUNTIME DESTINATION lib)

The first time it works fine

Executing workflow step 3 of 4: build preset "Install"

[0/1] Install the project...
-- Install configuration: "Release"
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/libfmt.so.10.1.0
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/libfmt.so.10
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/libfmt.so
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/args.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/chrono.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/color.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/compile.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/core.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/format.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/format-inl.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/os.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/ostream.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/printf.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/ranges.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/std.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/include/fmt/xchar.h
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/cmake/fmt/fmt-config.cmake
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/cmake/fmt/fmt-config-version.cmake
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/cmake/fmt/fmt-targets.cmake
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/cmake/fmt/fmt-targets-release.cmake
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/pkgconfig/fmt.pc
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/bin/Hello
-- Set runtime path of "/home/klein_cl/Workspace/cpp/docker_build/stagedir/bin/Hello" to ""
-- Up-to-date: /home/klein_cl/Workspace/cpp/docker_build/stagedir/bin/Hello
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/ld-linux-x86-64.so.2
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/libc.so.6
-- Up-to-date: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/libfmt.so.10
-- Up-to-date: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/libfmt.so.10.1.0
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/libgcc_s.so.1
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/libm.so.6
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/libstdc++.so.6
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/libstdc++.so.6.0.32

Executing workflow step 4 of 4: package preset "Release"

CPack: Create package using TGZ
CPack: Install projects
CPack: - Install project: Hello [Release]
CPack: Create package
CPack: - package: /home/klein_cl/Workspace/cpp/docker_build/Hello-0.0.1-Linux.tar.gz generated.
klein_cl:~/Workspace/cpp/docker_build$

But the second time, it dosn’t:

Executing workflow step 3 of 4: build preset "Install"

[0/1] Install the project...
-- Install configuration: "Release"
-- Installing: /home/klein_cl/Workspace/cpp/docker_build/stagedir/bin/Hello
-- Set runtime path of "/home/klein_cl/Workspace/cpp/docker_build/stagedir/bin/Hello" to ""
-- Up-to-date: /home/klein_cl/Workspace/cpp/docker_build/stagedir/bin/Hello
CMake Error at cmake_install.cmake:121 (file):
  file Multiple conflicting paths found for libc.so.6:

    /home/klein_cl/Workspace/cpp/docker_build/stagedir/lib/libc.so.6
    /lib/x86_64-linux-gnu/libc.so.6


FAILED: CMakeFiles/Release/install.util
cd /home/klein_cl/Workspace/cpp/docker_build/build && /home/klein_cl/.local/lib/python3.10/site-packages/cmake/data/bin/cmake -DBUILD_TYPE=Release -P cmake_install.cmake
ninja: build stopped: subcommand failed.
klein_cl:~/Workspace/cpp/docker_build$

Got it, this helps:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 55a3a3e..fd89f55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,17 +44,13 @@ if(CMAKE_SKIP_INSTALL_RULES)
 endif()

 install(TARGETS ${PROJECT_NAME} RUNTIME COMPONENT ${PROJECT_NAME})
-install(IMPORTED_RUNTIME_ARTIFACTS ${PROJECT_NAME} RUNTIME_DEPENDENCY_SET runtime_dependency_set
-        RUNTIME
+install(IMPORTED_RUNTIME_ARTIFACTS ${PROJECT_NAME} RUNTIME_DEPENDENCY_SET
+        _dependency_set
+)
+# FIXME: CONFLICTING_DEPENDENCIES_PREFIX  _conflicts
+install(RUNTIME_DEPENDENCY_SET _dependency_set
+        POST_EXCLUDE_REGEXES "${CMAKE_INSTALL_PREFIX}/lib"
+        RUNTIME DESTINATION lib
 )
-install(RUNTIME_DEPENDENCY_SET runtime_dependency_set RUNTIME DESTINATION lib)

 include(CPack)
1 Like