Tier 1 Support for x86_64-illumos
https://www.illumos.org/
C include headers: https://github.com/illumos/illumos-gate/tree/master/usr/src/head
Yes please! I just started watching some videos about zig, and I'm super excited about it, but for me portability to some other systems -- especially my favorite - illumos (not that I'm biased or anything!) is important.
Hello @rzezeski, me and @alexrp have been trying to unbreak building Zig on Illumos for the past couple days, and have merged some of your patches to do so. I've set up a new OmniOS VM and built llvm+clang+lld from source with the patches in omnios-extra. When building Zig with that llvm, the stage 3 compiler will fail to link to symbols in libc with the message failed to preempt symbol - relevant log here.
In the past I remember getting around this by building the llvm libs and/or Zig with the -fPIC flag on. Unfortunately this does not work now. So I have two questions:
- Do you have any insight into resolving the linking issues?
- Why is it that the package in
omnios-extraavoids this issue?
And thanks again for keeping Zig on Illumos going.
Build setup for llvm (based on zig-bootstrap flags). This is after merging patches for llvm and clang.
$ cd path/to/llvm-project-21.x.x.src
$ cat build.sh
#!/bin/sh
cmake -B build -G Ninja -S llvm \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$HOME/local/llvm-21" \
-DCMAKE_INSTALL_PREFIX="$HOME/local/llvm-21" \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DLLVM_ENABLE_BINDINGS=OFF \
-DLLVM_ENABLE_LIBEDIT=OFF \
-DLLVM_ENABLE_LIBPFM=OFF \
-DLLVM_ENABLE_LIBXML2=OFF \
-DLLVM_ENABLE_OCAMLDOC=OFF \
-DLLVM_ENABLE_PLUGINS=OFF \
-DLLVM_ENABLE_PROJECTS="lld;clang" \
-DLLVM_ENABLE_Z3_SOLVER=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_INCLUDE_UTILS=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_INCLUDE_DOCS=OFF \
-DLLVM_TOOL_LLVM_LTO2_BUILD=OFF \
-DLLVM_TOOL_LLVM_LTO_BUILD=OFF \
-DLLVM_TOOL_LTO_BUILD=OFF \
-DLLVM_TOOL_REMARKS_SHLIB_BUILD=OFF \
-DCLANG_BUILD_TOOLS=OFF \
-DCLANG_INCLUDE_DOCS=OFF \
-DCLANG_INCLUDE_TESTS=OFF \
-DCLANG_TOOL_CLANG_IMPORT_TEST_BUILD=OFF \
-DCLANG_TOOL_CLANG_LINKER_WRAPPER_BUILD=OFF \
-DCLANG_TOOL_C_INDEX_TEST_BUILD=OFF \
-DCLANG_TOOL_LIBCLANG_BUILD=OFF
$ ./build.sh
$ ninja -C build install
Build flags for Zig:
$ cd path/to/zig
$ cmake -B build -G Ninja -S . -DCMAKE_INSTALL_PREFIX="$HOME/local/zig" -DCMAKE_PREFIX_PATH="$HOME/local/llvm-21" -DCMAKE_BUILD_TYPE=RelWithDebInfo
$ ninja -C build
Edit: The solution I've found is to use ZIG_STATIC_LLVM when building zig.
This target is broken as of #25592, due to Illumos not implementing a futex primitive. Should be unblocked if:
Io.Threadedis modified to use an alternative to futexes.- A basic, portable
Ioimpl is added. - A new
Io.Eventedimpl is made to use Solaris event ports.
Prior art for event ports:
The relevant issue for that is #25760.