mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.61k stars 1.63k forks source link

Linker version checks fails in macOS Sonoma | XCode 15.0.1 #12419

Closed ylatuya closed 1 year ago

ylatuya commented 1 year ago

Describe the bug In macOS Sonoma with XCode with 15.0.1, the linker version check fails:

➜  meson setup builddir
The Meson build system
Version: 1.1.0
Source dir: /Users/andoni/git/gstreamer-sharp
Build dir: /Users/andoni/git/gstreamer-sharp/builddir
Build type: native build
Project name: gstreamer-sharp
Project version: 1.19.1.1

meson.build:1:0: ERROR: Unable to detect linker for compiler `cc -Wl,--version`
stdout: 
stderr: ld: unknown options: --version 
clang: error: linker command failed with exit code 1 (use -v to see invocation)

A full log can be found at /builddir/meson-logs/meson-log.txt

This is a list the output of the commands run individually

➜  gstreamer-sharp git:(master) ✗ cc -Wl,-v             
@(#)PROGRAM:ld  PROJECT:dyld-1015.7
BUILD 16:59:34 Oct  1 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:
    /usr/local/lib
Framework search paths:
ld: Undefined symbols:
  _main, referenced from:
      <initial-undefines>
clang: error: linker command failed with exit code 1 (use -v to see invocation)
➜  gstreamer-sharp git:(master) ✗ ld -v
@(#)PROGRAM:ld  PROJECT:dyld-1015.7
BUILD 16:59:34 Oct  1 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:

Forcing the build a shared library with cc -Wl,-v -Wl,-dylib works:

➜  gstreamer-sharp git:(master) ✗ cc -Wl,-v -Wl,-dylib
@(#)PROGRAM:ld  PROJECT:dyld-1015.7
BUILD 16:59:34 Oct  1 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:
    /usr/local/lib
Framework search paths:

To Reproduce Run meson setup builddir in a C project

Expected behavior The setup command finds a linker and continues

system parameters

ylatuya commented 1 year ago

This has been fixed in master already.

ilg-ul commented 1 year ago

Was this issue fixed in this repo too? @ylatuya mentioned that the bug was fixed, but I can't find the commit.

ylatuya commented 1 year ago

Was this issue fixed in this repo too? @ylatuya mentioned that the bug was fixed, but I can't find the commit.

It was reported here: https://github.com/mesonbuild/meson/issues/11958 and fixed here: https://github.com/Dudemanguy/meson/commit/0cc8d50fd601d17537cbd02f1d19f499d334a110

ilg-ul commented 1 year ago

Yes, but was this merged upstream?

ylatuya commented 1 year ago

Sorry, I linked the wrong commit. It was merged here: https://github.com/mesonbuild/meson/commit/ad13d9f4a3e90fbe05544c28437090f155d8994b

ilg-ul commented 1 year ago

Thank you, this means it'll be part of 1.3.0, right?

jpakkane commented 1 year ago

Yes. You can already test rc1 if you want.

ilg-ul commented 1 year ago

Great, thank you!

ilg-ul commented 11 months ago

Apparently the problem is still present in 1.3.0: https://github.com/mesonbuild/meson/issues/12552