-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
zig version
on 0.13 built with MacPorts spits warning about incorrect linkage
#20450
Comments
Hello? Anyone can help out here? |
Best guess is that they're linking libc++ into LLVM/Clang statically, while the Zig compiler links to it dynamically, but it's hard for us to really know. Bottom line is that you somehow have two libc++ libraries loaded into the Zig compiler process, and it will cause arbitrary breakage when things that should compare equal don't. |
I noticed the
I have multiple llvm/clang versions on my system but the binary only has llvm18 in its rpaths:
Does this indicate possible linkage problems? |
You would need to find out if that |
I've checked and both of them dynamically links to |
At that point, it might be the Zig compiler itself that has statically linked libc++. That actually seems more likely, looking at the Maybe you can check if it has internal libc++ symbols or something? |
this issue may have been fixed by macports/macports-ports@a1d4865 macports previously built and installed a new copy of libc++.dylib in a default directory specified by llvm. This new copy of libc++.dylib was often found opportunistically. The new copy of libc++.dylib is now tucked into a subdirectory, so it is found only if specifically added. |
I made sure I have only v18 of llvm and clang active on my system and rebuilt zig, but nope. The new binary still gives the error. |
This must be fixed by macports. There is nothing for Zig project to do. |
This sounds right given bundled Lines 787 to 788 in 4cefd1b
Lines 450 to 455 in 4cefd1b
There doesn't seem to be an easy way of enabling shared LLVM on macOS that doesn't result in conflict warning. The workaround would be patching build.zig to change above line and force linkage to correct libc++. It gets rid of conflict warning but no idea if this breaks something else. |
Got the same message today on my Mac after > zig version
0.14.0
error: Zig was built/linked incorrectly: LLVM and Clang have separate copies of libc++
If you are dynamically linking LLVM, make sure you dynamically link libc++ too |
so do i |
Should be fixed by #23264. See discussion at Homebrew/homebrew-core#210173. |
Zig Version
0.13.0
Steps to Reproduce and Observed Behavior
zig version
givesThe binary is built from this portfile: macports/macports-ports#24430
Expected Behavior
The compiler seems to work fine, but I would expect a more useful warning message than this. I don't know if this is triggered by how MacPorts installs LLVM and Clang. What do I need to do to get rid of this warning?
The text was updated successfully, but these errors were encountered: