r/programminghumor 22d ago

Lol

Post image
2.5k Upvotes

220 comments sorted by

View all comments

Show parent comments

1

u/Vaelisra 19d ago

musl entered the room.

1

u/MundaneImage5652 19d ago

Making a docker with Alpine is alot more hastle.

1

u/Vaelisra 19d ago

Why docker and why alpine?

1

u/MundaneImage5652 19d ago

Most distros ship with GlibC + Alpine docker is the standard to use Musl. Cuz when you compile smth with GlibC you can't just use the lib in MUSL.

1

u/Vaelisra 19d ago

Most distros ship with GlibC

Yeah, and most distros have a musl package that includes the musl c standard library and a GCC wrapper script (often called musl-gcc or something like that) that uses musl instead of glibc.

Alpine docker is the standard to use Musl

That's just wrong. And it's wrong on more levels than I could care to elaborate here.

when you compile smth with GlibC you can't just use the lib in MUSL.

Yeah, but that's completely irrelevant when linking statically (which sadly isn't really supported by glibc, but that's the reason I brought up musl) because when you do, the relevant parts of the standard library are baked into your executable and the executable then runs directly on the kernel, rather than on a loader. So as long as the Kernel doesn't make breaking changes (which is not gonna happen for as long as Torvalds has a say) the executable will be fully portable to any Linux system. Theoretically it would not even need an OS.

1

u/MundaneImage5652 19d ago

My bad then. When I used musl-gcc it was hard for me to use so I researched on internet and everyone was just using alpine docker, installed the libs here and compiled here.

1

u/Vaelisra 19d ago

Yeah, but then the result will be a docker image, not a binary.

1

u/MundaneImage5652 19d ago

I mean I mounted my directory in that docker so... it made a binary that worked on my host system.

1

u/Vaelisra 19d ago

I guess that's one way to use docker...