mirror of
https://github.com/ceph/ceph
synced 2025-02-17 07:57:44 +00:00
cmake/modules/BuildRocksDB.cmake: inherit CMAKE_C_COMPILER from parent
if we set the CFLAGS globally, and the CFLAGS contains options only acceptable by a certain C compiler, RocksDB could fail to configure. for instance, if we set CXXFLAGS so it contains `--config /usr/lib/rpm/redhat/redhat-hardened-clang.cfg` and use clang++ as the CMAKE_CXX_COMPILER, while keep CMAKE_C_COMPILER unchanged. RocksDB would fail to configure like: ```-- Check for working C compiler: /usr/bin/cc - broken CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message): The C compiler "/usr/bin/cc" is not able to compile a simple test program. It fails with the following output: Change Dir: /home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos9/DIST/centos9/MACHINE_SIZE/gigantic/release/19.0.0-1717-g0f726187/rpm/el9/BUILD/ceph-19.0.0-1717-g0f726187/redhat-linux-build/src/rocksdb/CMakeFiles/CMakeScratch/TryCompile-RU5UFV Run Build Command(s):/usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_65e36/fast && gmake[3]: Entering directory '/home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos9/DIST/centos9/MACHINE_SIZE/gigantic/release/19.0.0-1717-g0f726187/rpm/el9/BUILD/ceph-19.0.0-1717-g0f726187/redhat-linux-build/src/rocksdb/CMakeFiles/CMakeScratch/TryCompile-RU5UFV' /usr/bin/gmake -f CMakeFiles/cmTC_65e36.dir/build.make CMakeFiles/cmTC_65e36.dir/build gmake[4]: Entering directory '/home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos9/DIST/centos9/MACHINE_SIZE/gigantic/release/19.0.0-1717-g0f726187/rpm/el9/BUILD/ceph-19.0.0-1717-g0f726187/redhat-linux-build/src/rocksdb/CMakeFiles/CMakeScratch/TryCompile-RU5UFV' Building C object CMakeFiles/cmTC_65e36.dir/testCCompiler.c.o /usr/bin/cc -O2 -flto=thin -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_GLIBCXX_ASSERTIONS --config /usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIE -o CMakeFiles/cmTC_65e36.dir/testCCompiler.c.o -c /home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos9/DIST/centos9/MACHINE_SIZE/gigantic/release/19.0.0-1717-g0f726187/rpm/el9/BUILD/ceph-19.0.0-1717-g0f726187/redhat-linux-build/src/rocksdb/CMakeFiles/CMakeScratch/TryCompile-RU5UFV/testCCompiler.c cc: error: unrecognized command-line option ‘--config’; did you mean ‘-mpconfig’? gmake[4]: *** [CMakeFiles/cmTC_65e36.dir/build.make:78: CMakeFiles/cmTC_65e36.dir/testCCompiler.c.o] Error 1 ``` where RocksDB tries to check C compiler -- /usr/bin/cc along with the said CFLAGS, and fails to compile the test C program, because GCC does not support this option. so, in this change, let's pass the CMAKE_C_COMPILER as well. Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
parent
8c92912b7d
commit
af6bb91505
@ -24,6 +24,7 @@ function(build_rocksdb)
|
||||
endif()
|
||||
|
||||
list(APPEND rocksdb_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
|
||||
list(APPEND rocksdb_CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER})
|
||||
|
||||
list(APPEND rocksdb_CMAKE_ARGS -DWITH_SNAPPY=${SNAPPY_FOUND})
|
||||
if(SNAPPY_FOUND)
|
||||
|
Loading…
Reference in New Issue
Block a user