svn commit: r300917 - head/share/mk

Bryan Drewery bdrewery at FreeBSD.org
Sat May 28 23:10:09 UTC 2016


Author: bdrewery
Date: Sat May 28 23:10:07 2016
New Revision: 300917
URL: https://svnweb.freebsd.org/changeset/base/300917

Log:
  GCC XCC -isystem hack: Ensure CXX search =/usr/include/c++1/v1 first.
  
  The C++ header files must be searched before /usr/include.
  
  The original code in Makefile.inc1 did this before the change in r297271 to
  use -isystem.  The libc++ import in r300770 fixed the bug introduced in
  r297271 by swapping XCFLAGS and XCXXFLAGS ordering in CROSSENV.
  
  Moving the code from Makefile.inc1 to bsd.sys.mk in r300886 also made it
  more difficult to control the order of the flags.  CXXFLAGS is based on
  CFLAGS, so any additions to it will come after CFLAGS.  The CROSSENV
  code from Makefile.inc1 was such that it was ensured the CXXFLAGS came
  first by setting them directly in CXX.  Using CXXFLAGS+=-I would work
  here, but instead continue to use -isystem by adding it to CXX so it
  comes before CFLAGS.
  
  Reported by:	dim

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==============================================================================
--- head/share/mk/bsd.sys.mk	Sat May 28 22:42:56 2016	(r300916)
+++ head/share/mk/bsd.sys.mk	Sat May 28 23:10:07 2016	(r300917)
@@ -198,7 +198,11 @@ LDFLAGS+=	-L=/usr/lib
 # sysroot/usr/lib/libc++.so.
 .if ${CXXFLAGS:M-nostdinc++} == "" && ${CXXFLAGS:M-nostdlib} == ""
 CXXFLAGS+=	-std=c++11 \
-		-nostdinc++ -isystem =/usr/include/c++/v1
+		-nostdinc++
+# Need to ensure this path comes before the above -isystem =/usr/include.
+# CXXFLAGS is CFLAGS with extra added in, so there's no way to fix the
+# ordering otherwise.
+CXX+=		-isystem =/usr/include/c++/v1
 LDFLAGS+=	-L${OBJTOP}/lib/libc++
 .endif
 .endif	# --sysroot


More information about the svn-src-all mailing list