I've been building static binary with musl for some time. Achieved multi-platformity by compiling for windows and running on linux with wine... yack, but it worked. Now this cute honey badger is promising much cheaper and cleaner solution: build-once-run-anywhere.
I would very much appreciate a tutorial, get some insight into what works and what doesn't. Could we achieve that multi-arch support by embedding the emulator? Could this potentially replace cross-compiling altogether, or at least for some use cases?
At a glance, if main is being directly called by the C runtime, I’d expect i32 rather than isize for argc and the return value. Whether that could cause a segfault with those compiler options and replacement C lib I’ve no idea, but it could be a stack frame size and return value address disagreement perhaps.
It looks like an interesting hack to play with for people interested in learning about crt.o equivalents and executable formats etc. I don’t think it’s suitable for real-world software development and distribution though!
I know iOS will compile multiple architectures into a single "fat" binary, but that's not really what they're talking about. Their front page makes it sound like a magic bullet which will make all your cross-platform/cross-compiling issues go away.
Hi, to be precise x86_64. On one hand, it is a very widely used, well established architecture. Curiously, I hear that patents around x86_64 are expiring, though that may not apply to later extensions. On the other hand, I hear x86_64 is a terrible common ground, though it could be emulated, as demonstrated by cosmopolitan on ARM architecture.
Let's not get burned in a flame war and explore the possibilities here. While critical thinking is awesome, do we have some creative thinking, too?
I imagine, for a start, compatibility on other architectures could be emulated, and later extended with proper fat binary approach. Consider, that the project is so young though the general concept is pretty old.
I imagine that for some mainstream users and use cases, the advantage of reducing complexity of targetting multiple platforms regardless of having to target multiple architectures would be good enough. Think about cloud, k8s, ci/cd...
I imagine that Rust community could take this on board like musl and even help drive it to a production class solution.
This is a pretty cool project but I don't think it's the kind of thing most users would want to run in production:
Reimplementing libc is fine on Linux where the kernel syscall interface is well documented and guaranteed to be stable but that isn't true on other OS's. On Windows for example, bypassing "libc" isn't supported and syscall numbers can change at any time including a routine Windows update.
I suspect this will pretty quickly break your diagnostic and troubleshooting tools. Not being able to attach a debugger and get useful information or even print a backtrace when things break is going to be very painful.
For non x86_64 systems, if you're willing to accept the overhead of emulation, you're probably better off just using some kind of JIT'd language to begin with.