changeset 1266:a548dd9a5dbe

Fix c++ build with CLANG The c++ include directories were not picked up automatically and had to be added manually.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 26 Sep 2014 18:44:41 +0200
parents b18f08034c24
children d9ecf3a83620
files CMakeLists.txt INSTALL
diffstat 2 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Fri Sep 26 18:01:35 2014 +0200
+++ b/CMakeLists.txt	Fri Sep 26 18:44:41 2014 +0200
@@ -24,6 +24,8 @@
 
 if (USE_CLANG)
    message (STATUS "Using clang options to build trustbridge.")
+   # This is a bit of a hack but necessary on Ubuntu 14.4
+   include_directories(/usr/include/c++/4.8 /usr/include/x86_64-linux-gnu/c++/4.8/)
 endif()
 
 include(CTest)
@@ -138,8 +140,10 @@
 endif()
 
 # No chance to compile nss with -Werror
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
+if (NOT USE_CLANG)
+   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
+   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
+endif()
 
 # Cmake does not correctly identify gcc windres when cross compiling
 # making this line neccessary to set the correct flags for it.
--- a/INSTALL	Fri Sep 26 18:01:35 2014 +0200
+++ b/INSTALL	Fri Sep 26 18:44:41 2014 +0200
@@ -109,14 +109,25 @@
 
 CLANG
 =====
-Alternatively you can build trustbridge with CLANG:
+Alternatively you can build trustbridge with CLANG. This is a bit of a hack
+and does not use all the hardening flags. Building with CLANG is _NOT_ recommended
+but it can be useful for analysis of the code.
+
+As root install the required packages an perform an evil hack that fixes the c++
+build with clang on ubuntu:
+
+    apt-get install clang llvm
+    ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19 /usr/lib/x86_64-linux-gnu/libstdc++.so
+
+Now you can build trustbridge as user:
 
     mkdir build-clang
     cd build-clang
     CC=/usr/bin/clang \
     CXX=/usr/bin/clang++ \
     cmake .. -DCMAKE_PREFIX_PATH=$YOURPREFIX \
-    -DUSE_CLANG=TRUE
+    -DUSE_CLANG=TRUE \
+    -DCMAKE_VERBOSE_MAKEFILE=TRUE
 
 I386
 ====

http://wald.intevation.org/projects/trustbridge/