New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build failed on macOS Sonoma with Xcode 15: zig2 duplicate symbol __mh_execute_header
#17050
Comments
As a quick workaround, edit struct mach_header_64__3906 _mh_execute_header = {UINT32_C(0xaaaaaaaa), ... }; |
Further hint, this is definitely triggered when Xcode 15 (Release Candidate) linker is used, even on Ventura. It looks like the latest system linker is more strict. |
another hint
but what's going on here? If we look as to why the symbol is used... it's used when .zig owns (exports) main. It's not needed when .c owns main. And this is further re-enforced by your workaround. I'm thinking when backend is .c we have 2 choices:
|
implement codegen for: - decl weak linkage - decl aliases - fn decl weak linkage closes ziglang#17050
implement codegen for: - decl weak linkage - decl aliases - fn decl weak linkage windows: - `__declspec(selectany)` is not supported for functions - skip weak linkage for functions closes ziglang#17050
implement codegen for: - decl weak linkage - decl aliases - fn decl weak linkage windows: - `__declspec(selectany)` is not supported for functions - skip weak linkage for functions closes ziglang#17050
This problem is happening on the latest macOS Ventura 13.6 too, M1 Ultra chip, even with the latest zig (after "git pull"). Can't compile / build zig. |
implement codegen for: - decl weak linkage - decl aliases - fn decl weak linkage windows msvc: - `__declspec(selectany)` is not supported for functions - skip weak linkage for functions closes ziglang#17050
implement codegen for: - decl weak linkage - decl aliases - fn decl weak linkage windows msvc: - `__declspec(selectany)` is not supported for functions - skip weak linkage for functions closes #17050
Are you sure this has been fixed? Am still getting an error in Ventura 13.6 (this time on Intel macOS):
|
sorry it's a 2-part fix. The first part has been committed. But we have a bootstrap process where update: |
I see! |
Xcode 15‘s new linker cause this problem, you can add |
Thanks, it's good to know it. Other, non-zig related projects have been affected too so it's great that at least there is a temporary workaround. |
Zig Version
0.11.0
Steps to Reproduce and Observed Behavior
SDKROOT
will be set to/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk
Linking CXX executable zig2
, linker output:macOS: 23A5337a
Xcode: 15A5229m
LLVM(
llvm-config --version
): 16.0.6Expected Behavior
zig2
.The text was updated successfully, but these errors were encountered: