Closed sezero closed 1 year ago
Issue persists if I use meson from git master instead of 1.0.2 release.
I guess the linker entries in the cross file was wrong. If change them to like:
c_ld = 'x86_64-apple-darwin9-ld'
cpp_ld = 'x86_64-apple-darwin9-ld'
... then I get the following error itself:
meson.build:25:0: ERROR: Unsupported linker, only bfd, gold, and lld are supported, not x86_64-apple-darwin9-ld.
If I symlink x86_64-apple-darwin9-ld as lld and change those entries in the cross file to lld, then the initially reported issue repeats itself.
Can you print the --version
output of the linker? You might have to debug this and submit a PR. Not too many contributors regularly using Mac. The good part is that the PR will probably be pretty small
Apple's ld doesn't do --version
, it responds to -v
:
This from an older version:
$ x86_64-apple-darwin9-ld --version
ld: unknown option: --version
$ x86_64-apple-darwin9-ld -v
241.9
configured to support archs: armv4t armv5 armv6 armv7 armv7f armv7k armv7s armv6m armv7m armv7em armv8 arm64 arm64v8 i386 x86_64 x86_64h
LTO support using: LLVM version 3.4.2
This from a much newer version:
$ x86_64-apple-darwin9-ld --version
ld: warning: directory not found for option '-F/System/Library/Frameworks/'
ld: unknown option: --version
$ x86_64-apple-darwin9-ld -v
@(#)PROGRAM:ld PROJECT:ld64-609
BUILD 10:34:07 Jun 26 2021
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
LTO support using: LLVM version 11.1.0 (static support for 27, runtime is 27)
TAPI support using: TAPI version 11.0.0 (1100.0.11)
.. And the following is from natively running on an old Mac (so that no one can blame me for my cross-environment :))
Snow-Leopard:~ macuser$ ld --version
ld: unknown option: --version
Snow-Leopard:~ macuser$ ld -v
@(#)PROGRAM:ld PROJECT:ld64-97.17
llvm version 2.9svn, from Apple Clang 1.7 (build 77)
Snow-Leopard:~ macuser$ gcc -Wl,-v
collect2 version 4.2.1 (Apple Inc. build 5666) (dot 3) (i686 Darwin)
/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld -dynamic -arch i386 -macosx_version_min 10.6.8 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/
lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. -v -lSystem -lgcc -lSystem
@(#)PROGRAM:ld PROJECT:ld64-97.17
Library search paths:
/usr/lib/i686-apple-darwin10/4.2.1
/usr/lib/gcc/i686-apple-darwin10/4.2.1
/usr/lib/gcc/i686-apple-darwin10/4.2.1
/usr/lib/i686-apple-darwin10/4.2.1
/usr/lib
/usr/lib
/usr/local/lib
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Yeah your linker is just not supported. You need to check out the code that does linker detection and hook into that
Yeah your linker is just not supported.
Apple linker not supported? Huh..
You need to check out the code that does linker detection and hook into that
Directions please? (I'm no meson guy really..)
Apple linker not supported? Huh..
Your apple linker is from a 2009 operating system which was last updated in 2012. The Apple linker obviously has changed output since 2012. Not sure what the point of your comment is :).
There is the code you need to modify.
Apple linker not supported? Huh..
Your apple linker is from a 2009 operating system which was last updated in 2012. The Apple linker obviously has changed output since 2012. Not sure what the point of your comment is :).
You can also see that I get the same error from version 609 of the linker (as I shown you above), which was released on March 2021: https://github.com/apple-opensource/ld64/tags
The point of my comment is that old or new Apple ld is failing for me, and if I'm at fault somehow I'd like to be shown how.
The point of my comment is that old or new Apple ld is failing for me, and if I'm at fault somehow I'd like to be shown how.
The bug is definitely in the Meson code. It just needs some sort of addendum.
You can see that the error is on https://github.com/mesonbuild/meson/blob/b51bce070eead2b65e56f087acf23829a6304ae2/mesonbuild/linkers/detect.py#L197
Your linker doesn't provide that line in its stderr.
You can see that the error is on
Your linker doesn't provide that line in its stderr.
OK that helped, and figured it out. Thanks!
Closing the ticket.
Why close the ticket if it is a valid ticket?
Because it was the fault of the cctools-port, which didn't feed PROJECT:ld64
to stderr. After patching, things worked.
Thanks for the conclusion. Happy it worked for you.
I just updated my system to macOS 14.1 with the latest CLT/Xcode 15 and meson (1.0.2) can no longer be used with it.
meson.build:16:0: ERROR: Unable to detect linker for compiler `gcc -Wl,--version`
The linker is:
ilg@wksi ~ % /usr/bin/ld -v
@(#)PROGRAM:ld PROJECT:dyld-1015.7
BUILD 18:48:43 Aug 22 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 15.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.0.12.3)
Library search paths:
Framework search paths:
ilg@wksi ~ % uname -a
Darwin wksi.local 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:27 PDT 2023; root:xnu-10002.41.9~6/RELEASE_X86_64 x86_64
ilg@wksi ~ % /usr/bin/ld --version
ld: unknown option: --version
Was this problem addressed in the latest release?
@ilg-ul are you using cctools? Is this:
error in an osx cross-compile environment
per the title of this PR?
I am relatively sure your issue is instead #12419
You're right! Sorry for the noise.
Ran into it while trying to build dav1d project for macos/x64, using meson-1.0.2 with python 3.7 on i686-linux. The following copied from meson-log.txt:
The cross-build file is like this:
The
x86_64-apple-darwin9-XXX
tools are built from cctools-port project. And,cc.sh
is simply a wrapper aroundclang
:Is there a way around this?
Thanks.