summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorgi Valkov2025-04-14 13:07:25 +0000
committerRobert Marko2025-06-12 08:51:01 +0000
commitf90e7a73970f4864a0e8ec1ac3803861606d7b5d (patch)
treed15b04075fa7dcd443901811123171ee32c8ab06
parent9d3ca6d3e537b4c1d73b0337ea83f377982d4e58 (diff)
downloadopenwrt-f90e7a73970f4864a0e8ec1ac3803861606d7b5d.tar.gz
toolchain: gcc: fix build error with Xcode 16.3
Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions. zutil.h conditionally defines fdopen as NULL when this macro is defined, resulting in the following build error: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: e> 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen)); | ^ ./zutil.h:147:33: note: expanded from macro 'fdopen' 147 | # define fdopen(fd,mode) NULL /* No fdopen() */ In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire block was ignored, gcc and gdb used to compile and work fine. This may have been used for compatibility with older versions of macOS, but is no longer needed. By pure luck, the build worked fine for a long time, because it did not properly detect macOS. Fixed by removing the check for TARGET_OS_MAC. Note that since Xcode 16.3, an entire set of TARGET_OS macros are now defined, most of which are set to 0: TARGET_OS_LINUX 0 TARGET_OS_MAC 1 TARGET_OS_OSX 1 Signed-off-by: Georgi Valkov <gvalkov@gmail.com> Link: https://github.com/openwrt/openwrt/pull/18467 (cherry picked from commit d3bb23946e116b0a6e2b64039c6d58d7f1a589c0) Link: https://github.com/openwrt/openwrt/pull/19096 Signed-off-by: Robert Marko <robimarko@gmail.com>
-rw-r--r--toolchain/gcc/patches-11.x/980-fix-build-error-with-Xcode-16.3.patch52
-rw-r--r--toolchain/gcc/patches-12.x/980-fix-build-error-with-Xcode-16.3.patch52
-rw-r--r--toolchain/gcc/patches-13.x/980-fix-build-error-with-Xcode-16.3.patch52
-rw-r--r--toolchain/gcc/patches-14.x/980-fix-build-error-with-Xcode-16.3.patch52
4 files changed, 208 insertions, 0 deletions
diff --git a/toolchain/gcc/patches-11.x/980-fix-build-error-with-Xcode-16.3.patch b/toolchain/gcc/patches-11.x/980-fix-build-error-with-Xcode-16.3.patch
new file mode 100644
index 0000000000..3f4cdd5726
--- /dev/null
+++ b/toolchain/gcc/patches-11.x/980-fix-build-error-with-Xcode-16.3.patch
@@ -0,0 +1,52 @@
+From 93954654b87552c4fe0273cab99d0f42f213f7f8 Mon Sep 17 00:00:00 2001
+From: Georgi Valkov <gvalkov@gmail.com>
+Date: Mon, 14 Apr 2025 15:45:59 +0300
+Subject: [PATCH] zlib: fix build error with Xcode 16.3
+
+Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions.
+zutil.h conditionally defines fdopen as NULL when this macro is defined,
+resulting in the following build error:
+
+/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '('
+ 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
+ | ^
+./zutil.h:147:33: note: expanded from macro 'fdopen'
+ 147 | # define fdopen(fd,mode) NULL /* No fdopen() */
+
+In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire
+block was ignored, gcc and gdb used to compile and work fine.
+
+This may have been used for compatibility with older versions of macOS,
+but is no longer needed. By pure luck, the build worked fine for a long
+time, because it did not properly detect macOS.
+Fixed by removing the check for TARGET_OS_MAC.
+
+Note that since Xcode 16.3, an entire set of TARGET_OS macros
+are now defined, most of which are set to 0:
+TARGET_OS_LINUX 0
+TARGET_OS_MAC 1
+TARGET_OS_OSX 1
+
+[1] https://github.com/openwrt/openwrt/pull/18467
+
+Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
+---
+ zlib/zutil.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/zlib/zutil.h b/zlib/zutil.h
+index 4b596adf629..9ea8d840643 100644
+--- a/zlib/zutil.h
++++ b/zlib/zutil.h
+@@ -130,7 +130,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+ # endif
+ #endif
+
+-#if defined(MACOS) || defined(TARGET_OS_MAC)
++#if defined(MACOS)
+ # define OS_CODE 7
+ # ifndef Z_SOLO
+ # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+--
+2.49.0
+
diff --git a/toolchain/gcc/patches-12.x/980-fix-build-error-with-Xcode-16.3.patch b/toolchain/gcc/patches-12.x/980-fix-build-error-with-Xcode-16.3.patch
new file mode 100644
index 0000000000..3f4cdd5726
--- /dev/null
+++ b/toolchain/gcc/patches-12.x/980-fix-build-error-with-Xcode-16.3.patch
@@ -0,0 +1,52 @@
+From 93954654b87552c4fe0273cab99d0f42f213f7f8 Mon Sep 17 00:00:00 2001
+From: Georgi Valkov <gvalkov@gmail.com>
+Date: Mon, 14 Apr 2025 15:45:59 +0300
+Subject: [PATCH] zlib: fix build error with Xcode 16.3
+
+Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions.
+zutil.h conditionally defines fdopen as NULL when this macro is defined,
+resulting in the following build error:
+
+/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '('
+ 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
+ | ^
+./zutil.h:147:33: note: expanded from macro 'fdopen'
+ 147 | # define fdopen(fd,mode) NULL /* No fdopen() */
+
+In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire
+block was ignored, gcc and gdb used to compile and work fine.
+
+This may have been used for compatibility with older versions of macOS,
+but is no longer needed. By pure luck, the build worked fine for a long
+time, because it did not properly detect macOS.
+Fixed by removing the check for TARGET_OS_MAC.
+
+Note that since Xcode 16.3, an entire set of TARGET_OS macros
+are now defined, most of which are set to 0:
+TARGET_OS_LINUX 0
+TARGET_OS_MAC 1
+TARGET_OS_OSX 1
+
+[1] https://github.com/openwrt/openwrt/pull/18467
+
+Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
+---
+ zlib/zutil.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/zlib/zutil.h b/zlib/zutil.h
+index 4b596adf629..9ea8d840643 100644
+--- a/zlib/zutil.h
++++ b/zlib/zutil.h
+@@ -130,7 +130,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+ # endif
+ #endif
+
+-#if defined(MACOS) || defined(TARGET_OS_MAC)
++#if defined(MACOS)
+ # define OS_CODE 7
+ # ifndef Z_SOLO
+ # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+--
+2.49.0
+
diff --git a/toolchain/gcc/patches-13.x/980-fix-build-error-with-Xcode-16.3.patch b/toolchain/gcc/patches-13.x/980-fix-build-error-with-Xcode-16.3.patch
new file mode 100644
index 0000000000..3f4cdd5726
--- /dev/null
+++ b/toolchain/gcc/patches-13.x/980-fix-build-error-with-Xcode-16.3.patch
@@ -0,0 +1,52 @@
+From 93954654b87552c4fe0273cab99d0f42f213f7f8 Mon Sep 17 00:00:00 2001
+From: Georgi Valkov <gvalkov@gmail.com>
+Date: Mon, 14 Apr 2025 15:45:59 +0300
+Subject: [PATCH] zlib: fix build error with Xcode 16.3
+
+Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions.
+zutil.h conditionally defines fdopen as NULL when this macro is defined,
+resulting in the following build error:
+
+/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '('
+ 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
+ | ^
+./zutil.h:147:33: note: expanded from macro 'fdopen'
+ 147 | # define fdopen(fd,mode) NULL /* No fdopen() */
+
+In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire
+block was ignored, gcc and gdb used to compile and work fine.
+
+This may have been used for compatibility with older versions of macOS,
+but is no longer needed. By pure luck, the build worked fine for a long
+time, because it did not properly detect macOS.
+Fixed by removing the check for TARGET_OS_MAC.
+
+Note that since Xcode 16.3, an entire set of TARGET_OS macros
+are now defined, most of which are set to 0:
+TARGET_OS_LINUX 0
+TARGET_OS_MAC 1
+TARGET_OS_OSX 1
+
+[1] https://github.com/openwrt/openwrt/pull/18467
+
+Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
+---
+ zlib/zutil.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/zlib/zutil.h b/zlib/zutil.h
+index 4b596adf629..9ea8d840643 100644
+--- a/zlib/zutil.h
++++ b/zlib/zutil.h
+@@ -130,7 +130,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+ # endif
+ #endif
+
+-#if defined(MACOS) || defined(TARGET_OS_MAC)
++#if defined(MACOS)
+ # define OS_CODE 7
+ # ifndef Z_SOLO
+ # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+--
+2.49.0
+
diff --git a/toolchain/gcc/patches-14.x/980-fix-build-error-with-Xcode-16.3.patch b/toolchain/gcc/patches-14.x/980-fix-build-error-with-Xcode-16.3.patch
new file mode 100644
index 0000000000..3f4cdd5726
--- /dev/null
+++ b/toolchain/gcc/patches-14.x/980-fix-build-error-with-Xcode-16.3.patch
@@ -0,0 +1,52 @@
+From 93954654b87552c4fe0273cab99d0f42f213f7f8 Mon Sep 17 00:00:00 2001
+From: Georgi Valkov <gvalkov@gmail.com>
+Date: Mon, 14 Apr 2025 15:45:59 +0300
+Subject: [PATCH] zlib: fix build error with Xcode 16.3
+
+Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions.
+zutil.h conditionally defines fdopen as NULL when this macro is defined,
+resulting in the following build error:
+
+/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '('
+ 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
+ | ^
+./zutil.h:147:33: note: expanded from macro 'fdopen'
+ 147 | # define fdopen(fd,mode) NULL /* No fdopen() */
+
+In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire
+block was ignored, gcc and gdb used to compile and work fine.
+
+This may have been used for compatibility with older versions of macOS,
+but is no longer needed. By pure luck, the build worked fine for a long
+time, because it did not properly detect macOS.
+Fixed by removing the check for TARGET_OS_MAC.
+
+Note that since Xcode 16.3, an entire set of TARGET_OS macros
+are now defined, most of which are set to 0:
+TARGET_OS_LINUX 0
+TARGET_OS_MAC 1
+TARGET_OS_OSX 1
+
+[1] https://github.com/openwrt/openwrt/pull/18467
+
+Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
+---
+ zlib/zutil.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/zlib/zutil.h b/zlib/zutil.h
+index 4b596adf629..9ea8d840643 100644
+--- a/zlib/zutil.h
++++ b/zlib/zutil.h
+@@ -130,7 +130,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+ # endif
+ #endif
+
+-#if defined(MACOS) || defined(TARGET_OS_MAC)
++#if defined(MACOS)
+ # define OS_CODE 7
+ # ifndef Z_SOLO
+ # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+--
+2.49.0
+