jart / cosmopolitan

build-once run-anywhere c library
ISC License
18.36k stars 630 forks source link

ARM, POWER PC, etc. #73

Closed dumblob closed 3 years ago

dumblob commented 3 years ago

Any plans to support other than x86 platforms? It'd be really useful to make this tool more cross platform.

jart commented 3 years ago

Cosmopolitan supports x86_64, i386, ARM, MIPS, Alpha, HP-PA, PowerPC, RISC-V, s390x, and Xtensa because your Actually Portable Executables will re-exec themselves under qemu automatically if the host architecture isn't x86_64.

That means you get peak native performance on the vast majority of desktops and servers without needing an interpreter. Whereas for second-tier CPUs you only need to pay a slight JIT compilation cost that's similar to Python or Java.

I think further optimizing performance on machines that have different instruction encoding formats is great. It's not something this project has the resources to do right now.

dumblob commented 3 years ago

will re-exec themselves under qemu automatically if the host architecture isn't x86_64.

This seems to assume qemu is already installed and ready to run (which I'd actually especially on non-x86 systems absolutely not expect).

Anyway, thanks for a quick answer! I hope this can be improved somehow in the future.

jart commented 3 years ago

If by improve you mean better cater to your requirements, then we need your support in order to do that.

dumblob commented 3 years ago

By improve I did not mean better cater to my requirements, but simply to stand to the following promise from readme:

Cosmopolitan Libc makes C a build-once run-anywhere language, like Java, except it doesn't need an interpreter or virtual machine.

Unlike e.g. Java, cosmopolitan does currently not offer this kind of "build-once run-anywhere" capability. So maybe this should be rewritten and clarified in the readme (and other places on the cosmopolitan web page etc.)?