Skip to content

Commit 5bf560c

Browse files
config.mak.uname: avoid macOS dup-library warning
Building on macOS with Xcode 15 or newer emits: ld: warning: ignoring duplicate libraries: 'libgit.a', 'target/release/libgitcore.a' Some link recipes list the same archive twice, which is harmless. Quiet the warning instead. Pass -Wl,-no_warn_duplicate_libraries on Xcode 15 and newer, whose linkers added both the warning and the suppression flag (ld64-907 and dyld-1009). Earlier linkers reject the flag, so gate on the linker version. Broaden the existing -fno-common version probe to also match the "ld64-NNN" and "dyld-NNN" forms Xcode 15 reports. Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
1 parent 95e2021 commit 5bf560c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

config.mak.uname

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,15 @@ ifeq ($(uname_S),Darwin)
173173
NEEDS_GOOD_LIBICONV = UnfortunatelyYes
174174
endif
175175

176-
# Silence Xcode 16.3+ linker warning about __DATA,__common alignment.
177-
LD_MAJOR_VERSION = $(shell ld -v 2>&1 | sed -n 's/.*PROJECT:ld-\([0-9]*\).*/\1/p')
176+
# ld reports "PROJECT:{ld,ld64,dyld}-NNN", match any of the three.
177+
LD_MAJOR_VERSION = $(shell ld -v 2>&1 | sed -n 's/.*PROJECT:[^ ]*-\([0-9][0-9]*\).*/\1/p')
178+
179+
# Silence the Xcode 15+ warning about archives listed more than once.
180+
ifeq ($(shell test -n "$(LD_MAJOR_VERSION)" && test "$(LD_MAJOR_VERSION)" -ge 907 && echo 1),1)
181+
BASIC_LDFLAGS += -Wl,-no_warn_duplicate_libraries
182+
endif
183+
184+
# Silence the Xcode 16.3+ warning about __DATA,__common alignment.
178185
ifeq ($(shell test -n "$(LD_MAJOR_VERSION)" && test "$(LD_MAJOR_VERSION)" -ge 1167 && echo 1),1)
179186
BASIC_CFLAGS += -fno-common
180187
endif

0 commit comments

Comments
 (0)