kernel: set MACOSX_DEPLOYMENT_TARGET to host version

Fix a warning interpreted as error when building the Linux kernel
on macOS host, by setting MACOSX_DEPLOYMENT_TARGET to the version
of the host. Fixes:

make[5]: Entering directory '/Volumes/test/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-6.18.38'
  HOSTCC  scripts/mod/modpost.o
scripts/mod/modpost.c:1719:9: error: 'strchrnul' is only available on macOS 15.4 or newer [-Werror,-Wunguarded-availability-new]
 1719 |                 sep = strchrnul(namespace, ',');
      |                       ^~~~~~~~~

Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24251
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Georgi Valkov
2026-07-16 22:58:21 +02:00
committed by Robert Marko
parent 464560fc35
commit 6f703adcd3
+4
View File
@@ -121,6 +121,10 @@ ifneq (,$(KERNEL_CC))
KERNEL_MAKE_FLAGS += CC="$(KERNEL_CC)"
endif
ifeq ($(HOST_OS),Darwin)
KERNEL_MAKE_FLAGS += MACOSX_DEPLOYMENT_TARGET="$(shell sw_vers -productVersion)"
endif
KERNEL_NOSTDINC_FLAGS = \
-nostdinc $(if $(DUMP),, -isystem $(shell $(TARGET_CC) -print-file-name=include))