mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-01 04:26:48 +00:00
Merge 'cmake: sync with configure.py (16/n)' from Kefu Chai
this is the 15th changeset of a series which tries to give an overhaul to the CMake building system. this series has two goals:
- to enable developer to use CMake for building scylla. so they can use tools (CLion for instance) with CMake integration for better developer experience
- to enable us to tweak the dependencies in a simpler way. a well-defined cross module / subsystem dependency is a prerequisite for building this project with the C++20 modules.
also, i just found that the scylla executable built with cmake building system segfault in master HEAD. like
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==3974496==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000000000 bp 0x7ffd48549f70 sp 0x7ffd48549728 T0)
==3974496==Hint: pc points to the zero page.
==3974496==The signal is caused by a READ memory access.
==3974496==Hint: address points to the zero page.
#0 0x0 (<unknown module>)
#1 0x14e785a5 in wasmtime_runtime::traphandlers::unix::trap_handler::h1f510afc2968497f /home/kefu/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-7a04d2510079875b/wasmtime-runtime-5.0.1/src/traphandlers/unix.rs:159:9
#2 0x7f3462e5eb9f (/lib64/libc.so.6+0x3db9f) (BuildId: 6107835fa7d4725691b2b7f6aaee7abe09f493b2)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (<unknown module>)
==3974496==ABORTING
Aborting on shard 0.
Backtrace:
0xd16c38a
0x13c5aab0
0x13b9821e
0x13c2fdc7
/lib64/libc.so.6+0x3db9f
/lib64/libc.so.6+0x8eb93
/lib64/libc.so.6+0x3daed
/lib64/libc.so.6+0x2687e
0xd1e5f8a
0xd1e3d34
0xd1ca059
0xd1c5e29
0xd1c5605
0x14e785a5
/lib64/libc.so.6+0x3db9f
```
decoded:
```
__interceptor_backtrace at ??:?
void seastar::backtrace<seastar::backtrace_buffer::append_backtrace()::{lambda(seastar::frame)#1}>(seastar::backtrace_buffer::append_backtrace()::{lambda(seastar::frame)#1}&&) at /home/kefu/dev/scylladb/seastar/include/seastar/util/backtrace.hh:60
seastar::backtrace_buffer::append_backtrace() at /home/kefu/dev/scylladb/seastar/src/core/reactor.cc:778
(inlined by) seastar::print_with_backtrace(seastar::backtrace_buffer&, bool) at /home/kefu/dev/scylladb/seastar/src/core/reactor.cc:808
seastar::print_with_backtrace(char const*, bool) at /home/kefu/dev/scylladb/seastar/src/core/reactor.cc:820
(inlined by) seastar::sigabrt_action() at /home/kefu/dev/scylladb/seastar/src/core/reactor.cc:3882
(inlined by) operator() at /home/kefu/dev/scylladb/seastar/src/core/reactor.cc:3858
(inlined by) __invoke at /home/kefu/dev/scylladb/seastar/src/core/reactor.cc:3854
/lib64/libc.so.6: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=6107835fa7d4725691b2b7f6aaee7abe09f493b2, for GNU/Linux 3.2.0, not stripped
__GI___sigaction at :?
__pthread_kill_implementation at ??:?
__GI_raise at :?
__GI_abort at :?
__sanitizer::Abort() at ??:?
__sanitizer::Die() at ??:?
__asan::ScopedInErrorReport::~ScopedInErrorReport() at ??:?
__asan::ReportDeadlySignal(__sanitizer::SignalContext const&) at ??:?
__asan::AsanOnDeadlySignal(int, void*, void*) at ??:?
wasmtime_runtime::traphandlers::unix::trap_handler at /home/kefu/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-7a04d2510079875b/wasmtime-runtime-5.0.1/src/traphandlers/unix.rs:159
__GI___sigaction at :?
```
this led me to this change. but unfortunately, this changeset does not address the segfault. will continue the investigation in my free cycles.
Closes #13434
* github.com:scylladb/scylladb:
build: cmake: include cxx.h with relative path
build: cmake: set stack frame limits
build: cmake: pass -fvisibility=hidden to compiler
build: cmake: use -O0 on aarch64, otherwise -Og
This commit is contained in:
@@ -14,8 +14,8 @@ set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
||||
"Debug" "Release" "Dev" "Sanitize")
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" build_mode)
|
||||
include(mode.common)
|
||||
include(mode.${build_mode})
|
||||
include(mode.common)
|
||||
add_compile_definitions(
|
||||
${Seastar_DEFINITIONS_${build_mode}}
|
||||
FMT_DEPRECATED_OSTREAM)
|
||||
@@ -23,6 +23,7 @@ include(limit_jobs)
|
||||
# Configure Seastar compile options to align with Scylla
|
||||
set(CMAKE_CXX_STANDARD "20" CACHE INTERNAL "")
|
||||
set(CMAKE_CXX_EXTENSIONS ON CACHE INTERNAL "")
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
set(Seastar_TESTING ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory(seastar)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
|
||||
# -fasan -Og breaks some coroutines on aarch64, use -O0 instead
|
||||
set(default_Seastar_OptimizationLevel_DEBUG "g")
|
||||
else()
|
||||
set(default_Seastar_OptimizationLevel_DEBUG "0")
|
||||
else()
|
||||
set(default_Seastar_OptimizationLevel_DEBUG "g")
|
||||
endif()
|
||||
set(Seastar_OptimizationLevel_DEBUG
|
||||
${default_Seastar_OptimizationLevel_DEBUG}
|
||||
@@ -19,3 +19,5 @@ set(Seastar_DEFINITIONS_DEBUG
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG
|
||||
" -O${Seastar_OptimizationLevel_DEBUG} -g -gz")
|
||||
|
||||
set(stack_usage_threshold_in_KB 40)
|
||||
|
||||
@@ -12,3 +12,5 @@ set(Seastar_DEFINITIONS_DEV
|
||||
DEVEL
|
||||
SEASTAR_ENABLE_ALLOC_FAILURE_INJECTION
|
||||
SCYLLA_ENABLE_ERROR_INJECTION)
|
||||
|
||||
set(stack_usage_threshold_in_KB 21)
|
||||
|
||||
@@ -23,3 +23,5 @@ set(Seastar_DEFINITIONS_DEBUG
|
||||
|
||||
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE
|
||||
"-Wl,--gc-sections")
|
||||
|
||||
set(stack_usage_threshold_in_KB 13)
|
||||
|
||||
@@ -30,3 +30,10 @@ default_target_arch(target_arch)
|
||||
if(target_arch)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -march=${target_arch}")
|
||||
endif()
|
||||
|
||||
math(EXPR _stack_usage_threshold_in_bytes "${stack_usage_threshold_in_KB} * 1024")
|
||||
set(_stack_usage_threshold_flag "-Wstack-usage=${_stack_usage_threshold_in_bytes}")
|
||||
check_cxx_compiler_flag(${_stack_usage_threshold_flag} _stack_usage_flag_supported)
|
||||
if(_stack_usage_flag_supported)
|
||||
string(APPEND CMAKE_CXX_FLAGS " ${_stack_usage_threshold_flag}")
|
||||
endif()
|
||||
|
||||
@@ -40,7 +40,7 @@ function(generate_cxxbridge name)
|
||||
set(outputs ${header} ${source})
|
||||
set(command ${CXXBRIDGE} ${input} --include ${parsed_args_INCLUDE})
|
||||
add_custom_command(
|
||||
DEPENDS ${input} ${include}
|
||||
DEPENDS ${input}
|
||||
OUTPUT ${outputs}
|
||||
COMMAND ${command} --header --output ${header}
|
||||
COMMAND ${command} --output ${source})
|
||||
@@ -59,7 +59,7 @@ add_custom_command(
|
||||
COMMAND ${CXXBRIDGE} --header --output ${cxx_header})
|
||||
generate_cxxbridge(wasmtime_bindings
|
||||
INPUT wasmtime_bindings/src/lib.rs
|
||||
INCLUDE ${cxx_header}
|
||||
INCLUDE rust/cxx.h
|
||||
OUTPUT_DIR "${binding_gen_build_dir}"
|
||||
SOURCES wasmtime_bindings_sources)
|
||||
|
||||
@@ -72,7 +72,7 @@ target_sources(wasmtime_bindings
|
||||
${cxx_header}
|
||||
${wasmtime_bindings_sources})
|
||||
target_include_directories(wasmtime_bindings
|
||||
INTERFACE
|
||||
PUBLIC
|
||||
${scylla_gen_build_dir})
|
||||
target_link_libraries(wasmtime_bindings
|
||||
INTERFACE Rust::rust_combined)
|
||||
@@ -80,7 +80,7 @@ target_link_libraries(wasmtime_bindings
|
||||
# only for testing
|
||||
generate_cxxbridge(inc
|
||||
INPUT inc/src/lib.rs
|
||||
INCLUDE ${cxx_header}
|
||||
INCLUDE rust/cxx.h
|
||||
OUTPUT_DIR "${binding_gen_build_dir}"
|
||||
SOURCES inc_sources)
|
||||
|
||||
@@ -90,7 +90,7 @@ target_sources(inc
|
||||
${cxx_header}
|
||||
${inc_sources})
|
||||
target_include_directories(inc
|
||||
INTERFACE
|
||||
PUBLIC
|
||||
${scylla_gen_build_dir})
|
||||
target_link_libraries(inc
|
||||
INTERFACE Rust::rust_combined)
|
||||
|
||||
Reference in New Issue
Block a user