Open nektro opened 3 years ago
Out of curiosity, I'm currently trying to bring zig up on an Illumos system using OmniOS CE (in a VM). I'm at the point that all that's left to do is write up the required variables/structures in os
and bits
. I'm wondering if I could get some help from someone experienced in this area?
Here's the process I used to setup the system for testing:
pkg update
to bring the system up-to-date. Reboot.pkg install gcc11 git cmake ninja
.git clone --depth 1 -b release/12.x https://github.com/llvm/llvm-project.git
cd llvm-project
# Apply the same patches for llvm+clang that omnios uses, all in one file
wget https://www.sgregoratto.me/paste/llvm.patch
git apply llvm.patch
cmake -B build -G Ninja \
-DCMAKE_INSTALL_PREFIX=$HOME/local -DCMAKE_PREFIX_PATH=$HOME/local \
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_LIBXML2=OFF \
-DLLVM_ENABLE_PROJECTS="llvm;clang;lld" llvm
ninja -C build install
diff --git a/src/stage1/target.cpp b/src/stage1/target.cpp
index 7e66d42c4..57cc0253d 100644
--- a/src/stage1/target.cpp
+++ b/src/stage1/target.cpp
@@ -667,6 +667,7 @@ uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id) {
case OsWASI:
case OsHaiku:
case OsEmscripten:
+ case OsSolaris:
switch (id) {
case CIntTypeShort:
case CIntTypeUShort:
@@ -723,7 +724,6 @@ uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id) {
case OsCloudABI:
case OsKFreeBSD:
case OsLv2:
- case OsSolaris:
case OsZOS:
case OsMinix:
case OsRTEMS:
I understand that there's a specific issue for Illumos (#7152), but since lld doesn't discern between the two I think I'll just stick to "Solaris" as a whole. IIRC there's almost no low-level breaking changes between Illumos and Solaris now.
Illumos systems are very strange on their own, as they're a mix of Linux, BSD and old-school Unix features, along with some home-grown stuff as well. I'm just gonna assume we want everything, a la #define __EXTENSIONS__
.
I've worked on this a bit more and I've gotten the compiler to link, but that's about all it can do. Libdir detection doesn't work, and you have to manually specify to link against libc to get any sort of meaningful progress. The furthest I've gotten is by running CC=gcc ./zig test -lc --zig-lib-dir ../lib ../test/behavior.zig -I ../test
, and even then it does a double panic. I've rebased my work on master, but I don't think I can continue without some help.
Worked some more on this and updated my fork (under the branch solarish-port). Now most things work, but there's still some bugs. It seems that I'm running into a race issue when using Dir.iterate/Dir.deleteTree
, which is causing the fs
tests to fail when they clean up (even though they passed fine). There's also the matter of implementing the event loop. Solaris has it's own event system and Illumos augments this with epoll support, but still recommends using the native system.
https://www.oracle.com/solaris/