cmake: build liburing with -fPIC

in liburing,
75cad68b95
partially reverts
4e360f7113,
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>
This commit is contained in:
Kefu Chai 2020-11-09 17:08:35 +08:00
parent 8e7b9f27c6
commit 3510433f9c

View 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 "")