]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
cmake: fix "WITH_STATIC_LIBSTDCXX"
authorKefu Chai <kchai@redhat.com>
Thu, 12 Jul 2018 09:17:44 +0000 (17:17 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 28 Jul 2018 17:44:18 +0000 (01:44 +0800)
commitd245ffb0e616d3f2dc954047389da69f7142c915
treee5133e6f83fbfda6027d60ba03e7df1dd828faae
parentd76fbf67a690eb9010465e3368544008cead764a
cmake: fix "WITH_STATIC_LIBSTDCXX"

- do not link libkv with ALLOC_LIBS, it turns out that if we link
tcmalloc *before* -static-libstdc++ -static-libgcc, libstdc++ and gcc
libs will show up in `ldd` output
- add `-static-libstdc++ -static-libgcc` to CMAKE_SHARED_LINKER_FLAGS
and CMAKE_EXE_LINKER_FLAGS instead of adding them to all shared
libraries and executable. simpler this way.
- link against libtcmalloc statically, because libtcmalloc is a C++
library, linking against it dynamically and linking against C++ runtime
statically will pull in depdencies on two versions of C++ runtime, which
will bring down the app at run-time.
- do not pass '-pie' to linker when building executable if
`WITH_STATIC_LIBSTDCXX` and tcmalloc is used, because the static tcmalloc
is not compiled with PIC.
- only apply '-pie' if ENABLE_SHARED is enabled.

Signed-off-by: Kefu Chai <kchai@redhat.com>
CMakeLists.txt
src/CMakeLists.txt
src/librados/CMakeLists.txt
src/libradosstriper/CMakeLists.txt
src/librbd/CMakeLists.txt
src/mgr/CMakeLists.txt
src/osd/CMakeLists.txt