From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Alexander Turenko <alexander.turenko@tarantool.org>,
tarantool-patches@freelists.org
Subject: [PATCH] Forbid -DENABLE_ASAN=ON with GCC explicitly
Date: Sun, 23 Dec 2018 05:00:50 +0300 [thread overview]
Message-ID: <438b199fa05278d9be0572c47e3c773ba23ab147.1545529816.git.alexander.turenko@tarantool.org> (raw)
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
next reply other threads:[~2018-12-23 2:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-23 2:00 Alexander Turenko [this message]
2018-12-24 11:26 ` Vladimir Davydov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=438b199fa05278d9be0572c47e3c773ba23ab147.1545529816.git.alexander.turenko@tarantool.org \
--to=alexander.turenko@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=vdavydov.dev@gmail.com \
--subject='Re: [PATCH] Forbid -DENABLE_ASAN=ON with GCC explicitly' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox