Re: [PATCH v3] config.mak.uname: avoid macOS dup-library warning
"Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 18 quoted lines
> 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>
> ---
Yeah, this looks like what I expected.
A few things to note.
* Can folks with different versions of Xcode (or is 15 sufficiently
old that practically nobody is expected to have anything older?)
test this patch?
* We only patch Makefile here; can folks who use meson report how
well your build goes?
Thanks.
Show 27 quoted lines
> 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