-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Tier 3 OpenBSD Support for x86_64 #2016
Comments
Here is some partially finished code that one can use for inspiration: #1921 |
SourceHut has OpenBSD images now: https://man.sr.ht/builds.sr.ht/compatibility.md#openbsd |
FWIW, OpenBSD recently imported LLVM 8.0.0 into base: https://marc.info/?l=openbsd-cvs&m=156132754603489&w=2 It's available now in the latest -current snapshots for anyone interested in this issue. Edit: SourceHut seems to have the latest release, but doesn't support -current snapshots, so anyone working on OpenBSD compatibility can't readily solve the CI needs until the next OpenBSD release later this year. |
I am willing to help out with OpenBSD support. I have looked through the previous PRs (particularly #5324), and would like to tackle it, getting Zig to even compile on OpenBSD and getting those changes merged into master. |
Happy to hear that @justjosias . My suggestion is to make smaller PRs that can be merged independently, making incremental progress. I think you will meet with swift success if you do this. |
@justjosias 👋 also keen to see Zig on OpenBSD; happy to work with you on testing/iterating on your changes. |
OpenBSD-current just added llvm 10 to their (binary) packages. Maybe this could rejuvenile this effort? |
@gaultier You have to compile LLVM from source, which isn't so hard (the boostrap works very well, just need to add some linker and header include paths). At that point you have to patch and modify Zig to get it to build, which currently is the goal of this issue. |
@justjosias Right, got it, I did just this and I realized OpenBSD is not in the list of supported OSes in the zig source code. Hopefully someone can continue the porting effort that was started in the linked PR 👍 |
FYI I started a port of zig for OpenBSD : https://github.com/semarie/zig/tree/openbsd some work is still need:
|
Awesome news, thank you @semarie! |
@semarie are you still working on this? looks like your repo is not there anymore |
I build zig semi-regulary on OpenBSD using upstream repository without issues (and I sent PR to fix them when I saw a problem). and OpenBSD has a port for zig in official OpenBSD port-tree (but it is disabled due to too big memory requirement to build it from scratch). |
@semarie Does this mean this ticket can be closed as Done now? Or is there anything pending from the list you mentioned above? I assume selfExePath resolution might still be the issue? |
Looks like the fixes for the blockers have been merged @semarie |
I sadly do not have a lot of time to contribute code to this issue, but I'd like to let you know that we use OpenBSD quite a bit for servers and routers, and I'll be happy to help testing. |
I am currently running OpenBSD 7.3-Current and I've tried to compile zig 0.11.0. It's not possible to compile What got me confusing is that on release notes of zig 0.11.0 under Tier 2, OpenBSD has ✅ but should have 📖 because it doesn't compile. I don't know if it got there by accident or you just cross-compiled it without being on OpenBSD, I don't know how you got it. If someone wants to compile it themselves, I provide llvm16 pre-built binary for amd64 OpenBSD 7.3-current in releases. I compiled it as zig's wiki tells me. + Don't forget to install it into /usr/local/llvm16 Before compiling zig, edit My configure command was cmake .. -DZIG_STATIC_LLVM=ON -DZIG_STATIC_ZSTD=ON -DZIG_STATIC_ZLIB=ON -DZIG_USE_LLVM_CONFIG=OFF -DCMAKE_PREFIX_PATH="/usr/local/llvm16;/usr/local" Then run Now you are good to go, the compilation should fail with If anything, I can learn zig and try to fix std myself Update: |
I am back with more info, okay so I tried to cross compile simple hello world application. But it crashes with I ssh mounted a computer running OpenBSD (You don't need to have a computer with OpenBSD. Just make QEMU VM, forward ssh port and mount / using sshfs) and modified output of Reason why It could either be because of the "nasty fix" or who knows what. I could theoretically fork their libc, add own implementation for storing FDs and call it from zig and try that out, if it would work without breaking anything on the system itself, I would make the patch available on custom repo so users could patch libc and recompile it themselves. I wouldn't make PR back to OpenBSD because this would be home made fix. But then again, issue can be with something else |
Found a little issue when idk for which reason that doesn't work well because every function used on Zig come from of a C Static/Dynamic library ( example SDL2/GL/X11...) are `undefined symbols Actually works if i used PR : #18475 |
Here's the issue to track OpenBSD support. The current goal is Tier 3, since Zig can't even build on OpenBSD yet. Once Zig reaches Tier 3 this issue will get renamed to Tier 2, and so on. @Aversiste has started the effort in #1921.
The text was updated successfully, but these errors were encountered: