Skip to content

Commit

Permalink
cmake: Depend on libbsd if DPDK depends on it
Browse files Browse the repository at this point in the history
If libbsd-dev is installed during build time, DPDK will depend on it
without a way to turn this off.

config/meson.build has the following:

libbsd = dependency('libbsd', required: false, method: 'pkg-config')
if libbsd.found()
    dpdk_conf.set('RTE_USE_LIBBSD', 1)
endif

And lib/eal/include/rte_string_fns.h contains:

#ifdef RTE_USE_LIBBSD
#include <bsd/string.h>

#else /* no BSD header files, create own */
#define strlcpy(dst, src, size) rte_strlcpy(dst, src, size)
#define strlcat(dst, src, size) rte_strlcat(dst, src, size)

#endif /* RTE_USE_LIBBSD */
#endif /* FREEBSD */

Accordingly the only way to address this inflexibility is to ensure that
dpdk dependencies are appropriately transferred to
INTERFACE_LINK_LIBRARIES of the dpdk library.

Signed-off-by: Povilas Kanapickas <[email protected]>
  • Loading branch information
p12tic committed Aug 28, 2024
1 parent ec5da7a commit bb004d4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmake/Finddpdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ endif ()
list (APPEND dpdk_REQUIRED
dpdk_INCLUDE_DIR)

# Depending on whether libbsd-dev exists at build time, DPDK may be built with a dependency on
# libbsd. Note that other libraries in dpdk_PC_LIBRARIES are handled using separate logic
# (see rte_libs above), thus the additional dependencies must be handled on a case by case basis.
set (dpdk_dependencies "")
if ("bsd" IN_LIST dpdk_PC_LIBRARIES)
list (APPEND dpdk_dependencies "bsd")
endif ()

# we prefer static library over the shared library, so just find the
# static libraries first.
set (_cmake_find_library_suffixes_saved ${CMAKE_FIND_LIBRARY_SUFFIXES})
Expand Down Expand Up @@ -163,6 +171,7 @@ if (dpdk_FOUND AND NOT (TARGET dpdk))
set_target_properties (dpdk
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${dpdk_dependencies}
IMPORTED_OBJECTS ${dpdk_object_path}
${compile_options})
# we include dpdk in seastar already, so no need to expose it with
Expand All @@ -175,7 +184,7 @@ if (dpdk_FOUND AND NOT (TARGET dpdk))
set_target_properties (DPDK::dpdk
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${dpdk_PC_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${_dpdk_libraries}"
INTERFACE_LINK_LIBRARIES "${_dpdk_libraries} ${dpdk_dependencies}"
${compile_options})
endif()
endif ()

0 comments on commit bb004d4

Please sign in to comment.