Closed nbuwe closed 1 year ago
FreeBSD port falls out mostly for free, so I pushed it too as a bonus. To avoid fighting with different macro syntax between gcc, old apple clang and modern clang I have converted i386 asm to use C preprocessor for macros. Same object code is generated on NetBSD (formerly gas ifdefs). I haven't tested this on MacOS yet, though. I haven't tried RelWithDebInfo
and Release
yet on FreeBSD either, but Debug
gives me a working desktop.
FreeBSD additionally needs a change to objects/glue/xlib.primMaker.hh
b/c clang is unhappy about three CARD32 res = NULL;
assignments. This is in the generated code and I'm not sure how to correctly fix it.
Also FreeBSD really needs the fix for the problem with the flags for the precompiled header generation that I mentioned on the mailing list. I was fixing it manually for my builds.
Optimized llvm builds run into https://github.com/llvm/llvm-project/issues/59889 and crash very early in universe::genesis()
.
Optimized llvm builds run into llvm/llvm-project#59889 and crash very early in
universe::genesis()
.
Which was, as expected, closed on sight as an "undefined behavior"...
On FreeBSD - gcc12 from ports works for all configurations including Release (which feels very snappy too). One caveat is that precompiled headers seems to be broken for gcc on FreeBSD (yes, I tried disabling ASLR), so it takes a small eternity to compile. On the other hand the generic bug with the precompiled headers plays a complementary role here, since gcc complains about invalid pch and works instead of trying to use a valid pch and failing. :)
I've created a very small python script for building the VMs - https://github.com/russellallen/Self-VM-Builder
Using this I can compile NetBSD and Linux. FreeBSD is broken on the built in compiler, also something goes wrong with gcc. I'll report back.
In the meantime, the outputs are attached below.
Thanks for working on that.
Re No TARGET 'Self' has been created in this directory.
on NetBSD. I don't know cmake. Doing initial cmake call (that creates the build dir) with explicit -DCMAKE_BUILD_TYPE=Debug
(or other values) seems to put it on the right track.
For the invalid pch the issue is that gcc wants to mmap the pch in but address space layout randomization gets in its way. You can switch the default with sysctl -w security.pax.aslr.global=0
(but then you will run into the cmake bug where the creation of pch doesn't use all the necessary flags)
The FreeBSD vs glue code - clang is very picky about 0/NULL, but I don't know how to fix the self code that generates the glue. clang compiled self doesn't work with optimizations enabled anyway (see above), so it's better to target gcc.
PS: May be I should file proper issues for these problems.
Meanwhile I made the Self PPC port compile on NetBSD/macppc. It successfully linked literally right now, but crashes, unsurprisingly:
$ ./Self
init.cpp: calling abort_init
init.cpp: calling kinds_init
init.cpp: calling process_init
Self VM fatal error (/home/uwe/work/self/self/vm/src/any/runtime/allocation.cpp, line 375): xxxxxxx
Self VM fatal error (/home/uwe/work/self/self/vm/src/unix/runtime/interruptedCtx_unix.cpp, line 23): must_be_in_self_thread
VM Version: 0.0.0, Sat 18 Feb 23 04:50:22 NetBSD ppc (2017.1-152-g9397994)
Segmentation fault (core dumped)
This PR fixes i386 compilation with modern compilers in general (e.g. on Linux) and adds NetBSD/i386 port.
NetBSD/i386 port works in
CMAKE_BUILD_TYPE=Debug
andCMAKE_BUILD_TYPE=RelWithDebInfo
configurations.The
CMAKE_BUILD_TYPE=Release
compiles, but gets stuck in an infinite loop when bootstrapping the world.