]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: build liburing with -fPIC 37990/head
authorKefu Chai <kchai@redhat.com>
Mon, 9 Nov 2020 09:08:35 +0000 (17:08 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 9 Nov 2020 09:10:59 +0000 (17:10 +0800)
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 <kchai@redhat.com>
cmake/modules/Builduring.cmake

index 3d28ec82ad2ccc481353774fd02da7c22c692cc8..3d9e4c64983ba642d656b3afc5a8d7f0a18f3c7f 100644 (file)
@@ -18,7 +18,7 @@ function(build_uring)
   ExternalProject_Add(liburing_ext
     ${source_dir_args}
     CONFIGURE_COMMAND <SOURCE_DIR>/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 "<SOURCE_DIR>/src/liburing.a"
     INSTALL_COMMAND "")