Commit Graph

493 Commits

Author SHA1 Message Date
Kefu Chai
d2b0382ec6 cmake: stop detecting <experimental/filesystem>
since we've dropped the support of GCC older than v8.0, there is no need
to detect <experimental/filesystem>

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-06-09 23:25:22 +08:00
Kefu Chai
b6e6d15a28 cmake: require GCC-8.1 and up
for better C++17 support, for instance for a better std::filesystem
support.

the reason why 8.1 is required is that ubuntu focal provides GCC-8.1,
and RHEL/CentOS8 provides GCC-8.4.1. so we only test the build on
GCC-8.1 and up so far.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-06-09 23:25:22 +08:00
Kefu Chai
7577fec7fd cmake: increase the MAX_{LINK,COMPILE}_MEM
based on recent observation, quite a few C++ source file take
around more than 3.0GiB to compile. for instance,
test_mock_HttpClient.cc could take up to 6270MiB memory to compile.

so increase MAX_{LINK,COMPILE}_MEM accordingly.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-06-03 21:03:03 +08:00
Kefu Chai
b9e8015904 cmake/modules/FindSanitizers: prefer libasan.6
libasan.6 is shipped as part of GCC-11, so prefer it over older versions

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-05-24 16:19:37 +08:00
Casey Bodley
a335304042 rgw: remove the fcgi frontend
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2021-05-17 15:00:33 -04:00
Kefu Chai
078b30e1f1
Merge pull request #41166 from tchaikov/wip-cmake-cython-cflags
cmake: remove cflags from CC

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2021-05-08 21:17:19 +08:00
Rafał Wądołowski
c2c6678e48 cmake: Replace boost download url
Boost has moved downloads to JFrog Artifactory
https://www.boost.org/users/news/boost_has_moved_downloads_to_jfr.html

Signed-off-by: Rafał Wądołowski <rwadolowski@cloudferro.com>
2021-05-07 10:12:43 +02:00
Kefu Chai
1f6cf5e403 cmake: remove cflags from CC
this change make it more explicit how we override CC, CFLAGS and
CPPFLAGS:

* CC only for the compiler
* CFLAGS only for the flags consumed by C compiler
* CPPFLAGS only used for the preprocessor, it is used by both C and C++
  compilers.

this change does not address any specific test failure. it just
improves the correctness and readability.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-05-05 15:19:27 +08:00
Kefu Chai
d0858dbfb4 librados/librados_c: check .symver support using cmake
the __asm__(".asmver ..") is a support provided by the compiler, so
would be better to detect it by either checking the compiler identifer
or just try it out.

in this change, instead of checking the building platform, we check this
feature using check_c_source_compiles().

in future, we could support versioned symbols using function attriubte
or symbol tables or version-script.

on platform where symbol versioning is not supported, we might need to
go with a different approach.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-05-02 08:16:12 +08:00
Kefu Chai
fab337c1d0 common/compat: detect memset_s() using check_function_exists()
more robust this way.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-05-02 08:16:12 +08:00
Kefu Chai
d275875b0e cmake: check for empty string by its value
the behavior of cmake 3.17 is a little bit different as it consider

NOT _library STREQUAL ""

as true, if ${_library} is "".

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-05-02 08:15:15 +08:00
Kefu Chai
a06f8edeca common/pick_address: define in_addr_t if it is not defined
neither mingw not not have in_addr_t defined, see
https://docs.microsoft.com/en-us/windows/win32/api/winsock2/ns-winsock2-in_addr,
so define it if it is not defined.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-05-01 23:30:53 +08:00
Kefu Chai
8ba7087585
Merge pull request #41071 from tchaikov/wip-cmake-disable-vta
cmake: disable "variable tracking" when building rados python binding

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2021-05-01 09:09:05 +08:00
Kefu Chai
59624b0fd9
Merge pull request #41038 from tchaikov/wip-cmake-liburing
cmake: pass "CC" using configure when building liburing

Reviewed-by: Ronen Friedman <rfriedma@redhat.com>
2021-04-29 22:20:09 +08:00
Kefu Chai
c2b3f7f5e7 cmake: disable "variable tracking" when building rados python binding
to silence the warning like:

