From 3510433f9cf8f9558704ce3db8f4501705bc7675 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 9 Nov 2020 17:08:35 +0800 Subject: [PATCH] cmake: build liburing with -fPIC in liburing, https://github.com/axboe/liburing/commit/75cad68b953fe0fabbc4b1ced1ab4ba0ed5da18e partially reverts https://github.com/axboe/liburing/commit/4e360f71131918c36774f51688e5c65dea8d43f2, which builds liburing.a with -fPIC. so we need to pass -fPIC by ourselves. otherwise we'd have /usr/bin/ld: ../../liburing/src/liburing.a(setup.ol): relocation R_X86_64_PC32 against symbol `io_uring_queue_mmap' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status src/test/fio/CMakeFiles/fio_ceph_objectstore.dir/build.make:154: recipe for target 'lib/libfio_ceph_objectstore.so' failed Signed-off-by: Kefu Chai --- cmake/modules/Builduring.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/Builduring.cmake b/cmake/modules/Builduring.cmake index 3d28ec82ad2..3d9e4c64983 100644 --- a/cmake/modules/Builduring.cmake +++ b/cmake/modules/Builduring.cmake @@ -18,7 +18,7 @@ function(build_uring) ExternalProject_Add(liburing_ext ${source_dir_args} CONFIGURE_COMMAND /configure - BUILD_COMMAND env CC=${CMAKE_C_COMPILER} ${make_cmd} -C src -s + BUILD_COMMAND env CC=${CMAKE_C_COMPILER} "CFLAGS=${CMAKE_C_FLAGS} -fPIC" ${make_cmd} -C src -s BUILD_IN_SOURCE 1 BUILD_BYPRODUCTS "/src/liburing.a" INSTALL_COMMAND "")