Commit Graph

255 Commits

Author SHA1 Message Date
Kefu Chai
3229c7acd9 cmake: fix typos
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-09-21 12:41:42 +08:00
Kefu Chai
07a3e8d7a6
Merge pull request #23650 from tchaikov/wip-dpdk-cmake
cmake: fix the build WITH_DPDK=ON

Reviewed-by: Casey Bodley <cbodley@redhat.com>
2018-09-14 23:44:01 +08:00
Kefu Chai
b61afd73e4
Merge pull request #23995 from tchaikov/wip-add-ceph-libboost-repo
install-deps,run-make-check: use ceph-libboost repo

Reviewed-by: Alfredo Deza <adeza@redhat.com>
Reviewed-by: Erwan Velu <erwan@redhat.com>
2018-09-13 19:40:26 +08:00
Kefu Chai
027164e156 cmake/modules: add FindBoost.cmake
the FindBoost.cmake shipped by cmake 3.5.1 is not new enough to identify
the dependencies of boost 1.63 and up. so we need to copy the
FindBoost.cmake from cmake upstream. it supports up to boost 1.68.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-09-11 22:22:47 +08:00
Mohamad Gebai
872d909d22 cmake: fix version matching for Findfmt
Signed-off-by: Mohamad Gebai <mgebai@suse.com>
2018-09-10 10:22:24 -04:00
Kefu Chai
2c823a18cb cmake: pass DPDK_DIR explicitly
so we don't rely on build_dpdk() to be a macro to set variables in
its parent scope.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-09-05 17:33:59 +08:00
Kefu Chai
1a6877dc04 cmake/modules/BuildDPDK.cmake: link whole-archive
we build dpdk as static library, linking against them without specifying
--whole-archive will get the constructor symbols droppped by the linker
as they are not referenced directly by the excecutable. so we need to do
so to make sure we call all the constructors.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-09-05 15:40:30 +08:00
Kefu Chai
c976f580e7 cmake: fix the build WITH_DPDK=ON
* add Findcryptopp.cmake back
  cryptopp support was dropped in #20015, but it's required by
  src/msg/async/dpdk/TCP.h, which `#include <cryptopp/md5.h>`
  so, to fix the FTBFS of WITH_DPDK=ON, we need to bring
  Findcryptopp.cmake back. it was also removed in #20015.
* pass "-march=core2" when building sources which include dpdk headers.
  i was wrong that the headers shipped by distro are generic.
  the headers use the sse instructions for speedup memcpy, see
  /usr/include/x86_64-linux-gnu/dpdk/rte_memcpy.h .
* also, we need to include the arch specific include directory
  for building with dpdk.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-09-05 13:53:57 +08:00
Kefu Chai
dda006a007 cmake: should use lowercase for component name in FindSanitizers.cmake
and s/undefined-behavior/undefined_behavior/ to be compatible with
seastar

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-21 20:05:49 +08:00
Kefu Chai
1d1833ece0
Merge pull request #23628 from tchaikov/wip-cmake-gtest-cleanup
cmake: link against gtest in a better way

Reviewed-by: Casey Bodley <cbodley@redhat.com>
Reviewed-by: Willem Jan Withagen <wjw@digiware.nl>
2018-08-19 22:58:47 +08:00
Kefu Chai
6f231ee864 cmake: link against gtest in a better way
* add FindGMock.cmake which allows user to use the libgtest-dev
  shipped by distro
* add GMock::{GMock,Main}, GTest::{GTest,Main} targets to be
  compatible with FindGTest.cmake and FindGMock.cmake, which
  expose the built libraries with properties adhered to
  them. so the consumer of them can import them in a better way.
* update tests to drop the commands like
  set_target_properties(foo PROPERTIES COMPILE_FLAGS ${UNITTEST_CXX_FLAGS}),
  as they are already linked against gmock and gtest.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-17 15:21:27 +08:00
Kefu Chai
303e3c4a6c cmake: fix Finddpdk.cmake
* add dpdk::dpdk if dpdk is built or found, as seastar checks for
  it before adding its component libraries. if user installs libdpdk
  and builds WITH_SEASTAR=ON or WITH_DPDK=ON, cmake fails to configure
  the building system without this fix.
* add dpdk::cflags target for populating the -march=<arch> compile
  option.
* also use pkg-config for finding dpdk.
* link common_async_dpdk against dpdk::dpdk instead

