* [PATCH] Forbid -DENABLE_ASAN=ON with GCC explicitly
@ 2018-12-23 2:00 Alexander Turenko
2018-12-24 11:26 ` Vladimir Davydov
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Turenko @ 2018-12-23 2:00 UTC (permalink / raw)
To: Vladimir Davydov; +Cc: Alexander Turenko, tarantool-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-24 11:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-23 2:00 [PATCH] Forbid -DENABLE_ASAN=ON with GCC explicitly Alexander Turenko
2018-12-24 11:26 ` Vladimir Davydov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox