Porting blink beyond Linux and BSD #35
Replies: 3 comments 2 replies
-
It seems the second error is related to a function that Cosmopolitan implements using platform detection. How is the platform detected by a |
Beta Was this translation helpful? Give feedback.
-
This codebase is designed to be cluttered. You're more than welcome to make contributions helping Blink support Haiku, since that means Cosmopolitan users will have access to another platform. Assuming modifying Blink to have better syscall emulation isn't possible, the hard thing you'll likely encounter is that currently only I can change the test binaries. So what I recommend doing is adding something like this to files such as ifneq ($(HOST_OS), Haiku)
THIRD_PARTY_COSMO_TESTS += \
o/$(MODE)/third_party/cosmo/2/setitimer_test.com.ok
endif You'd have to refactor what's already in there into a variable though. Should be straightforward. After that I can possibly take a look and rebuild the binary. Another option is to just copy cosmo's code for setitimer_test.c into the Blink codebase under Don't worry too much about code size if it's something that leads to better syscall emulation for all platforms. For example, porting to Cygwin and FreeBSD has illuminated many cases where things like errno conditions really ought to be handled at the Blink layer, rather than punting it to the kernel. One example is checking access rights on file descriptors. |
Beta Was this translation helpful? Give feedback.
-
Projects like Blink are also a good test case for other projects! As my device does not run virtual machines quite well, my preferred workload is Windows -> WSL1 -> Hyclone - Haiku Emulator on Linux when porting apps to Haiku. And Blink's |
Beta Was this translation helpful? Give feedback.
-
[This is not a feature request, just a discussion to see how far blink can go]
So I can see that
blink
has good support on Linux and BSD-based OSes (including Darwin/macOS).But it can also be compiled and run on some other POSIX systems like the Emscripten WASM sandbox or POSIX.
Let's try it with Haiku, an ELF-based, (nearly) POSIX-compliant OS with a Sys-V ABI:
Compiling
Makefile
usescc
instead ofgcc
and Haiku doesn't make acc
symlink, so we have toexport CC=/boot/system/bin/gcc
before runningmake
.After everything's done, you will get:
Quite fun, running
blink
- a Linux emulator, on top of a Haiku emulator, on top of WSL1, on Windows.Testing
After getting a basic binary done, the next goal is
make check
to complete.The first error I encountered:
(This time, I'm running
blink
on the real Haiku, not the emulator as my Haiku emulator is not mature enough to handle complex syscalls)This can be easily fixed using a
UnXlat
forITIMER
.The next:
I don't know about this yet, probably something different about the way Haiku handles signals, will investigate later.
Update: On the Hyclone emulator (Haiku emulator on Linux), I also managed to produce the same effect as on native Haiku. I also reproduced the same issue with
nanosleep_test
, which also seems to use Cosmopolitan platform detection.Questions for this project
What's this project's view on community support for additional platforms?
While some projects welcome this, others don't allow upstreaming platform-specific patches as they introduce some more clutter in the codebase (it mostly doesn't affect the compiled binary size though, as all changes are in the
Makefile
s or hidden under macros).Beta Was this translation helpful? Give feedback.
All reactions