Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Could packages be built against https://github.com/jart/cosmopolitan by default? #18

Closed
xplshn opened this issue Dec 19, 2023 · 5 comments

Comments

@xplshn
Copy link

xplshn commented Dec 19, 2023

Description

That's it, just using APE by default(Actually Portable Executables), since normal APEs can run on BSD, Linux, MacOS, even Windows when compiled as fat-APE, and even cross architecture binaries can be made, of course the sensible choice would be supporting only *nix, I doubt someone on Windows would be interested in using hysp anyways...

Related Documentation or Links

https://justine.lol/ape.html

@Azathothas
Copy link

Azathothas commented Dec 19, 2023

@xplshn
Hi, thank you for bringing that to our attention.

Currently, we have no interest in compiling APE packages.
We have the following reasons on why not:


  1. APE Compiled binaries will still only work on hardware they were compiled for.
    So yes, same bin will work on Linux, mac and windows, but you can't run x86_64 ape binary on an aarch64 one

Yes, an emulator could be embedded in the x86_64 bin, but seriously?

Further, the support for arm64 is very, very limited : jart/cosmopolitan#633


  1. Building APE compiled binaries will often involve rewriting makefiles or actual source code.
    Check: https://ahgamut.github.io/2023/07/13/patching-gcc-cosmo/
    While some effort has been made to make an automated script, it's incredibly limited : https://github.com/ahgamut/superconfigure

  1. Rust APE Binaries aren't cross platform at all

https://github.com/ahgamut/rust-ape-example
At this point why bother with cosmo cc at all ?

Note: the executables built using Cosmo and Rust do not work across the operating systems supported by Cosmopolitan Libc, because Rust decides system constants like EINVAL] at compile-time (see ahgamut/rust-ape-example#3), based on the operating system provided in the compilation target. Thus, I expect the fat binaries built here will only work on x86-64-linux and aarch64-linux. Very well, perhaps in the future we can find a way to have system constants as extern values in Rust, like how I did it for C.


As for windows support, please see:
#9

@xplshn
Copy link
Author

xplshn commented Dec 19, 2023

fat-APEs and APEs have their differences. It'd be great if packages written in C or C++ used cosmocc to be compiled, and why do you want a LIB_C to compile with Rust? That's just dumb... Also, compiling projects statically also involves Makefiles., furthermore, there's a cosmo compiler, cosmocc, there is the libc, you can use it when compiling software with Nim, Go, clang and GCC(superconfigure if you don't want to append the flags to do so manually)

@xplshn
Copy link
Author

xplshn commented Dec 19, 2023

fat-APEs are more experimental, indeed. But I only suggested Cosmopolitan for Nix systems of the same architecture. Why'd you need Rust? Why'd you care to compile for Windows?
Cosmopolitan can save you from doing more work, but only when used in the correct, appropriate places... For example, you will not have success compiling GTK or Quake3e with Cosmo

@Azathothas
Copy link

I see.

However, I would like to reemphasize that metis-os/hysp-pkgs will never contain anything other than pure, statically compiled binaries.

Hysp offers you to host whatever you want, See Self-Hosting
You are welcome to host your APEs yourself and configure hysp to use that.

@xplshn
Copy link
Author

xplshn commented Dec 26, 2023

@Azathothas They are statically compiled. They just include APE as a library and the machine code is written using SystemV syscalls... Anyhoo, okay, I will actually look a bit into it, I very much liked the idea of a statically compiled system, like https://sta.li/faq/ and the likes, Oasis-Linux would actually make a good candidate for doing so. Anyhoo, thanks @Azathothas and @pwnwriter, incredible work. I will try to collaborate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants