WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Cosmos a "Fat Linux Distro"  (Read 3391 times)

Offline mocore

  • Hero Member
  • *****
  • Posts: 520
  • ~.~
Re: Cosmos a "Fat Linux Distro"
« Reply #15 on: December 08, 2023, 12:59:14 AM »
will a binary compiled on an x86_64 machine work on any other platform, 32bits, arm etc?

however https://justine.lol/ape.html mentions emulation ... which i presume is how arm is supported.
You only use the emulator if you need it.
For example, it's helpful to be able to have cool visualizations of how program execution impacts memory.

It'll be nice to know that any normal PC program we write will "just work" on Raspberry Pi and Apple ARM.

ftr i found some clarification @ https://github.com/jart/cosmopolitan/issues/73# ARM, POWER PC, etc.

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.
idk if using qemu is still how other architectures are supported

 this issue on https://github.com/jart/cosmopolitan/issues/61# Compiling Lua
mentions an interesting property 
Your Lua interpreter is also a zip file. You can use a tool like InfoZIP to insert Lua scripts into your Lua binary. Such scripts can be launched as follows:

echo 'print(2 + 2)' >hello.lua
zip o/tiny/third_party/lua/lua.com hello.lua
o/tiny/third_party/lua/lua.com zip:hello.lua
this seams reminiscent of busy box multi call
and make me wander how/if the same trick might work with actually portable awk ?

as this could potentially address one of the points made in "AWK As A Major Systems Programming Language — Revisited" (https://forum.tinycorelinux.net/index.php/topic,25301.msg171413.html#msg171413)
about 'What Awk Lacked'
Quote from: AWK As A Major Systems Programming Language — Revisited
[I can’t believe I didn’t discuss this in the paper, because I was certainly aware of it then!] Lack of any convenient mechanism for adding libraries. When awk is being invoked from a shell file, the shell file can do substitutions or use multiple -f options, but those are mechanisms outside the language, and not very convenient ones. What’s really wanted is something like you get in Python etc., where one little statement up near the top says “arrange for this program to have the xyz library available when it runs.”

« Last Edit: December 08, 2023, 01:07:09 AM by mocore »

Offline mocore

  • Hero Member
  • *****
  • Posts: 520
  • ~.~
Re: Cosmos a "Fat Linux Distro"
« Reply #16 on: December 09, 2023, 01:15:36 AM »
while researching more on this general tangent
more or less along the lines of this
reddit post
Quote from: reddit.com/r/Zig/#@maccam912

There is a blog post about it being done in Rust, for reference: https://ahgamut.github.io/2022/07/27/ape-rust-example/

My understanding is that this Cosmopolitan project creates its own libc. And there is a cosmopolitan.a library it needs to link with. The blog post above does those things, but being on a mac I still need to cross-compile to linux to make the executable run on all the supported operating systems.

Basically, I'm asking if Zig's cross compile abilities and better interop with C would make any of this easier? I think it would be cool to have a "cosmo" target for zig that would build binaries that work on any of the supported OSs. It also seems like black magic that it can work at all, so I would not be surprised if this was way more complicated than I realize. I myself have very little background on how this actually works so I'm hoping for some insight from the knowledgeable people here.
+WRT above ~ https://news.ycombinator.com/item?id=34373392 interesting comment

...i happened to find some vaguely on topic ( with selective filtering  :P )
along the lines of lacking ' need to re-invent'

Anyway, I deviated from the subject, just to explain that today we do NOT need to re-invent the wheel.

tough it is enlightening to find/follow the random "rapid unscheduled? disassembly"  threads 

kind of reminds me of "Bjork Teardown of Sony Trinitron TV" https://forum.tinycorelinux.net/index.php/topic,26612.0.html

« Last Edit: December 09, 2023, 01:18:31 AM by mocore »

Offline nick65go

  • Hero Member
  • *****
  • Posts: 805
Re: Cosmos a "Fat Linux Distro"
« Reply #17 on: December 09, 2023, 04:29:33 AM »
The idea behind this universal OS portability is about CPU architecture unification, to build/bypass on common sys-calls.

If we start with the end goal in mind (as we should always see the big picture first before jumping into details) I wonder why such a nice good to have achievement did not get traction world-wide with so many brilliant brains. Maybe because the big majority of developers do paid work (from inside corporations) to develop Linux/MacOS/Windows? And their goals are not aligned, because each of them wants to conquer the world by themself (vanity, or money greed).

Because I can not personally contribute to this project, I stay aside and wish it good luck. In IT era (of easy communication) is strange that high hierarchy Linux leaders are silent about such approach of portability. Maybe A.I. will "unify" all this NIH (not invented here) vanity.
« Last Edit: December 09, 2023, 04:33:04 AM by nick65go »

Offline gadget42

  • Hero Member
  • *****
  • Posts: 672
Re: Cosmos a "Fat Linux Distro"
« Reply #18 on: February 21, 2024, 08:39:17 AM »
The fluctuation theorem has long been known for a sudden switch of the Hamiltonian of a classical system Z54 . For a quantum system with a Hamiltonian changing from... https://forum.tinycorelinux.net/index.php/topic,25972.msg166580.html#msg166580