please note, the reason why we can remove the "-march=native" compile
option from Finddpdk.cmake, is that the distro shipped header files
are "generic" in the sense of "-march=<ARCH>", they do not enable
the arch specific intrinsic by default, hence the source files
including them do not need specific compiler options.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-17 15:16:22 +08:00
Nathan Cutler
18dc98e3f0 cmake: do not build DPDK with -march=native
-march=native causes gcc to use opcodes according to whichever CPU happens to
be installed in the build host, which can be different for every build. This
makes it impossible to achieve a reproducible build.

Also, if the build host has a very new CPU, running the resulting binaries on
older CPUs (of the same family, i.e. x86_64) could result in segmentation
fault.

References: http://tracker.ceph.com/issues/24948
Signed-off-by: Nathan Cutler <ncutler@suse.com>
2018-08-17 14:09:08 +08:00
Kefu Chai
e2e6a77b38
Merge pull request #23510 from tchaikov/wip-cmake-boost-build
cmake: fix build WITH_SYSTEM_BOOST=ON

Reviewed-by: Willem Jan Withagen <wjw@digiware.nl>
Reviewed-by: Casey Bodley <cbodley@redhat.com>
2018-08-13 21:42:10 +08:00
Patrick Donnelly
4a9fcb6c6f
Merge PR #23500 into master
* refs/pull/23500/head:
	debian: mark python-ceph-argparse Arch = all
	rpm: package cephfs-shell for fedora
	tools/cephfs,deb: package cephfs-shell
	cmake: install script and egg-info files of cephfs-shell
	tools/cephfs: add setup.py for cephfs-shell

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
2018-08-11 16:33:47 -07:00
Kefu Chai
46c8b04a98 cmake: fix build WITH_SYSTEM_BOOST=ON
FindBoost.cmake from upstream cmake now finds python libraries like

find_package(Boost 1.67 python36)

and it export targets like Boost::python36

but we are still linking against Boost::python, so to be compatible
with FindBoost.cmake, we need to update BuildBoost.cmake and
mgr/CMakeLists.txt accordingly. in other words, to export
Boost::python36 and to link Boost::python36.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-09 18:57:04 +08:00
Kefu Chai
ee86364f9a cmake: install script and egg-info files of cephfs-shell
egg-info offers requires.txt, which is parsed by dh_python3 to prepare
the dependencies for the cephfs-shell packaging. also, the meta-info
in the .egg allows user to use eggs if they wish. see
https://wiki.debian.org/Python/FAQ#How_should_we_package_Python_eggs.3F
.

Fixes: http://tracker.ceph.com/issues/26852
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-09 17:55:24 +08:00
Kefu Chai
72cc4cedd4
Merge pull request #23441 from tchaikov/wip-cmake-rocksdb-cleanup
cmake: rocksdb related cleanup

Reviewed-by: Casey Bodley <cbodley@redhat.com>
2018-08-09 00:46:53 +08:00
Kefu Chai
5a71bbbe59 cmake: refactor RocksDB related script
* rename Findrocksdb.cmake to FindRocksDB.cmake to match its name
* add RocksDB::RocksDB target to BuildRocksDB.cmake and
  FindRocksDB.cmake
* use RocksDB::RocksDB target instead of accessing its property
  directly, and do not link against its dependencies explicitly.
  let its INTERFACE_LINK_LIBRARIES do the job.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-06 19:37:43 +08:00
Kefu Chai
4b09b2fbc4 cmake,make-dist: revert "build gperftools if WITH_STATIC_LIBSTDCXX"
as the higher version of libstdc++ is backward compatible with the lower
ones. so there is no need to statically link against C++ libraries. they
can always use the libstdc++ ships with the distro.

This reverts commit a6c73b6ac1

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-06 18:30:38 +08:00
Kefu Chai
c325327e61 cmake: add LZ4::LZ4 target for LZ4
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-06 17:38:07 +08:00
Kefu Chai
73fa175499 cmake: cleanup snappy related script
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-06 17:16:46 +08:00
Kefu Chai
c32c6e286b cmake: cleanup snappy related script
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-06 15:46:07 +08:00
Kefu Chai
9da93644c8
Merge pull request #23390 from tchaikov/wip-cmake-fmt-4.x
cmake: do not use Findfmt.cmake for checking libfmt-dev

Reviewed-by: Nathan Cutler <ncutler@suse.com>
2018-08-03 21:05:03 +08:00
Kefu Chai
917f4f84ab
Merge pull request #23384 from tchaikov/wip-cmake-cleanup
cmake: fix std::filesystem detection and extract sanitizer detection into its own module

