From c1f96ba0025118605f29e015468460b05b06a515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 10 Jan 2018 09:38:20 +0200 Subject: [PATCH] Add -nostdinc++ when building libunwind If the libcxx headers already have been installed, adding -I$LIBCXX/include to the include path breaks some C standard headers. The libcxx installation provides e.g. stdlib.h, which does an #include_next . If the include path includes both $LIBCXX/include and the libcxx headers installed to the target sysroot, the #include_next will pick up the same header from the next include directory. And due to include guards, the second inclusion of the libcxx version of the header does nothing at all, instead of doing yet another #include_next for picking up the real version of the header. By adding -nostdinc++, we avoid the possibly installed version of these headers. This fixes rebuilding libunwind after libcxx has been built and installed. --- build-libcxx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-libcxx.sh b/build-libcxx.sh index 9b304e6..72baf19 100755 --- a/build-libcxx.sh +++ b/build-libcxx.sh @@ -55,7 +55,7 @@ for arch in $ARCHS; do -DLIBUNWIND_ENABLE_THREADS=TRUE \ -DLIBUNWIND_ENABLE_SHARED=FALSE \ -DLIBUNWIND_ENABLE_CROSS_UNWINDING=FALSE \ - -DCMAKE_CXX_FLAGS="-I$LIBCXX/include" \ + -DCMAKE_CXX_FLAGS="-nostdinc++ -I$LIBCXX/include" \ .. make -j$CORES make install