NetBSD Problem Report #59810
From diogo@mpb.localdomain Sun Nov 30 19:50:03 2025
Return-Path: <diogo@mpb.localdomain>
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 "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id B01651A9239
for <gnats-bugs@gnats.netbsd.org>; Sun, 30 Nov 2025 19:50:03 +0000 (UTC)
Message-Id: <20251130194012.3A47167AC7C2@mpb.localdomain>
Date: Sun, 30 Nov 2025 20:40:12 +0100 (CET)
From: db7@sdf.org
Reply-To: db7@sdf.org
To: gnats-bugs@gnats.netbsd.org
Cc: micha@NetBSD.org
Subject: avr-gcc: Compilation issues on Darwin toolchain
X-Send-Pr-Version: 3.113.1
X-GNATS-Notify:
>Number: 59810
>Category: pkg
>Synopsis: avr-gcc does not compile on recent macOS SDK >= 26.1.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: macos-pkg-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Nov 30 19:55:00 +0000 2025
>Last-Modified: Sun Nov 30 20:43:16 +0000 2025
>Originator: Diogo
>Release: Darwin 24.6.0
>Organization:
>Environment:
System: Darwin 24.6.0 Darwin Kernel Version 24.6.0: Wed Oct 15 21:12:21 PDT
2025; root:xnu-11417.140.69.703.14~1/RELEASE_X86_64 x86_64
>Description:
avr-gcc does not compile on recent macOS SDK >= 26.1. The issue is
related to the replacement of ctype.h with safe-ctype.h in the gcc 13.2
source. The safe-ctype.h header enforce that islower isalpha and other
functions are not used. However, the macOS SDK does use them causing the
compilation to fail.
>How-To-Repeat:
Simply run `bmake build`.
>Fix:
Below is a easy solution that adds a patch to the gcc source code,
disabling the replacement of islower, isalpha, etc on Darwin platform.
Index: cross/avr-gcc/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/cross/avr-gcc/Makefile,v
retrieving revision 1.51
diff -u -p -u -r1.51 Makefile
--- cross/avr-gcc/Makefile 26 Apr 2024 13:05:01 -0000 1.51
+++ cross/avr-gcc/Makefile 30 Nov 2025 19:26:00 -0000
@@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.51 2024/04/26 13:05:01 micha Exp $
DISTNAME= gcc-13.2.0
+PKGREVISION= 1
PKGNAME= ${DISTNAME:C/^/avr-/}
CATEGORIES= cross
MASTER_SITES= ${MASTER_SITE_GNU:=gcc/${DISTNAME}/}
Index: cross/avr-gcc/distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/cross/avr-gcc/distinfo,v
retrieving revision 1.17
diff -u -p -u -r1.17 distinfo
--- cross/avr-gcc/distinfo 26 Apr 2024 13:05:01 -0000 1.17
+++ cross/avr-gcc/distinfo 30 Nov 2025 19:26:00 -0000
@@ -5,4 +5,5 @@ SHA512 (gcc-13.2.0.tar.gz) = 41c8c77ac5c
Size (gcc-13.2.0.tar.gz) = 153347847 bytes
SHA1 (patch-gcc_config_nvptx_gen-opt.sh) = e57ddb20c40929328bbc4da696d60403925cb99d
SHA1 (patch-gcc_configure) = 7607ef87ef4282909d3c83cc2236f6798ca0e90f
+SHA1 (patch-include_safe-ctype.h) = 0711ec7be0b10684a5c0439ec836b32a55237d18
SHA1 (patch-libgcc_libgcov.h) = 1fe3a2b55bac15ea1332040462675755945f5b05
Index: cross/avr-gcc/patches/patch-include_safe-ctype.h
===================================================================
RCS file: cross/avr-gcc/patches/patch-include_safe-ctype.h
diff -N cross/avr-gcc/patches/patch-include_safe-ctype.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ cross/avr-gcc/patches/patch-include_safe-ctype.h 30 Nov 2025 19:26:00 -0000
@@ -0,0 +1,21 @@
+$NetBSD$
+
+On Darwin, disable the replacement of isalpha, islower, ... tolower.
+
+--- include/safe-ctype.h.orig 2025-11-30 10:36:38.750803320 +0000
++++ include/safe-ctype.h
+@@ -120,6 +120,7 @@ extern const unsigned char _sch_tolower
+ So we include ctype.h here and then immediately redefine its macros. */
+
+ #include <ctype.h>
++#if !defined(__APPLE__)
+ #undef isalpha
+ #define isalpha(c) do_not_use_isalpha_with_safe_ctype
+ #undef isalnum
+@@ -146,5 +147,6 @@ extern const unsigned char _sch_tolower
+ #define toupper(c) do_not_use_toupper_with_safe_ctype
+ #undef tolower
+ #define tolower(c) do_not_use_tolower_with_safe_ctype
++#endif
+
+ #endif /* SAFE_CTYPE_H */
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->macos-pkg-people
Responsible-Changed-By: leot@NetBSD.org
Responsible-Changed-When: Sun, 30 Nov 2025 20:43:16 +0000
Responsible-Changed-Why:
macOS problem
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.