Reviewed-by: Casey Bodley <cbodley@redhat.com>
Reviewed-by: Willem Jan Withagen <wjw@digiware.nl>
2018-08-03 08:58:14 +08:00
Nathan Cutler
13d3d7c862
Merge pull request #23382 from tchaikov/wip-gtest-parallel-py3
cmake,run-make-check: always enable WITH_GTEST_PARALLEL

Reviewed-by: Nathan Cutler <ncutler@suse.com>
2018-08-02 18:11:30 +02:00
Kefu Chai
8df0e40b46 cmake: require 4.0.0 <= libfmt-dev < 5.0.0
FMT_VERSION is now living in fmt/core.h in libfmt >= 5.0, so we cannot
parse fmt/format.h for libfmt's version anymore. also we don't need
Findfmt.cmake now. because libfmt-dev 4.0 and up is required by seastar,
also it's libfmt-dev 3.x's cmake module which fails to offer fmt::fmt
target. in other words, it's safe to drop libfmt 3.x support. but 5.0.0
is not compatible with seastar, we will have failures like:

In file included from
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/aligned_buffer.hh:25:0,
                 from
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/reactor.hh:26,
                 from
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/alien.hh:35,
                 from
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/src/core/alien.cc:23:
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/print.hh:
In function 'seastar::sstring seastar::format(const char*, A&& ...)':
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/print.hh:135:10:
error: 'MemoryWriter' is not a member of 'fmt'
     fmt::MemoryWriter out;
          ^~~~~~~~~~~~
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/print.hh:136:5:
error: 'out' was not declared in this scope
     out.write(fmt, std::forward<A>(a)...);
     ^~~

so, we should build libfmt even if we have libfmt-dev 5.x

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-02 22:14:03 +08:00
Kefu Chai
cee0122780 cmake,run-make-check: always enable WITH_GTEST_PARALLEL
now that https://github.com/google/gtest-parallel/pull/63 has been
merged, we can now use gtest-parallel with py2 and also py3.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-02 17:13:14 +08:00
Kefu Chai
a7326ee0f4 cmake: extract sanitizer detection out
also, we don't need to pass '-lasan' or '-ltsan' to linker. it's
suggested to use the "-fsanitize=${sanitizer}".

please note, this module is compatible with the one used in seastar on
purpose, as seastar is included in ceph using add_subdirectory(), and it
in turn add its own cmake modules directory using list(APPEND ...), so
cmake/modules/FindSantitizers.cmake is prefered over
src/seastar/cmake/FindSantitizers.cmake.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-02 14:43:47 +08:00
Kefu Chai
bbd95765cc cmake: fix StdFilesystem detection
before this change, we fails to detect std::filesystem with clang++,
because  the cmake project created by try_compile() only expands
following options passed from its caller:
- COMPILE_DEFINITIONS
- INCLUDE_DIRECTORIES
- LINK_DIRECTORIES
- LINK_LIBRARIES

which do not include CMAKE_CXX_FLAGS, so either we need to (ab)use
COMPILE_DEFINITIONS for passing -std=c++17, or we can change the
CMAKE_CXX_FLAGS in the parent env, as it turns out the created cmake
project does inherit this flag from current project. in this change,
we use the COMPILE_DEFINITIONS approach: simpler this way. and we
can drop it once cmake 3.8 is required.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-02 14:37:49 +08:00
Kefu Chai
53a0c18aff
Merge pull request #23380 from majianpeng/cmake-jemalloc-error
cmake: fix a cmake error when with -DALLOCATOR=jemalloc.

Reviewed-by: Kefu Chai <kchai@redhat.com>
2018-08-02 10:46:27 +08:00
Jianpeng Ma
ab1497addc cmake: fix a cmake error when with -DALLOCATOR=jemalloc.
When exec: ./do_cmake.sh -DALLOCATOR=jemalloc. Met the following
messages:
>> CMake Error at cmake/modules/FindJeMalloc.cmake:28 (endforeach):
  endforeach An ENDFOREACH command was found outside of a proper FOREACH
  ENDFOREACH structure.  Or its arguments did not match the opening FOREACH
  command.
>> Call Stack (most recent call first):
  CMakeLists.txt:326 (find_package)

This bug introduce commit 8db629a14b.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
2018-08-02 16:38:53 +08:00
Kefu Chai
0912caefa9
Merge pull request #23300 from tchaikov/wip-cmake-cleanup
cmake: cleanups

