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
This commit is contained in:
Bryan Drewery 2016-05-28 23:10:07 +00:00
parent 1176e2a818
commit c3c4167236

View File

@ -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