/home/jenkins-build/build/workspace/ceph-pull-requests/build/src/pybind/rados/rados.c: In function '__pyx_pymod_exec_rados':
/home/jenkins-build/build/workspace/ceph-pull-requests/build/src/pybind/rados/rados.c:78903:30: note: variable tracking size limit exceeded with '-fvar-tracking-assignments', retrying without
78903 | static CYTHON_SMALL_CODE int __pyx_pymod_exec_rados(PyObject *__pyx_pyinit_module)
      |                              ^~~~~~~~~~~~~~~~~~~~~~
cc: warning: /usr/bin/cc: linker input file unused because linking not done

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-04-29 00:11:33 +08:00
Yingxin Cheng
636ab08f26 cmake: bump to PMDK v1.10
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
Signed-off-by: Yin Congmin <congmin.yin@intel.com>
2021-04-28 17:31:41 +08:00
Kefu Chai
e25c046f31 cmake: pass "CC" using configure when building liburing
since liburing's configure checks the CC and CXX env variables, let's
pass them when calling "configure". otherwise "make" still uses gcc and
g++ by default as they are specified in the "configure" script. this
also matches with the way how debian/rules calls "make".

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-04-27 13:36:23 +08:00
Kefu Chai
ad85af2ef8 cmake/modules/Findpmem: always set pmem_VERSION_STRING
before this change, `pmem_VERSION_STRING` is not set if it is not able
to fulfill the specified version requirement. the intention was to check
if the version is able to satisfy the requirement. but actually, passing
an empty `pmem_VERSION_STRING` to `find_package_handle_standard_args()`
as the option of `VERSION_VAR` does not fail this check. on the
contrary, it prints

-- Found pmem: pmem_pmemobj_INCLUDE_DIR;pmem_pmem_INCLUDE_DIR (Required
is at least version "1.17")

if we requires pmem 1.17, while the found version is, for instance,
1.10.

if the required version is 1.7, and the found version is 1.10, the
output from cmake is:

-- Found pmem: pmem_pmemobj_INCLUDE_DIR;pmem_pmem_INCLUDE_DIR (found
suitable version "1.10", minimum required is "1.7")

in this change, the version spec is not specified when calling
`pkg_check_modules()`. so, `PKG_${component}_VERSION` is always set.
and we can always delegate the version checking to
`find_package_handle_standard_args()`. please note, we use the lower
version returned by pkg-config if multiple components are required and
both pkg-config settings return their versions.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-04-26 16:38:09 +08:00
Kefu Chai
117838c91d
Merge pull request #40866 from hualongfeng/pmdk_in_dist
make-dist: add pmdk to dist tarball

Reviewed-by: Kefu Chai <kchai@redhat.com>
2021-04-15 16:43:28 +08:00
Feng Hualong
14c2a2e59f cmake: use src/pmdk for building pmdk if it exists
so we can build with pmdk enabled if the dist tarball
contains pmdk

Signed-off-by: Feng Hualong <hualong.feng@intel.com>
2021-04-15 10:40:06 +08:00
Kefu Chai
e09f8d7dd0
Merge pull request #40149 from tchaikov/wip-cmake-job-pool
cmake: use ninja job pool

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
2021-04-14 15:06:50 +08:00
Kefu Chai
8c44876be4 cmake: s/HAVE_MSGHDR/WITH_SYSTEMD/
as FreeBSD also has msghdr but it does not have systemd, or
flags like MFD_ALLOW_SEALING, O_TMPFILE or F_SEAL_GROW. so
use WITH_SYSTEMD for enabling journald backend of logging system.

also move the option of "WITH_SYSTEMD" up so that the src/CMakeLists.txt
is able to see the variable of WITH_SYSTEMD defined by it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-04-08 16:58:50 +08:00
Kefu Chai
c6e8fc5933
Merge pull request #40487 from tchaikov/wip-boost-1.75
install-deps.sh: install boost 1.75

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2021-04-07 15:10:34 +08:00
Kefu Chai
80c4a1cd37 common: disable journald logging backend if struct msghdr is not found
* cmake/modules/CephChecks.cmake: detect the existence of struct msghdr,
  define HAVE_MSGHDR if it is found
