From 7786c973308f678b069b78c62e152c996cadc284 Mon Sep 17 00:00:00 2001 From: redfish Date: Sun, 8 Oct 2017 18:32:15 -0400 Subject: [PATCH] cmake: add stdlib args for clang build on Linux Otherwise linking fails with undefined symbol ... basic_string ... and libstdc++: DSO not on included in link command. or with Host compiler must support std::atomic! which is due to undefined reference to `__gxx_personality_v0' and __cxa_begin_catch and std::terminate() This was already patched in 7b537a4e943c2a99db87d63c88c31443ebd1c6f4 PR #972 but it got lost, and also needed some tweaking. Thested with Clan 5.0.1 on Arch Linux (on armv7h). --- build/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index bc80423a..2658770c 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -184,6 +184,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # more tweaks if (NOT (MSVC OR MSYS OR APPLE)) + set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -stdlib=libstdc++" ) # required for + list(APPEND CMAKE_REQUIRED_LIBRARIES "stdc++") # required to link with -stdlib=libstdc++ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-const-variable -Wno-overloaded-virtual -Wno-c99-extensions" ) endif() endif ()