]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: should compile libzstd with -fPIC
authorKefu Chai <kchai@redhat.com>
Mon, 22 Oct 2018 05:13:11 +0000 (13:13 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 22 Oct 2018 06:40:03 +0000 (14:40 +0800)
otherwise we will have

/usr/bin/ld: libzstd/lib/libzstd.a(error_private.c.o): relocation
R_X86_64_32S against `.rodata' can not be used when making a shared
object; recompile with -fPIC

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/compressor/zstd/CMakeLists.txt

index c730e48b16d6d1b0ddd2d4ea53e3a1a5c550f4bc..76709bbb66465aaf3275e3b4b87843569aef628b 100644 (file)
@@ -10,6 +10,7 @@ ExternalProject_Add(zstd_ext
              -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
              -DCMAKE_C_FLAGS=${ZSTD_C_FLAGS}
              -DCMAKE_AR=${CMAKE_AR}
+             -DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_SHARED}
   BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/libzstd
   BUILD_COMMAND $(MAKE) libzstd_static
   INSTALL_COMMAND "true")