commit 8b0c8fd: [Minor] Toolset: Use libc++ as libstdc++ is broken on old compilers

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Feb 9 16:28:06 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-02-09 16:26:54 +0000
URL: https://github.com/rspamd/rspamd/commit/8b0c8fd52e5c404a2fef132495d0a6ffd3174323 (HEAD -> master)

[Minor] Toolset: Use libc++ as libstdc++ is broken on old compilers

---
 cmake/Toolset.cmake                 | 6 ++++--
 src/libserver/css/css_tokeniser.hxx | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/cmake/Toolset.cmake b/cmake/Toolset.cmake
index d54abb795..5a4faebf2 100644
--- a/cmake/Toolset.cmake
+++ b/cmake/Toolset.cmake
@@ -27,17 +27,19 @@ endif ()
 
 if (COMPILER_GCC)
     # Require minimum version of gcc
-    set (GCC_MINIMUM_VERSION 4)
+    set (GCC_MINIMUM_VERSION 8)
     if (CMAKE_C_COMPILER_VERSION VERSION_LESS ${GCC_MINIMUM_VERSION} AND NOT CMAKE_VERSION VERSION_LESS 2.8.9)
         message (FATAL_ERROR "GCC version must be at least ${GCC_MINIMUM_VERSION}.")
     endif ()
 elseif (COMPILER_CLANG)
     # Require minimum version of clang
-    set (CLANG_MINIMUM_VERSION 4)
+    set (CLANG_MINIMUM_VERSION 7)
     if (CMAKE_C_COMPILER_VERSION VERSION_LESS ${CLANG_MINIMUM_VERSION})
         message (FATAL_ERROR "Clang version must be at least ${CLANG_MINIMUM_VERSION}.")
     endif ()
     ADD_COMPILE_OPTIONS(-Wno-unused-command-line-argument)
+    # Use libc++ as libstdc++ is buggy in many cases
+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
 else ()
     message (WARNING "You are using an unsupported compiler ${CMAKE_C_COMPILER_ID}. Compilation has only been tested with Clang 4+ and GCC 4+.")
 endif ()
diff --git a/src/libserver/css/css_tokeniser.hxx b/src/libserver/css/css_tokeniser.hxx
index afe888a80..f1e9d05fc 100644
--- a/src/libserver/css/css_tokeniser.hxx
+++ b/src/libserver/css/css_tokeniser.hxx
@@ -102,6 +102,10 @@ struct css_parser_token {
 };
 
 /* Ensure that parser tokens are simple enough */
+/*
+ * compiler must implement P0602 "variant and optional should propagate copy/move triviality"
+ * This is broken on gcc < 8!
+ */
 static_assert(std::is_trivially_copyable_v<css_parser_token>);
 
 class css_tokeniser {


More information about the Commits mailing list