pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: heads-up for macOS users re new ld(1) implementation



On 10/4/23 07:56, Jason Bacon wrote:
On 10/4/23 07:33, Jason Bacon wrote:
On 9/29/23 21:18, Tobias Nygren wrote:
Hi,

With the latest macOS 14 Xcode update comes a Command Line Tools update.
This brings a new implementation of ld(1) which unfortunately
has bugs that break some packages (ffmpeg5, gcc, ...)

If you have installed this update and encounter strange linker breakage,
sometimes it helps to locally put this line into the package's Makefile:

LDFLAGS.Darwin+=    -Wl,-ld_classic

Please don't commit such fixes yet though since it might break
packages for old CLT versions. People have reported bugs to Apple,
hopefully they will release a bugfix update soon.

Kind regards,
-Tobias

Taking an educated guess based on the pkg Makefile, I tried

LDFLAGS_FOR_TARGET+=   -Wl,-ld_classic

instead of just LDFLAGS, and gcc12 now builds on macOS 14.0 with the latest Xcode tools.

Here's a suggested temporary hack, documenting the issue and guarding against breakage for other SDK versions:

RCS file: /cvsroot/pkgsrc/lang/gcc12/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- Makefile    3 Jun 2023 13:22:04 -0000       1.6
+++ Makefile    4 Oct 2023 16:19:27 -0000
@@ -16,6 +16,22 @@
 ## The Library rpath to use in end programs.
LDFLAGS_FOR_TARGET= ${LDFLAGS:M${COMPILER_RPATH_FLAG}*:N*/usr/lib*} ${LDFLAGS:M-Wl,-z*}

+# Maybe platform/Darwin.mk should set MACOSX_DEPLOYMENT_TARGET using
+# xcrun --show-sdk-version if it's not specified by the user?
+# Then it will always have a value
+.if empty(MACOSX_DEPLOYMENT_TARGET)
+SDK_VERSION!=  /usr/bin/xcrun --show-sdk-version
+.else
+SDK_VERSION=   ${MACOSX_DEPLOYMENT_TARGET}
+.endif
+
+# Temporary fix for linker issues in first release of SDK 14.0
+# Apple is aware of this issue:
+# https://developer.apple.com/forums/thread/737707
+.if ${OPSYS} == "Darwin" && ${SDK_VERSION} == 14.0
+LDFLAGS_FOR_TARGET+=   -Wl,-ld_classic
+.endif
+
 # The "-static-libstdc++ -static-libgcc" flags are normally added to the
 # boot-ldflags by configure but because we are supply the boot-ldflags
 # we mash supply them.



Home | Main Index | Thread Index | Old Index