]> git.ipfire.org Git - thirdparty/openwrt.git/commit
toolchain: gcc: fix build error with Xcode 16.3 18467/head
authorGeorgi Valkov <gvalkov@gmail.com>
Mon, 14 Apr 2025 13:07:25 +0000 (16:07 +0300)
committerRobert Marko <robimarko@gmail.com>
Wed, 16 Apr 2025 12:38:34 +0000 (14:38 +0200)
commitd3bb23946e116b0a6e2b64039c6d58d7f1a589c0
treec9a415d85cf07016fb036aeb4990ea50b7199edf
parentdfb8115d0cc00d40f2884d3119b44f3da69c997a
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
Signed-off-by: Robert Marko <robimarko@gmail.com>
toolchain/gcc/patches-11.x/980-fix-build-error-with-Xcode-16.3.patch [new file with mode: 0644]
toolchain/gcc/patches-12.x/980-fix-build-error-with-Xcode-16.3.patch [new file with mode: 0644]
toolchain/gcc/patches-13.x/980-fix-build-error-with-Xcode-16.3.patch [new file with mode: 0644]
toolchain/gcc/patches-14.x/980-fix-build-error-with-Xcode-16.3.patch [new file with mode: 0644]