pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/59810: avr-gcc: Compilation issues on Darwin toolchain



	Note: There was a bad value `' for the field `Severity'.
	It was set to the default value of `serious'.

>Number:         59810
>Category:       pkg
>Synopsis:       avr-gcc does not compile on recent macOS SDK >= 26.1.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 30 19:55:00 +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 */


Home | Main Index | Thread Index | Old Index