Show HN: A 166 KB file for cross compiling glibc for any version, any target
1–10 of 34 posts
Re: Show HN: A 166 KB file for cross compiling glibc for any version, any target
#2In master branch of Zig right now (before https://github.com/ziglang/zig/pull/10330 is merged), status quo:
$ cat ../lib/libc/glibc/*.txt | wc -c
205219
$ cat ../lib/libc/glibc/*.txt | xz | wc -c
22976
Zig supports targeting every version of glibc for any target architecture. The information required to do this takes up 200 KB installation size / 22 KB tarball size, and it has the following problems (which are causing several bugs):* fails to represent symbols that migrate from one library to another between glibc versions
* fails to represent a distinction between functions and objects
* fails to represent object sizes
With this new glibc-abi-tool:
$ cat abilists | wc -c
169421
$ cat abilists | xz | wc -c
24880
165 KB installation size / 24 KB tarball size, and all the above issues are solved. It also should be slightly faster to load/parse for the compiler since it is fewer KB to load from disk.The code that uses this file is here: https://github.com/ziglang/zig/blob/0d7331b6f6af85bd45829514... It creates c.s, pthread.s, dl.s, etc., which are assembled into libc.so, libpthread.so, libdl.so, etc., which are placed on the linker line when cross compiling. Thanks to this improved dataset, they can now accurately model the glibc that will be on any CPU architecture, any glibc version.
If I just naively shipped every version of the .abilist files:
$ cat (find glibc/ -name "*.abilist") | wc -c
37041906
$ cat (find glibc/ -name "*.abilist") | xz | wc -c
205036
...it would be 35 MiB installation size, 200 KB tarball size. So I have effectively achieved a compression ratio of 219:1 by implementing a bespoke encoding of this information.Re: Show HN: A 166 KB file for cross compiling glibc for any version, any target
#3Can I use that outside of Zig, for compiling C++ code?
Re: Show HN: A 166 KB file for cross compiling glibc for any version, any target
#4Some context: In master branch of Zig right now (before https://github.com/ziglang/zig/pull/10330 is merged), status quo: $ cat ../lib/libc/glibc/*.txt | wc -c 205219 $ cat ../lib/libc/glibc/*.txt | xz | wc -c 22976 Zig supports targeting every version of glibc for any target architecture. The information required to do this takes up 200 KB installation size / 22 KB tarball size, and it has the following problems (wh…
Re: Show HN: A 166 KB file for cross compiling glibc for any version, any target
#5What does "targeting any glibc version" mean? Is it the solution to the problem where you have to compile on an ancient Debian version to produce a binary that works on all Linux distributions because it otherwise links to too-new symbol versions in glibc? Can I use that outside of Zig, for compiling C++ code?
Re: Show HN: A 166 KB file for cross compiling glibc for any version, any target
#6What does "targeting any glibc version" mean? Is it the solution to the problem where you have to compile on an ancient Debian version to produce a binary that works on all Linux distributions because it otherwise links to too-new symbol versions in glibc? Can I use that outside of Zig, for compiling C++ code?
Re: Show HN: A 166 KB file for cross compiling glibc for any version, any target
#7Re: Show HN: A 166 KB file for cross compiling glibc for any version, any target
#8Some context: In master branch of Zig right now (before https://github.com/ziglang/zig/pull/10330 is merged), status quo: $ cat ../lib/libc/glibc/*.txt | wc -c 205219 $ cat ../lib/libc/glibc/*.txt | xz | wc -c 22976 Zig supports targeting every version of glibc for any target architecture. The information required to do this takes up 200 KB installation size / 22 KB tarball size, and it has the following problems (wh…
Totally off-topic: I installed Zig on Saturday afternoon and by the evening I had my first program do some useful stuff, on Sunday I added some C code, then added some tests and by Sunday evening I had a pure Zig project again (and afterwards learned that translate-to-zig is a thing). I gotta say I'm very impressed with Zig and partial evaluation is just such a nice, mentally simple technique for generics and lots of…
I think over time the C/C++ way is going to go the way of the dodo; IIRC, rust and go both use the prefix-[]. It creates a clear, unambiguous way of defining the type (no "spiral typing" jokes for the modern languages).
Re: Show HN: A 166 KB file for cross compiling glibc for any version, any target
#9Earlier quoted context omitted.
Totally off-topic: I installed Zig on Saturday afternoon and by the evening I had my first program do some useful stuff, on Sunday I added some C code, then added some tests and by Sunday evening I had a pure Zig project again (and afterwards learned that translate-to-zig is a thing). I gotta say I'm very impressed with Zig and partial evaluation is just such a nice, mentally simple technique for generics and lots of…
> the prefix-[] are kinda weird (just way too used to C/C++'s postfix array notation) I think over time the C/C++ way is going to go the way of the dodo; IIRC, rust and go both use the prefix-[]. It creates a clear, unambiguous way of defining the type (no "spiral typing" jokes for the modern languages).
Re: Show HN: A 166 KB file for cross compiling glibc for any version, any target
#10Some context: In master branch of Zig right now (before https://github.com/ziglang/zig/pull/10330 is merged), status quo: $ cat ../lib/libc/glibc/*.txt | wc -c 205219 $ cat ../lib/libc/glibc/*.txt | xz | wc -c 22976 Zig supports targeting every version of glibc for any target architecture. The information required to do this takes up 200 KB installation size / 22 KB tarball size, and it has the following problems (wh…