From: "Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Harald Nordgren <haraldnordgren@gmail.com>,
Harald Nordgren <haraldnordgren@gmail.com>
Subject: [PATCH v3] config.mak.uname: avoid macOS dup-library warning
Date: Fri, 19 Jun 2026 20:32:07 +0000 [thread overview]
Message-ID: <pull.2314.v3.git.git.1781901127385.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2314.v2.git.git.1780610623006.gitgitgadget@gmail.com>
From: Harald Nordgren <haraldnordgren@gmail.com>
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>
---
Makefile: drop duplicate %.a from test-helper link rule
Fix warning of duplicate libraries on macOS.
Changes in v3:
* Suppress the warning at the linker rather than dedup the archive list
* Pass -Wl,-no_warn_duplicate_libraries in config.mak.uname, gated on
the linker version (reuses the probe added for -fno-common), and
broaden the regex to match all three PROJECT:{ld64,dyld,ld}-NNN forms
* Floor of 907 and the version forms (ld64-907, dyld-1009.5) per meson:
https://github.com/mesonbuild/meson/blob/master/mesonbuild/linkers/linkers.py
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2314%2FHaraldNordgren%2Fmakefile-test-helper-dedup-libs-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2314/HaraldNordgren/makefile-test-helper-dedup-libs-v3
Pull-Request: https://github.com/git/git/pull/2314
Range-diff vs v2:
1: 0ef442ea05 < -: ---------- Makefile: dedup archives in $(LIBS) so link recipes don't repeat them
-: ---------- > 1: 5bf560c5ad config.mak.uname: avoid macOS dup-library warning
config.mak.uname | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/config.mak.uname b/config.mak.uname
index 8719e09f66..9ebd240378 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -173,8 +173,15 @@ ifeq ($(uname_S),Darwin)
NEEDS_GOOD_LIBICONV = UnfortunatelyYes
endif
- # Silence Xcode 16.3+ linker warning about __DATA,__common alignment.
- LD_MAJOR_VERSION = $(shell ld -v 2>&1 | sed -n 's/.*PROJECT:ld-\([0-9]*\).*/\1/p')
+ # ld reports "PROJECT:{ld,ld64,dyld}-NNN", match any of the three.
+ LD_MAJOR_VERSION = $(shell ld -v 2>&1 | sed -n 's/.*PROJECT:[^ ]*-\([0-9][0-9]*\).*/\1/p')
+
+ # Silence the Xcode 15+ warning about archives listed more than once.
+ ifeq ($(shell test -n "$(LD_MAJOR_VERSION)" && test "$(LD_MAJOR_VERSION)" -ge 907 && echo 1),1)
+ BASIC_LDFLAGS += -Wl,-no_warn_duplicate_libraries
+ endif
+
+ # Silence the Xcode 16.3+ warning about __DATA,__common alignment.
ifeq ($(shell test -n "$(LD_MAJOR_VERSION)" && test "$(LD_MAJOR_VERSION)" -ge 1167 && echo 1),1)
BASIC_CFLAGS += -fno-common
endif
base-commit: 95e20213faefeb95df29277c58ac1980ab68f701
--
gitgitgadget
next prev parent reply other threads:[~2026-06-19 20:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-31 23:16 [PATCH] Makefile: drop duplicate %.a from link recipes Harald Nordgren via GitGitGadget
2026-06-04 0:33 ` Junio C Hamano
2026-06-04 7:06 ` Harald Nordgren
2026-06-04 7:15 ` Harald Nordgren
2026-06-04 22:03 ` [PATCH v2] Makefile: dedup archives in $(LIBS) so link recipes don't repeat them Harald Nordgren via GitGitGadget
2026-06-10 13:24 ` Harald Nordgren
2026-06-19 8:00 ` Harald Nordgren
2026-06-19 15:41 ` Junio C Hamano
2026-06-19 20:25 ` Harald Nordgren
2026-06-19 20:32 ` Harald Nordgren via GitGitGadget [this message]
2026-06-19 22:27 ` [PATCH v3] config.mak.uname: avoid macOS dup-library warning Junio C Hamano
2026-06-20 20:58 ` D. Ben Knoble
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.2314.v3.git.git.1781901127385.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=haraldnordgren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.