Skip to content

Fix dpdk support when using custom prefix #2542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ set (Seastar_GEN_BINARY_DIR ${Seastar_BINARY_DIR}/gen)
#

include (SeastarDependencies)
seastar_find_dependencies ()
seastar_find_dependencies (BUILD)

# Private build dependencies not visible to consumers
find_package (ragel 6.10 REQUIRED)
Expand Down Expand Up @@ -875,9 +875,16 @@ else ()
endif ()

if (Seastar_DPDK)
# Although Seastar uses DPDK internally, DPDK symbols should not be exposed to
# Seastar users. However, DPDK's dependencies (like numa, pthread) must still
# be included in Seastar's INTERFACE_LINK_LIBRARIES to ensure proper linking
# of applications using Seastar.
target_link_libraries (seastar
PRIVATE
DPDK::dpdk)
"$<BUILD_INTERFACE:DPDK::dpdk>")
get_target_property(DPDK_INTERFACE_LINK_LIBRARIES DPDK::dpdk INTERFACE_LINK_LIBRARIES)
target_link_libraries (seastar
PRIVATE "${DPDK_INTERFACE_LINK_LIBRARIES}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you use something like

seastar/CMakeLists.txt

Lines 867 to 875 in 665fed0

if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.26)
target_link_libraries (seastar
PRIVATE
"$<BUILD_LOCAL_INTERFACE:Valgrind::valgrind>")
else ()
target_link_libraries (seastar
PRIVATE
"$<BUILD_INTERFACE:Valgrind::valgrind>")
endif ()
?

so we don't forget dropping the workaround for older versions of CMake when we bump up the minimal required version of CMake ?

endif ()

include (TriStateOption)
Expand Down
9 changes: 8 additions & 1 deletion cmake/SeastarDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ endmacro ()
# with the corresponding configuration for each 3rd-party dependency.
#
macro (seastar_find_dependencies)
cmake_parse_arguments (args "BUILD" "" "" ${ARGN})

#
# List of Seastar dependencies that is meant to be used
# both in Seastar configuration and by clients which
Expand All @@ -84,7 +86,6 @@ macro (seastar_find_dependencies)
# Public dependencies.
Boost
c-ares
dpdk # No version information published.
fmt
lz4
# Private and private/public dependencies.
Expand All @@ -103,6 +104,12 @@ macro (seastar_find_dependencies)
ucontext
yaml-cpp)

# Only expose dpdk dependency during build. Since dpdk is included to within seastar library,
# there is no need to force it to be discoverable via find_package().
if (args_BUILD)
list (APPEND _seastar_all_dependencies dpdk)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd like to understand your use case better. do you enable Seastar_DPDK when building Seastar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I build and use Seastar using the following:

./3rdparty/seastar/configure.py --mode=release --enable-dpdk --prefix=$(pwd)/build-install
ninja -C ./3rdparty/seastar/build/release install

...

mkdir -p build
cmake -S . -B build -GNinja \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_PREFIX_PATH=$(pwd)/build-install \
    -DCMAKE_INSTALL_PREFIX=$(pwd)/build-install
ninja -C build

I would say this is pretty unconventional setup except for the install prefix and that DPDK is enabled. Without this PR build will fail because there's no dpdk installed in build-install (which is expected)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p12tic how do you build DPDK? do you build a static build of DPDK using something like cooking.sh ? i cannot find --cook dpdk in your command line arguments passed to configure.py .

but in a more unconventional setup, user might want to build Seastar with a dynamic build of DPDK libraries. in that case, we would have to find dpdk when building seastar and when building the seastar application. in this case, we cannot skip the find_package(dpdk) call when building seastar application, i think.


# Arguments to `find_package` for each 3rd-party dependency.
# Note that the version specification is a "minimal" version requirement.

Expand Down