Re: HEADS UP: plan to switch many ports over to GCC 12 soon

Christoph Badura <[email protected]>
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
On Mon, Jun 17, 2024 at 06:58:42AM -0500, Jason Bacon wrote:
> On 6/16/24 16:59, Thomas Klausner wrote:
> >On Sun, Jun 16, 2024 at 06:40:22AM +1000, Matthew Green wrote:
> >>enjoy and send-pr or email tech-toolchain@ for any issues.
> 
> gcc12 still doesn't build on macOS.

For me gcc/usr.bin/host-libcpp failed to build on macOS 12.7.

Stuff like:
src/external/gpl3/gcc/dist/libcpp/include/line-map.h:1677:44: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
src/external/gpl3/gcc/dist/libcpp/include/cpplib.h:319:13: warning: commas at the end of enumerator lists are a C++11 extension [-Wc++11-extensions]
src/external/gpl3/gcc/dist/libcpp/include/cpplib.h:1144:6: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
etc.

A patch similar what David Gutteridge did on r1.113 of src/tools/gcc/Makefile
fixed that.

diff --git a/external/gpl3/gcc/usr.bin/host-libcpp/Makefile b/external/gpl3/gcc/usr.bin/host-libcpp/Makefile
index 77ea9e0b2ba..e7968c85f55 100644
--- a/external/gpl3/gcc/usr.bin/host-libcpp/Makefile
+++ b/external/gpl3/gcc/usr.bin/host-libcpp/Makefile
@@ -1,5 +1,7 @@
 #	$NetBSD: Makefile,v 1.6 2023/05/19 10:42:34 lukem Exp $
 
+.include <bsd.init.mk>
+
 BUILD_ENV= \
 		AR=${HOST_AR:Q} \
 		AWK=${TOOL_AWK:Q} \
@@ -19,6 +21,12 @@ BUILD_ENV= \
 		RANLIB=${HOST_RANLIB:Q} \
 		YACC=${YACC:Q}
 
+# Force C++11 so builds succeed on hosts where this isn't the compiler
+# default, e.g., NetBSD 8.x with GCC 5.5.
+.if ${HAVE_GCC} > 10
+HOST_CXXFLAGS+=		-std=c++11
+.endif
+
 GMAKE_J_ARGS?=	${MAKEFLAGS:[*]:M*-j*:C/(^|.* )(-j ?[0-9][0-9]*).*/\2/W}
 BUILD_COMMAND=	/usr/bin/env -i ${BUILD_ENV} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e
 
I'll commit that if there are no objections.
--chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.