Reviewed-by: Willem Jan Withagen <wjw@digiware.nl>
Reviewed-by: Casey Bodley <cbodley@redhat.com>
2018-08-02 10:14:09 +08:00
Kefu Chai
a6c73b6ac1 cmake,make-dist: build gperftools if WITH_STATIC_LIBSTDCXX
we could create a mini project to build a shared library, and use
try_compile() to test if the found gperftools is compiled with -fPIC.
but as we are targeting mostly xenial when enabling
WITH_STATIC_LIBSTDCXX, and google-perftools on xenial by default
is built without -fPIC. so let's keep it simple.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-07-29 21:25:52 +08:00
Kefu Chai
e6c7e0f521 cmake: extract std::filesystem linkage checking into module
see
https://libcxx.llvm.org/docs/UsingLibcxx.html#using-libc-experimental-and-experimental,

> Note that as of libc++ 7.0 using the <experimental/filesystem>
> requires linking libc++fs instead of libc++experimental.

do not build ceph_test_admin_socket_output if we are not able to find
the library for std::experimental::filesystem . it is a workaround of
https://reviews.freebsd.org/D10840 where FreeBSD 11.2 does not ship
libc++experimental.a .

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-07-29 20:25:32 +08:00
Kefu Chai
a61493062c cmake: link against libsnappy.a if WITH_STATIC_LIBSTDCXX
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-07-29 01:44:18 +08:00
Kefu Chai
7dd82bbeb1 cmake: extract mount.ceph into src/mount
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-07-28 16:53:10 +08:00
Kefu Chai
78aad3a28c cmake: extract Yasm check into a module
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-07-28 16:53:10 +08:00
Kefu Chai
591167e0cc
Merge pull request #23254 from tchaikov/wip-cmake-cleanup
cmake: modularize src/perfglue

Reviewed-by: Casey Bodley <cbodley@redhat.com>
2018-07-27 13:12:54 +08:00
Kefu Chai
bacde7cc17 cmake: add Findfmt.cmake
the cmake config provided by fmt-devel-3.0.2 does not offer fmt::fmt target,
so we need to offer a Findfmt.cmake to do this.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-07-26 16:50:37 +08:00
Kefu Chai
8db629a14b cmake: import allocator libraries in a better way
* instead expose the paths, it'd better to expose a library target.
* remove HAVE_LIBJEMALLOC, as it not used anywhere.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-07-26 15:16:48 +08:00
Kefu Chai
a8b39ccc2c
Merge pull request #23074 from tchaikov/wip-seastar-config
common/config: add ConfigProxy for crimson

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2018-07-26 01:02:11 +08:00
Kefu Chai
094b9fdbef
Merge pull request #23231 from tchaikov/wip-fio
tests/fio: fix build failures and ensure this is covered by run-make-check.sh

Reviewed-by: Igor Fedotov <ifedotov@suse.com>
2018-07-26 00:11:29 +08:00
Kefu Chai
ed00c25a6e cmake: sync up with upstream FIO
to pick up the change to FTBFS with C++ engine.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-07-25 22:47:20 +08:00
Kefu Chai
4e61f2286d cmake: build c-ares if it's not found or not new enough
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-07-25 13:13:45 +08:00
Kefu Chai
be300380ce cmake: Finddpdk: add dpdk::${component} libs
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-07-22 09:55:23 +08:00
Kefu Chai
467411ba6b
Merge pull request #22952 from tchaikov/wip-cmake-atomic
cmake: should link against libatomic if libcxx/libstdc++ does not off…

Reviewed-by: Casey Bodley <cbodley@redhat.com>
2018-07-12 20:40:41 +08:00
Sage Weil
c63be04dee Merge PR #22949 into master
* refs/pull/22949/head:
	cmake: cleanup FindCython.cmake

Reviewed-by: Nathan Cutler <ncutler@suse.com>
2018-07-10 08:42:22 -05:00
Kefu Chai
94453fc137
Merge pull request #22931 from tchaikov/wip-find-py-interp-for-gtest-parallel
cmake: find a python2 interpreter for gtest-parallel

Reviewed-by: Erwan Velu <erwan@redhat.com>
2018-07-10 21:29:54 +08:00
Kefu Chai
16976bd42a cmake: should link against libatomic if libcxx/libstdc++ does not offer atomic ops
for instance,  GCC-8 on riscv64 does not offer atomic ops like
__atomic_fetch_or_1, so we need to link against libatomic to get access
to these symbols.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-07-10 01:37:00 +08:00