* src/common/CMakeLists.txt: do not compile journald.cc if HAVE_MSGHDR
  is FALSE. as in that case, we cannot use sendmsg() to write to
  journald unix domain socket
* src/test/CMakeLists.txt, src/test/common/CMakeLists.txt: disable test
  exercising journald logging backend if HAVE_MSGHDR is not defined
* src/common/Journald.h: define a dummy JournaldLogger and a dummy
  JournaldClusterLogger when HAVE_MSGHDR is not defined, in order to
  minimize the change in Log.h and Log.cc, otherwise the source code of
  Log.h and Log.cc would be segmented into smaller chunks by
  `ifdef HAVE_MSGHDR` macros.
* src/include/config-h.in.cmake: define a new macro named
  HAVE_MSGHDR.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-04-06 14:46:33 +08:00
Kefu Chai
37a015a9ed cmake: dedup components when finding pmem
otherwise we always find libpmem twice if libpmem is explicitly
specified when find_package()

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-04-05 17:33:10 +08:00
Kefu Chai
89121189ac cmake,install-deps,make-dist: use boost 1.75
so we can use the latest boost

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-04-05 15:09:29 +08:00
Kefu Chai
7e1ef0c0c9 cmake: require libpmem 1.7
detect the libpmem libraries' version using pkg-config

please note, the version is not identical to the ones defined in
libpmem.h or libpmemobj/base.h

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-04-03 23:59:32 +08:00
Kefu Chai
6dfc80737d cmake: consolidate the find logic in Findpmem.cmake
less repeating this way

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-04-03 23:58:53 +08:00
Kefu Chai
bf56cddce5 cmake: use .pc for hints for finding pmem libraries
Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-04-03 22:00:17 +08:00
Kefu Chai
16fd07244d cmake: allow use libzstd in system
since we are moving the test nodes from bionic to focal, we are able to
use the prebuilt libzstd libraries when running "make check". to speed
up the build and test, in this change:

* add FindZstd.cmake which allows us to use the libzstd in system
* extract BuildZstd.cmake for better readability
* add an option named "WITH_SYSTEM_ZSTD", which defaults to "OFF",
  so user can enable it on demand.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-31 12:53:39 +08:00
Kefu Chai
65776d3112 cmake: pass unparsed args to add_ceph_test()
this allows us to pass extra argument to the script or executable to
further customize its behavior when testing.

also fix all the callers of add_ceph_unittest(), as there is no need to
repeat the executable, which is also used as the name of the test.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-30 17:33:56 +08:00
Kefu Chai
1a422d4478 cmake: pass PARALLEL to add_ceph_unittest()
and parse it using cmake_parse_arguments(), more flexible this way.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-30 16:44:32 +08:00
Kefu Chai
6152076c22
Merge pull request #40336 from tchaikov/wip-cmake-fio
cmake: pass compile options by fio interface library

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2021-03-26 09:28:31 +08:00
Kefu Chai
47cec18613 cmake: use fixture for preparing venv
this change should allow us to decouple "ninja tests" from "ctest".
in other words, we can just run

ctest -R run-tox-python-common -V

without running "ninja tests" first. before this change

${name}-venv is added as a dependency of "tests" target.

after this change,

setup-venv-for-${name} is added as a test, which is in turn a test of
run-tox-${name}, so we can just

ctest -R run-tox-${name}

now for preparing the venv and then testing the tox test of ${name}.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-24 22:19:31 +08:00
Kefu Chai
c190fee53d cmake: pass compile options by fio interface library
for better readability and maintainability

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-23 16:25:47 +08:00
Kefu Chai
897fd990bf cmake: use ninja job pool
to limit the parallel level of compile jobs which consumes lots of memory
to compile and/or link.

compile following targets with heavy_compile_pool.

* unittest_librbd
* crimson*
* ceph-dencoder

some of the .cc files in the target above use up to 6 GiB memory to
compile.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-21 15:52:13 +08:00
Patrick Donnelly
f7fa3b50c1
libcephsqlite: rework architecture and backend
This is a complete rewrite on top of SimpleRADOSStriper as well as the
API. The VFS is now a loadable extension as well.

