From 767dcfe48d2e2acce4c6539d8c5169a3d3b5dec9 Mon Sep 17 00:00:00 2001 From: mstembera <5421953+mstembera@users.noreply.github.com> Date: Sun, 26 Apr 2026 09:32:56 +0200 Subject: [PATCH] Fix Universal build on Windows TRACKED_TOP previously used a shell pipeline (xargs, awk, sort) to extract unique top-level directory/file names from SRCS and HEADERS. When invoking make from cmd.exe on Windows, $(shell ...) uses cmd.exe rather than sh.exe, so the pipeline fails because cmd.exe does not support Unix pipe syntax. Other MSYS2 tools (e.g. the compiler) work fine because they are invoked directly as commands, not through a shell pipeline. This caused TRACKED_TOP to be empty, so ln -s never ran and the per-arch temp_builds subdirectories were left without a Makefile symlink, breaking the universal build with: "No rule to make target 'universal-object-nopgo'". Fixed by replacing the shell pipeline with pure GNU make built-in functions (sort, foreach, firstword, subst) which have no shell or PATH dependencies and work identically on Windows, Linux and macOS. closes https://github.com/official-stockfish/Stockfish/pull/6762 No functional change --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index e5226f95c..9b9aa9ffd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1268,7 +1268,7 @@ UNIVERSAL_ENTRY_OBJ := $(TEMP_DIR)/entry_x86.o NET_SENTINEL := $(TEMP_DIR)/.net-done # Top-level tracked items in src/ (directories and files) -TRACKED_TOP := $(shell echo "$(SRCS) $(HEADERS) Makefile incbin" | xargs -n1 | awk -F/ '{print $$1}' | sort -u) +TRACKED_TOP := $(sort $(foreach f,$(SRCS) $(HEADERS) Makefile incbin,$(firstword $(subst /, ,$(f))))) # Baseline x86-64 must come first in the final link (Windows --allow-multiple-definition # uses the first copy of inline duplicates)