From 1b89301d3b0ea22c0f3f290317b358aad9d41f3c Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Fri, 25 Mar 2016 19:12:41 +0000 Subject: [PATCH] Update flags for external GCC. - The -L WORLDTMP/usr/lib is not needed as GCC is already adding in -L =/usr/lib internally with --sysroot. It does not do this for header include paths though, thus passing -isystem =/usr/include is still needed. For the forced libc++ usage: - Use -isystem rather than -I for libc++ headers. - Use -std=c++11 rather than gnu++11. - Use -nostdinc++ to ensure GCC's headers don't leak in. Sponsored by: EMC / Isilon Storage Division --- Makefile.inc1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 135d9bf4d427..fddb06e27460 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -432,8 +432,11 @@ TARGET_ABI= gnueabi .endif .endif .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc -XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib -XCXXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++ +# GCC requires -isystem when using a cross-compiler. +XCFLAGS+= -isystem ${WORLDTMP}/usr/include +# Force using libc++ for external GCC. +XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \ + -nostdinc++ -L${WORLDTMP}/../lib/libc++ # XXX: DEPFLAGS is a workaround for not properly passing CXXFLAGS to sub-makes # due to CXX="${XCXX} ${XCXXFLAGS}". bsd.dep.mk does use CXXFLAGS when # building C++ files so this can come out if passing CXXFLAGS down is fixed.