2020-04-13 09:55:49 +00:00
|
|
|
function(build_uring)
|
|
|
|
include(FindMake)
|
|
|
|
find_make("MAKE_EXECUTABLE" "make_cmd")
|
|
|
|
|
2020-11-09 05:11:06 +00:00
|
|
|
if(EXISTS "${PROJECT_SOURCE_DIR}/src/liburing/configure")
|
|
|
|
set(source_dir_args
|
|
|
|
SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/liburing")
|
|
|
|
else()
|
|
|
|
set(source_dir_args
|
|
|
|
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/liburing
|
2020-12-03 01:56:43 +00:00
|
|
|
GIT_REPOSITORY https://github.com/axboe/liburing.git
|
2024-02-27 14:25:32 +00:00
|
|
|
GIT_TAG "liburing-2.5"
|
2020-11-09 05:11:06 +00:00
|
|
|
GIT_SHALLOW TRUE
|
2020-11-24 03:24:35 +00:00
|
|
|
GIT_CONFIG advice.detachedHead=false)
|
2020-11-09 05:11:06 +00:00
|
|
|
endif()
|
|
|
|
|
2020-04-13 09:55:49 +00:00
|
|
|
include(ExternalProject)
|
|
|
|
ExternalProject_Add(liburing_ext
|
2020-11-09 05:11:06 +00:00
|
|
|
${source_dir_args}
|
2024-02-27 14:25:32 +00:00
|
|
|
CONFIGURE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} <SOURCE_DIR>/configure --use-libc
|
2021-04-27 05:33:40 +00:00
|
|
|
BUILD_COMMAND ${make_cmd} "CFLAGS=${CMAKE_C_FLAGS} -fPIC" -C src -s
|
2020-04-13 09:55:49 +00:00
|
|
|
BUILD_IN_SOURCE 1
|
|
|
|
BUILD_BYPRODUCTS "<SOURCE_DIR>/src/liburing.a"
|
2020-11-24 03:24:35 +00:00
|
|
|
INSTALL_COMMAND ""
|
2021-08-16 10:42:18 +00:00
|
|
|
UPDATE_COMMAND ""
|
|
|
|
LOG_CONFIGURE ON
|
|
|
|
LOG_BUILD ON
|
|
|
|
LOG_MERGED_STDOUTERR ON
|
|
|
|
LOG_OUTPUT_ON_FAILURE ON)
|
2020-04-13 09:55:49 +00:00
|
|
|
unset(make_cmd)
|
|
|
|
|
|
|
|
ExternalProject_Get_Property(liburing_ext source_dir)
|
|
|
|
set(URING_INCLUDE_DIR "${source_dir}/src/include")
|
|
|
|
set(URING_LIBRARY_DIR "${source_dir}/src")
|
cmake: populate liburing include and library paths down to rocksdb external project
There are two problems:
1) The librocksdb does not use the built liburing if present.
2) You cannot turn off rocksdb's use of liburing with WITH_LIBURING=OFF.
This is to fix errors like:
FAILED: bin/ceph_test_keyvaluedb_iterators
: && /opt/rh/gcc-toolset-11/root/usr/bin/g++ -Og -g -rdynamic -pie src/test/ObjectMap/CMakeFiles/ceph_test_keyvaluedb_iterators.dir/test_keyvaluedb_iterators.cc.o src/test/ObjectMap/CMakeFiles/ceph_test_keyvaluedb_iterators.dir/KeyValueDBMemory.cc.o -o bin/ceph_test_keyvaluedb_iterators -Wl,-rpath,/home/pdonnell/scratch/build/lib lib/libos.a lib/libgmock_maind.a lib/libgmockd. a lib/libgtestd.a -lpthread -ldl lib/libglobal.a -ldl /usr/lib64/librt.so -lresolv -ldl lib/libblk.a /lib64/libaio.so src/liburing/src/liburing.a lib/libkv.a lib/libheap_profiler.a /lib64/libtcmalloc.so src/rocksdb/librocksdb.a /lib64/libsnappy.so /usr/lib64/liblz4.so /usr/lib64/libz.so /usr/lib64/libfuse.so lib/libceph-common.so.2 src/opentelemetry-cpp/sdk/src/trace/libopentelemetry_trace.a src/opentelemetry-cpp/sdk/src/resource/libopentelemetry_resources.a src/opentelemetry-cpp/sdk/src/common/libopentelemetry_common.a src/opentelemetry-cpp/exporters/jaeger/libopentelemetry_exporter_jaeger_trace.a src/opentelemetry-cpp/ext/src/http/client/curl/libopentelemetry_http_client_curl.a /usr/lib64/libcurl.so /usr/lib64/libthrift.so lib/libjson_spirit.a lib/libcommon_utf8.a lib/liberasure_code.a lib/libextblkdev.a -lcap boost/lib/libboost_thread.a boost/lib/libboost_chrono.a boost/lib/libboost_atomic.a boost/lib/libboost_system.a boost/lib/libboost_random.a boost/lib/libboost_program_options.a boost/lib/libboost_date_time.a boost/lib/libboost_iostreams.a boost/lib/libboost_regex.a lib/libfmtd.a /usr/lib64/libblkid.so -lpthread /usr/lib64/libcrypto.so /usr/lib64/libudev.so /usr/lib64/libz.so -ldl -lresolv -Wl,--as-needed -latomic && :
/opt/rh/gcc-toolset-11/root/usr/bin/ld: src/rocksdb/librocksdb.a(fs_posix.cc.o): in function `io_uring_wait_cqe_nr':
/home/pdonnell/scratch/build/src/liburing/src/include/liburing.h:494: undefined reference to `__io_uring_get_cqe'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: src/rocksdb/librocksdb.a(fs_posix.cc.o): in function `rocksdb::(anonymous namespace)::PosixFileSystem::AbortIO(std::vector<void*, std::allocator<void*> >&)':
/home/pdonnell/ceph/src/rocksdb/env/fs_posix.cc:1125: undefined reference to `io_uring_get_sqe'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: /home/pdonnell/ceph/src/rocksdb/env/fs_posix.cc:1134: undefined reference to `io_uring_submit'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: src/rocksdb/librocksdb.a(fs_posix.cc.o): in function `rocksdb::CreateIOUring()':
/home/pdonnell/ceph/src/rocksdb/env/io_posix.h:272: undefined reference to `io_uring_queue_init'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: src/rocksdb/librocksdb.a(io_posix.cc.o): in function `io_uring_wait_cqe_nr':
/home/pdonnell/scratch/build/src/liburing/src/include/liburing.h:494: undefined reference to `__io_uring_get_cqe'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: src/rocksdb/librocksdb.a(io_posix.cc.o): in function `rocksdb::PosixRandomAccessFile::MultiRead(rocksdb::FSReadRequest*, unsigned long, rocksdb::IOOptions const&, rocksdb::IODebugContext*)':
/home/pdonnell/ceph/src/rocksdb/env/io_posix.cc:674: undefined reference to `io_uring_get_sqe'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: /home/pdonnell/ceph/src/rocksdb/env/io_posix.cc:684: undefined reference to `io_uring_submit_and_wait'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: src/rocksdb/librocksdb.a(io_posix.cc.o): in function `rocksdb::PosixRandomAccessFile::ReadAsync(rocksdb::FSReadRequest&, rocksdb::IOOptions const&, std::function<void (rocksdb::FSReadRequest const&, void*)>, void*, void**, std::function<void (void*)>*, rocksdb::IODebugContext*)':
/home/pdonnell/ceph/src/rocksdb/env/io_posix.cc:901: undefined reference to `io_uring_get_sqe'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: /home/pdonnell/ceph/src/rocksdb/env/io_posix.cc:910: undefined reference to `io_uring_submit'
collect2: error: ld returned 1 exit status
Fixes: https://tracker.ceph.com/issues/63218
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2023-10-16 14:07:04 +00:00
|
|
|
set(URING_INCLUDE_DIR ${URING_INCLUDE_DIR} PARENT_SCOPE)
|
|
|
|
set(URING_LIBRARY_DIR ${URING_LIBRARY_DIR} PARENT_SCOPE)
|
2020-04-13 09:55:49 +00:00
|
|
|
|
|
|
|
add_library(uring::uring STATIC IMPORTED GLOBAL)
|
|
|
|
add_dependencies(uring::uring liburing_ext)
|
|
|
|
file(MAKE_DIRECTORY ${URING_INCLUDE_DIR})
|
|
|
|
set_target_properties(uring::uring PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES ${URING_INCLUDE_DIR}
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
|
|
|
IMPORTED_LOCATION "${URING_LIBRARY_DIR}/liburing.a")
|
|
|
|
endfunction()
|