-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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: update to 0.13.0 #24430
zig: update to 0.13.0 #24430
Conversation
While this builds fine,
I don't know if this is caused by how MP builds LLVM and Clang, but the combiler functions and I can build |
@i0ntempest I can't merge this if it's broken? What would you like to do next? |
I don't know if it's broken. Changelog did not state changes in build processes and the resulting binary seems to be working fine. More likely it's triggered by how MP installs Clang and LLVM but I'm not sure. Maybe tag some C/C++ experts we have here to take a look? |
@jmroot @ryandesign Who would be good at looking at this do you think? |
I don't know. Ask the developers of zig what their error message means and how they would like us to fix it. |
@i0ntempest How would you like to proceed? |
I opened an upstream issue, hopefully they can provide an explanation. Meanwhile I have pushed 0.12.1. |
ping - please fix or close until upstream has responded |
We had a response but the exact problem isn't clear yet. They said I "somehow have two libc++ libraries loaded into the Zig compiler process". |
The issue appears to be that in 0.13.0, libClang-cpp and libLLVM are linked dynamically, where they were not in 0.12.1. Those libraries in turn link the system libc++ library, also dynamically. The zig executable, however, links libc++ statically and it is not clear which libc++ it is linking, but zig itself is detecting a mismatch and throwing the error above. Much seems to have changed with the build between the two releases and it is not clear to me where these changes are being introduced. I'm not well versed in cmake and I certainly have next to no understanding of the zig build system. The interaction between the two seems rather nightmarish to me. It seems to be the confluence of changes in the llvm/clang cmake files and very minor changes in zig build files. I wish I could tell which changes but at this point I cannot. I will keep looking, though. The bottom line (I think) is that either llvm and clang need to be statically linked as they were in 0.12.1 (which I think triggers a change in which libc++ is linked) or the stage3 zig binary needs to link the system libc++ dynamically. I don't know how to effect either of these changes at the moment. The net effect of the former is that zig goes back to being an approximately 180MB binary with the macports llvm/clang as build-only dependencies or, for the latter, zig is a 20-ish MB binary that has macports llvm/clang as runtime dependencies. |
I poked at this a bit more and have found that adding the following to the Portfile appears to reproduce what was happening with the 0.12.1 port. That is to say that the zig binary statically links llvm/clang and (some) libc++. I'm not sure if it's the system one (probably not) or the one in llvm or zig's own. In any case this produces a 184MB zig binary (same as the previous version) that no longer emits the error above.
I still have no idea why this is needed to reproduce the default behavior from the previous release. I've spotted no diffs in either llvm/clang or zig that points specifically to this. I'm guessing something to do with library detection in the new cmake files in llvm/clang. If somebody discovers this I'd love to hear about it. |
I’d also like to reiterate that neither the previous version nor this one with this change applied requires llvm or clang as dependencies unless you are building from source, so it’d be nice if the clang dependency could be moved to depends_build |
To this point I can see no clear path forward for dynamic linking of llvm/clang AND libc++ in zig itself. I found this upstream PR that seems to want to accomplish this but it was closed without merging. Apparently because nobody could be bothered to rebase the patch. |
- Update to version 0.13.0 - Force static linking of llvm/clang; this was the default previously - Since llvm/clang are linking statically these can be build-only dependencies. Closes: https://trac.macports.org/ticket/70584 Supersedes: #24430
Should be fixed upstream in ziglang/zig#23264. See also discussion at Homebrew/homebrew-core#210173. |
Description
Type(s)
Tested on
macOS x.y
Xcode x.y / Command Line Tools x.y.z
Verification
Have you
port lint --nitpick
?sudo port test
?sudo port -vst install
?