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
- zmath: Use @sin() instead of std.math.sin() - helps #51. — committed to zig-gamedev/zig-gamedev by michal-z 2 years ago
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-macosoraarch64-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
gnutononeziglang/zig#11684Thanks @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.
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.