meson: meson < 1.2.x is broken for macOS 14.0 Sonoma (clang 15.0)
Describe the bug
After upgrading my macOS to Sonoma version and clang 15.0, meson started to fail with:
The Meson build system
Version: 1.1.0
Source dir: /Users/myuser/myfolder/meson/tutorial
Build dir: /Users/myuser/myfolder/meson/tutorial/builddir
Build type: native build
Project name: tutorial
Project version: undefined
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 /Users/myuser/myfolder/meson/tutorial/builddir/meson-logs/meson-log.txt
Issues likely related: https://github.com/mesonbuild/meson/issues/12159
To Reproduce
It can be easily reproduced with the meson tutorial.
My folder structure:
.\
| - main.c
| - meson.build
main.c
#include <stdio.h>
//
// main is where all program execution starts
//
int main(int argc, char **argv) {
printf("Hello there.\n");
return 0;
}
meson.build
project('tutorial', 'c')
executable('demo', 'main.c')
Running this in your command prompt, I got this error:
$ meson setup builddir
The Meson build system
Version: 1.1.0
Source dir: /Users/user/myfolder/meson/tutorial
Build dir: /Users/user/myfolder/meson/tutorial/builddir
Build type: native build
Project name: tutorial
Project version: undefined
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 /Users/myuser/myfolder/meson/tutorial/builddir/meson-logs/meson-log.txt
It’s true that upgrading meson to 1.2.x, the problem is solved:
tutorial git:(develop) ✗ meson setup builddir
The Meson build system
Version: 1.2.0
Source dir: /Users/myuser/myfolder/meson/tutorial
Build dir: /Users/myuser/myfolder/meson/tutorial/builddir
Build type: native build
Project name: tutorial
Project version: undefined
C compiler for the host machine: cc (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.0.40.1)")
C linker for the host machine: cc ld64 1015.7
Host machine cpu family: x86_64
Host machine cpu: x86_64
Build targets in project: 1
Found ninja-1.11.0 at /usr/local/bin/ninja
➜ tutorial git:(develop) ✗ cd builddir
➜ builddir git:(develop) ✗ meson compile
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/local/bin/ninja
[2/2] Linking target demo
ld: warning: -undefined error is deprecated
Curiously, it worked, but having a look at the meson-logs.txt, the error is still there (but not raising any exception):
-----------
Detecting linker via: `cc -Wl,--version` -> 1
stderr:
ld: unknown options: --version
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
-----------
Detecting Apple linker via: `cc -Wl,-v` -> 1
stderr:
@(#)PROGRAM:ld PROJECT:dyld-1015.7
BUILD 16:59:22 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)
-----------
Expected behavior
system parameters
- what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
- macOS 14.0 Sonoma
- clang and xcode versions
$ clang --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin23.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ /usr/bin/xcodebuild -version
Xcode 15.0.1
Build version 15A507
- what Python version are you using e.g. 3.8.0 Python 3.9.18
- what
meson --version
tested with Meson 1.0.1 and Meson 1.1.0 - what
ninja --version
if it’s a Ninja build ninja-1.11.0
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Comments: 32 (22 by maintainers)
That confirms what Eli said then. QEMU is really doing some funky stuff there.