NetBSD Problem Report #60299

From diogo@mini.fritz.box  Thu May 28 08:55:38 2026
Return-Path: <diogo@mini.fritz.box>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "R13" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 013C11A9239
	for <gnats-bugs@gnats.netbsd.org>; Thu, 28 May 2026 08:55:37 +0000 (UTC)
Message-Id: <20260528085531.BE80F5372D79@mini.fritz.box>
Date: Thu, 28 May 2026 10:55:31 +0200 (CEST)
From: db7@sdf.org
Reply-To: db7@sdf.org
To: gnats-bugs@gnats.netbsd.org
Cc:
Subject: cross/avr-gcc: build on Darwin
X-Send-Pr-Version: 3.113.1
X-GNATS-Notify:
X-From4GNATS: "db7@sdf.org via gnats" <gnats-admin@NetBSD.org>

>Number:         60299
>Category:       pkg
>Synopsis:       avr-gcc does not build with latest xcode tools (v15)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 28 09:00:00 +0000 2026
>Originator:     Diogo
>Release:        Darwin 24.6.0
>Organization:
>Environment:
System: Darwin 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:34 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8103 arm64
	xcrun --show-sdk-version: 15.5

>Description:
	avr-gcc does not build with latest xcode tools (v15).
>How-To-Repeat:
	bmake -C /path/to/pkgsrc/cross/avr-gcc build
>Fix:
	Here is a simple patch to include Apple's libc++ headers before
	safe-ctype.h. That is sufficient to ensure the package gets built.

---

diff --git a/cross/avr-gcc/patches/patch-gcc_system.h b/cross/avr-gcc/patches/patch-gcc_system.h
new file mode 100644
index 000000000000..4ddfd6afc8cf
--- /dev/null
+++ b/cross/avr-gcc/patches/patch-gcc_system.h
@@ -0,0 +1,34 @@
+$NetBSD$
+
+Include Apple libc++ headers before GCC poisons ctype macros through
+safe-ctype.h. Newer libc++ pulls locale formatting declarations into headers
+such as <map> and <vector>, which exposes overloads like islower(char, locale)
+that collide with GCC's one-argument islower poison macro.
+
+--- gcc/system.h.orig	2023-07-27 08:13:03.000000000 +0000
++++ gcc/system.h
+@@ -194,13 +194,22 @@ extern int fprintf_unlocked (FILE *, con
+ #undef fread_unlocked
+ #undef fwrite_unlocked
+ 
+-/* Include <string> before "safe-ctype.h" to avoid GCC poisoning
+-   the ctype macros through safe-ctype.h */
++/* Include C++ standard library headers before "safe-ctype.h" to avoid GCC
++   poisoning the ctype macros through safe-ctype.h. */
+ 
+ #ifdef __cplusplus
+ #ifdef INCLUDE_STRING
+ # include <string>
+ #endif
++#ifdef INCLUDE_MAP
++# include <map>
++#endif
++#ifdef INCLUDE_VECTOR
++# include <vector>
++#endif
++#ifdef INCLUDE_MEMORY
++# include <memory>
++#endif
+ #endif
+ 
+ /* There are an extraordinary number of issues with <ctype.h>.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.