zig-gamedev: Undefined symbol _sincosf on an M1 Mac mini with Big Sur installed

Hello Michal,

Just opening a separate issue from https://github.com/michal-z/zig-gamedev/issues/50, as suggested.

I am getting the error below when trying to run the tests on my M1 Mac mini (Big Sur) with zig master branch built today (0.10.0-dev.1860+7b090df66):

 wilsonk  ~  zig-gamedev   main  zig build test -Drelease-fast -Ddawn-from-source=true
All 9 tests passed.
All 4 tests passed.
LLVM Emit Object... error(link): undefined reference to symbol '_sincosf'
error(link):   first referenced in '/Users/wilsonk/zig-gamedev/zig-cache/o/bede7d83f1692d97996a78a4dce04395/test.o'
thread 2335881 panic: attempt to unwrap error: UndefinedSymbolReference
/Users/wilsonk/Downloads/zig/src/link/tapi/yaml.zig:59:28: 0x10337fa83 in link.tapi.yaml.Value.asList (zig1)
        if (self != .list) return error.TypeMismatch;
.
.
.

I get the error with or without -Dtarget=aarch64-macos-gnu and in Debug or Release. This seems to be a problem with zig/macos, as per this thread: https://github.com/ziglang/zig/issues/10318

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Fascinating! Well, don’t hesitate to ping if it resurfaces or something else breaks! As for the former, I’ll cross-post a link to a PR re macos ABI change once Andrew and I are happy with it. Word of caution tho that it will be breaking since you will most likely need to refer to a macos target as either aarch64-macos or aarch64-macos-none.

Hey y’all! For the original error of undefined symbol _sincosf, I have a fix waiting for review by Andrew - it requires Zig to not assume GNU as the ABI for Apple targets.

As for the other problem of a runtime trap, I cannot repro it on my M1 running Monterey. I will see if I can spin up Big Sur in a VM. I shall keep you posted!

Just an FYI, the PR changing macOS ABI from gnu to none ziglang/zig#11684

Thanks @kubkon! The _sincosf fix is appreciated. The other error seems to be gone now. I ran with clean caches and reproduced on two machines several times a few days ago, so I think it was real. But I may be confused. 😃 This is the current situation.

Apple M1 Max
Metal driver on macOS Version 12.4 (Build 21F79)
Zig stage1: 0.10.0-dev.2284+f3517a1aa
➜  zig-gamedev git:(main) rm -rf zig-cache; rm -rf ~/.cache/zig; zig build test
downloading https://github.com/hexops/mach-gpu-dawn/releases/download/release-a0f827c/libdawn_aarch64-macos-gnu_debug.a.gz..
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 26.1M  100 26.1M    0     0  8143k      0  0:00:03  0:00:03 --:--:-- 11.1M
downloading https://github.com/hexops/mach-gpu-dawn/releases/download/release-a0f827c/headers.json.gz..
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 46762  100 46762    0     0  93485      0 --:--:-- --:--:-- --:--:-- 93485
All 9 tests passed.
All 4 tests passed.
All 72 tests passed.
All 1 tests passed.
All 3 tests passed.
All 28 tests passed.

MacOS Big Sur 11.6.5 with zig version 0.10.0-dev.2063+49a7ceb5b works fine now for all debug/fast/safe/small for me. That is with a completely cleaned directory and global cache. @kubkon

Nice find, thanks! @kubkon said he will take a look at this issue at some point in the future.

I get the same error if I build from source, too.