From 9ba26835d89f33b7121af6a510f660ed9ea62454 Mon Sep 17 00:00:00 2001 From: Tom Scogland Date: Mon, 4 Nov 2024 12:12:27 -0800 Subject: [PATCH 1/3] cmake/boost: use upstream boost cmake config problem: the cmake-provided boost finder is deprecated in favor of the one upstream in boost starting in 1.70 solution: since we support 1.66 and up, attempt to use the upstream config (use the CONFIG flag on the find_package call), and only if that fails use the one included with cmake --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8b630d06..232c14e43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,9 +131,16 @@ pkg_check_modules(UUID REQUIRED IMPORTED_TARGET uuid) set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) -find_package(Boost 1.66 REQUIRED COMPONENTS +find_package(Boost CONFIG 1.66 COMPONENTS graph - ) +) +# if the upstream boost cmake config is not found, fall back +# TODO: remove this when we require 1.70+ +if (NOT Boost_FOUND) + find_package(Boost 1.66 REQUIRED COMPONENTS + graph + ) +endif () message(STATUS "Boost version: ${Boost_VERSION}") # Install paths From 735caba5b653f1f5bb18bfb822ddd09fbcaec7b5 Mon Sep 17 00:00:00 2001 From: Tom Scogland Date: Mon, 4 Nov 2024 12:14:19 -0800 Subject: [PATCH 2/3] cmake: support opensuse's insistence on lib64 problem: on my OpenSUSE dev vm, the install directory is forced pretty hard to use lib64 solution: allow lib64 as a valid path for libraries, packageconfigs and modules --- CMakeLists.txt | 2 +- cmake/FindFluxCore.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 232c14e43..0998bb781 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,7 @@ set( CMAKE_BUILD_RPATH # the RPATH to be used when installing, but only if it's not a system directory list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) if("${isSystemDir}" STREQUAL "-1") - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib64:${CMAKE_INSTALL_PREFIX}/lib") endif("${isSystemDir}" STREQUAL "-1") # Setting the include directory for the application to find config.h diff --git a/cmake/FindFluxCore.cmake b/cmake/FindFluxCore.cmake index 8cae18c66..7c5703148 100644 --- a/cmake/FindFluxCore.cmake +++ b/cmake/FindFluxCore.cmake @@ -5,7 +5,7 @@ else() if(FLUX) get_filename_component(EXTRA_FLUX_CORE_PREFIX_BIN ${FLUX} DIRECTORY) get_filename_component(EXTRA_FLUX_CORE_PREFIX ${EXTRA_FLUX_CORE_PREFIX_BIN} DIRECTORY) - set(ENV{PKG_CONFIG_PATH} "${EXTRA_FLUX_CORE_PREFIX}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") + set(ENV{PKG_CONFIG_PATH} "${EXTRA_FLUX_CORE_PREFIX}/lib64/pkgconfig:${EXTRA_FLUX_CORE_PREFIX}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") message(STATUS "found ${FLUX} in PATH with prefix=${EXTRA_FLUX_CORE_PREFIX}") endif() endif() From 58458db7b58fd42ec4e2641d37277ed1be6ba21f Mon Sep 17 00:00:00 2001 From: Tom Scogland Date: Mon, 4 Nov 2024 12:15:39 -0800 Subject: [PATCH 3/3] intern: fold into fluxion-data and version the so problem: the libintern so wasn't being versioned, causing problems on upgrades, see https://github.com/flux-framework/flux-sched/issues/1308 solution: the real dependency should be on libfluxion-data anyway, which was closer to how we wanted it. The libintern library is now built static, linked into libfluxion-data, and provided that way. Additionally, the libfluxion-data library is installed as `libfluxion-data.so.{version without git suffix}` and linked as `libfluxion-data.so.{version major}.{version minor}` with no unsuffixed link installed. --- qmanager/modules/CMakeLists.txt | 1 - resource/CMakeLists.txt | 11 ++++++++--- resource/libjobspec/CMakeLists.txt | 3 +-- resource/modules/CMakeLists.txt | 1 - src/common/libintern/CMakeLists.txt | 4 +--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/qmanager/modules/CMakeLists.txt b/qmanager/modules/CMakeLists.txt index a6cd40a6c..36615d8ee 100644 --- a/qmanager/modules/CMakeLists.txt +++ b/qmanager/modules/CMakeLists.txt @@ -10,6 +10,5 @@ target_link_libraries(sched-fluxion-qmanager PRIVATE flux::core flux::schedutil PkgConfig::JANSSON - intern cppwrappers ) diff --git a/resource/CMakeLists.txt b/resource/CMakeLists.txt index 2ab5b922b..625be874c 100644 --- a/resource/CMakeLists.txt +++ b/resource/CMakeLists.txt @@ -1,5 +1,12 @@ add_library(fluxion-data SHARED schema/data_std.cpp) -install(TARGETS fluxion-data LIBRARY) +target_link_libraries(fluxion-data PRIVATE + intern + ) +set_target_properties(fluxion-data PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + ) +install(TARGETS fluxion-data LIBRARY NAMELINK_SKIP) add_subdirectory(libjobspec) add_subdirectory(planner) set(RESOURCE_HEADERS @@ -77,7 +84,6 @@ add_library(resource STATIC target_include_directories(resource PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(resource PRIVATE planner - intern ) target_link_libraries(resource PUBLIC flux::hostlist @@ -87,7 +93,6 @@ target_link_libraries(resource PUBLIC PkgConfig::UUID Boost::graph jobspec_conv - fluxion-data ) add_sanitizers(resource) diff --git a/resource/libjobspec/CMakeLists.txt b/resource/libjobspec/CMakeLists.txt index 7a4f2a8c9..b8e0aa9e7 100644 --- a/resource/libjobspec/CMakeLists.txt +++ b/resource/libjobspec/CMakeLists.txt @@ -13,7 +13,6 @@ add_sanitizers(jobspec_conv) target_link_libraries(jobspec_conv PUBLIC flux::hostlist flux::idset flux::core yaml-cpp PkgConfig::JANSSON PkgConfig::UUID - intern fluxion-data ) @@ -26,5 +25,5 @@ target_link_libraries(flux-jobspec-validate PRIVATE jobspec_conv) add_executable(test_constraint.t test/constraint.cpp) add_sanitizers(test_constraint.t) -target_link_libraries(test_constraint.t jobspec_conv libtap intern) +target_link_libraries(test_constraint.t jobspec_conv libtap) flux_add_test(NAME test_constraint COMMAND test_constraint.t) diff --git a/resource/modules/CMakeLists.txt b/resource/modules/CMakeLists.txt index 915d526cf..bbf43989f 100644 --- a/resource/modules/CMakeLists.txt +++ b/resource/modules/CMakeLists.txt @@ -7,6 +7,5 @@ target_link_libraries (sched-fluxion-resource PRIVATE resource PkgConfig::JANSSON PkgConfig::UUID - intern cppwrappers ) diff --git a/src/common/libintern/CMakeLists.txt b/src/common/libintern/CMakeLists.txt index ec2bc19d0..2eb657831 100644 --- a/src/common/libintern/CMakeLists.txt +++ b/src/common/libintern/CMakeLists.txt @@ -1,7 +1,5 @@ -add_library(intern SHARED +add_library(intern STATIC interner.cpp) -install(TARGETS intern - LIBRARY) add_executable(interned_string_test test/interned_string_test.cpp) add_sanitizers(interned_string_test)