[Lldb-commits] [lldb] r270854 - [cmake] Add a big warning about a libstdc++ issue
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Thu May 26 08:16:12 PDT 2016
Author: labath
Date: Thu May 26 10:16:11 2016
New Revision: 270854
URL: http://llvm.org/viewvc/llvm-project?rev=270854&view=rev
Log:
[cmake] Add a big warning about a libstdc++ issue
Summary:
Recent increase in the usage of std::weak_ptr has caused us to rediscover an issue in libstdc++
versions prior to 4.9 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59656>, which make this class
unusable without exceptions in the presence of multiple threads. It's virtualy impossible to work
around this issue without implementing our own shared_ptr/weak_ptr substitutes, which does not
seem like a good idea.
Therefore, I am adding a big CMake warning which warns you about this issue if you're attempting
a to do a build which is suceptible to this problem and suggests possible alternatives. Right
now, nothing spectacular will happen if you ignore this warning (all the crashes I have seen
occur during process shutdown), but there's no guarantee the situation will not change in the
future.
Reviewers: tberghammer, tfiala, nitesh.jain, omjavaid, emaste, krytarowski
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D20671
Modified:
lldb/trunk/cmake/modules/LLDBConfig.cmake
Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=270854&r1=270853&r2=270854&view=diff
==============================================================================
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Thu May 26 10:16:11 2016
@@ -1,3 +1,5 @@
+include(CheckCXXSymbolExists)
+
set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
set(LLDB_INCLUDE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include")
@@ -415,3 +417,25 @@ if (NOT LLDB_DISABLE_CURSES)
list(APPEND system_libs ${CURSES_LIBRARIES})
include_directories(${CURSES_INCLUDE_DIR})
endif ()
+
+check_cxx_symbol_exists("__GLIBCXX__" "string" LLDB_USING_LIBSTDCXX)
+if(LLDB_USING_LIBSTDCXX)
+ # There doesn't seem to be an easy way to check the library version. Instead, we rely on the
+ # fact that std::set did not have the allocator constructor available until version 4.9
+ check_cxx_source_compiles("
+ #include <set>
+ std::set<int> s = std::set<int>(std::allocator<int>());
+ int main() { return 0; }"
+ LLDB_USING_LIBSTDCXX_4_9)
+ if (NOT LLDB_USING_LIBSTDCXX_4_9 AND NOT LLVM_ENABLE_EH)
+ message(WARNING
+ "You appear to be linking to libstdc++ version lesser than 4.9 without exceptions "
+ "enabled. These versions of the library have an issue, which causes occasional "
+ "lldb crashes. See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59656> for "
+ "details. Possible courses of action are:\n"
+ "- use libstdc++ version 4.9 or newer\n"
+ "- use libc++ (via LLVM_ENABLE_LIBCXX)\n"
+ "- enable exceptions (via LLVM_ENABLE_EH)\n"
+ "- ignore this warning and accept occasional instability")
+ endif()
+endif()
More information about the lldb-commits
mailing list