From: Mike Christie Date: Wed, 5 Jun 2019 04:42:40 +0000 (-0500) Subject: cmake and build: add netlink lib requirement detection X-Git-Tag: v14.2.5~167^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=207088a0db85cc38f93705e5aaa8a02fba436a1e;p=ceph.git cmake and build: add netlink lib requirement detection The next patch adds netlink support to rbd-nbd. This patch just adds the build related changes to bring in the netlink lib and test and build against it. Signed-off-by: Mike Christie (cherry picked from commit 88156715536924293fb3a8b610566369324e69db) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c652018dff..09cce4cbdca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -218,15 +218,22 @@ if(LINUX) set(HAVE_UDEV ${UDEV_FOUND}) find_package(blkid REQUIRED) set(HAVE_BLKID ${BLKID_FOUND}) + if(WITH_RBD) + find_package(genl REQUIRED) + set(HAVE_GENL $GENL_FOUND) + endif() elseif(FREEBSD) set(HAVE_UDEV OFF) set(HAVE_LIBAIO OFF) set(HAVE_BLKID OFF) + set(HAVE_GENL OFF) else() set(HAVE_UDEV OFF) message(STATUS "Not using udev") set(HAVE_BLKID OFF) message(STATUS "Not using BLKID") + set(HAVE_GENL OFF) + message(STATUS "Not using GENL") endif(LINUX) option(WITH_OPENLDAP "OPENLDAP is here" ON) diff --git a/ceph.spec.in b/ceph.spec.in index 73454281575..62e6f5b87a0 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -167,6 +167,7 @@ BuildRequires: libaio-devel BuildRequires: libblkid-devel >= 2.17 BuildRequires: libcurl-devel BuildRequires: libudev-devel +BuildRequires: libnl3-devel BuildRequires: liboath-devel BuildRequires: libtool BuildRequires: libxml2-devel diff --git a/cmake/modules/Findgenl.cmake b/cmake/modules/Findgenl.cmake new file mode 100644 index 00000000000..07c5f357bdb --- /dev/null +++ b/cmake/modules/Findgenl.cmake @@ -0,0 +1,23 @@ +# - Find libnl-genl3 +# Find the genl library and includes +# +# GENL_INCLUDE_DIR - where to find netlink.h, etc. +# GENL_LIBRARIES - List of libraries when using genl. +# GENL_FOUND - True if genl found. + +find_path(GENL_INCLUDE_DIR NAMES netlink/netlink.h PATH_SUFFIXES libnl3) + +find_library(LIBNL_LIB nl-3) +find_library(LIBNL_GENL_LIB nl-genl-3) +set(GENL_LIBRARIES + ${LIBNL_LIB} + ${LIBNL_GENL_LIB} + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(nl-genl-3 + DEFAULT_MSG GENL_LIBRARIES GENL_INCLUDE_DIR) + +mark_as_advanced( + GENL_LIBRARIES + GENL_INCLUDE_DIR) diff --git a/debian/control b/debian/control index b073073ba13..242397e34a5 100644 --- a/debian/control +++ b/debian/control @@ -45,6 +45,8 @@ Build-Depends: cmake (>= 3.5), libssl-dev, libtool, libudev-dev, + libnl-3-dev, + libnl-genl-3-dev, libxml2-dev, librabbitmq-dev, lsb-release, diff --git a/src/tools/rbd_nbd/CMakeLists.txt b/src/tools/rbd_nbd/CMakeLists.txt index d7ce811e963..5356fae4f9b 100644 --- a/src/tools/rbd_nbd/CMakeLists.txt +++ b/src/tools/rbd_nbd/CMakeLists.txt @@ -1,3 +1,4 @@ add_executable(rbd-nbd rbd-nbd.cc) -target_link_libraries(rbd-nbd librbd librados global) +target_include_directories(rbd-nbd PUBLIC ${GENL_INCLUDE_DIR}) +target_link_libraries(rbd-nbd librbd librados global ${GENL_LIBRARIES}) install(TARGETS rbd-nbd DESTINATION bin)