From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Alexander Turenko Subject: [PATCH] Forbid -DENABLE_ASAN=ON with GCC explicitly Date: Sun, 23 Dec 2018 05:00:50 +0300 Message-Id: <438b199fa05278d9be0572c47e3c773ba23ab147.1545529816.git.alexander.turenko@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: Vladimir Davydov Cc: Alexander Turenko , tarantool-patches@freelists.org List-ID: The build time error is confusing for users. The patch makes the error explicit and moves it to the cmake stage. Follow up of #3070. --- It is simple fixup to bring a user's attention to the configuration error and push (s)he to do full cleanup and use clang. To be honest, I don't know why luajit cannot be compiled with -fsanitize=address with GCC. It is smth with always inline attribute, there is the example in [1]. https://github.com/tarantool/tarantool/tree/Totktonada/gh-3070-forbid-asan-on-gcc https://github.com/tarantool/tarantool/issues/3070#issuecomment-449327136 Please, push to 2.1 and 1.10 branches. [1]: https://github.com/tarantool/tarantool/issues/3070#issuecomment-449297693 cmake/profile.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/profile.cmake b/cmake/profile.cmake index 3e8f1499b..0ba31fa2c 100644 --- a/cmake/profile.cmake +++ b/cmake/profile.cmake @@ -44,7 +44,14 @@ endif() option(ENABLE_ASAN "Enable AddressSanitizer, a fast memory error detector based on compiler instrumentation" OFF) if (ENABLE_ASAN) - add_compile_flags("C;CXX" -fsanitize=address) + if (CMAKE_COMPILER_IS_GNUCC) + message(FATAL_ERROR + "\n" + " Tarantool does not support GCC's AddressSanitizer. Use clang:\n" + " $ git clean -xfd; git submodule foreach --recursive git clean -xfd\n" + " $ CC=clang CXX=clang++ cmake . <...> -DENABLE_ASAN=ON && make -j\n" + "\n") + endif() set(CMAKE_REQUIRED_FLAGS "-fsanitize=address") check_c_source_compiles("int main(void) { @@ -68,4 +75,6 @@ if (ENABLE_ASAN) else() message(FATAL_ERROR "Cannot enable AddressSanitizer") endif() + + add_compile_flags("C;CXX" -fsanitize=address) endif() -- 2.20.0