Fixes: https://tracker.ceph.com/issues/40609
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2021-03-19 08:52:55 -07:00
Patrick Donnelly
eb52c869d5
cmake: improve build inst for cephsqlite
Notably, find SQLite and build the test code.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2021-03-19 08:52:54 -07:00
Kefu Chai
33d2964ae2 cmake: adapt FindBoost.cmake to our needs
the vanilla FindBoost.cmake pulled from cmake has couple assumptions
which do not hold in our environment. so address them case by case.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-19 20:35:51 +08:00
Kefu Chai
3aaedc8fdc cmake: add 1.75 to known versions
sync with
507710438d/Modules/FindBoost.cmake

for v1.75 support

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-19 20:35:51 +08:00
Kefu Chai
cfa20c33a7 cmake: silence "You are in 'detached HEAD' state" warning
git warns us when the repo is in 'detached HEAD' state, like:

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in
this state without impacting any branches by switching back to a branch.
...
Turn off this advice by setting config variable advice.detachedHead to
false

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-09 19:13:22 +08:00
Kefu Chai
aea8187cb3 cmake: define BUILD_BYPRODUCTS for Boost
so if a cmake generator needs any one of them, it knowns how to build
it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-09 19:13:22 +08:00
Kefu Chai
609644c645 cmake: do not specify CMAKE_GENERATOR for external projects
as per CMake document,

> Without this option, the same generator as the main build will be
> used.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-09 19:13:22 +08:00
Kefu Chai
c471d0081b cmake: use "" for no-op INSTALL_COMMAND
as suggested by CMake document, see
https://cmake.org/cmake/help/latest/module/ExternalProject.html

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-09 19:13:21 +08:00
Kefu Chai
0e83f0d333 cmake: define BUILD_BYPRODUCTS for spdk-ext
so if a cmake generator needs any one of them, it knowns how to build
it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-09 19:13:21 +08:00
Kefu Chai
aeb22b47a6 cmake: link libpmemobj against libpmem
libpmemobj should link against libpmem, but, in CMake, imported library
does not allow PRIVATE linkage. so pmem::pmem is added to the list of
INTERFACE_LINK_LIBRARIES.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-06 14:37:24 +08:00
Kefu Chai
48e4cd190f cmake: support COMPONENTS param in Findpmem.cmake
add two components: pmem and pmemobj to this package. so we can find
them and link against them in a more intuitive way.

before this change the COMPONENTS parameter passed to

find_package(pmem ...)

is dropped on the floor and ignored.

after this change, it is checked and taken into consideration.

also, in this change, the exposed variables are renamed from

PMEM_* to pmem_*

to be consistent with the package name. it's encouraged to be consistent
with the package name when it comes to the INCLUDE_DIR and LIBRARIES
variable names.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-03-06 12:25:37 +08:00
Kefu Chai
b502f69ca2 cmake: use NUMA for package name in FindNUMA.cmake
to address the warning from cmake, like

CMake Warning (dev) at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
  The package name passed to `find_package_handle_standard_args` (numa) does
  not match the name of the calling package (NUMA).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-02-14 23:11:33 +08:00
Sheng Mao
59a5f333fa cmake: don't pass ccache argument to RocksDB build
RocksDB's cmake has a similar logic to turn on ccache as the main cmake.
Currently BuildRocksDB.cmake explicitly passes ccache to RocksDB cmake
arguments as CMAKE_CXX_COMPILER_LAUNCHER. This causes a compilation error
on ccache 4.0, especially in make -j mode.

ccache: error: Recursive invocation (the name of the ccache binary must
be "ccache")

This commit lets cmake from RocksDB decide RULE_LAUNCH_COMPILE by itself.

Signed-off-by: Sheng Mao <shngmao@gmail.com>
2021-02-09 20:17:53 -07:00
Kefu Chai
d72c9205dc cmake: only display the result of checking nasm once
if nasm is able to emit AVX512 instructions, we can assume that it's
able to generate AVX2 instructions as well. so no need to print "Found
nasm" multiple times.

and by chaining mutual exclusive branches with "elseif", we can have
better readability.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-01-04 01:34:46 +08:00