Re:Zig cc: A drop-in replacement for GCC/Clang
by yjftsjthsd-h on Tuesday March 24, 2020 @07:35PM
(#22680222)
I know the ability exists, but I'm pretty sure that it's not exactly easy to get it working. Last time I tried, it immediately failed because my distribution wasn't shipping .a files (IIRC) for my installed libraries. There's a lot of little things that don't quite work because nobody's using them so they're harder to use so nobody uses them...
[ Parent
| on HN ]
Re:Zig cc: A drop-in replacement for GCC/Clang
by Reelin on Wednesday March 25, 2020 @02:56AM
(#22682534)
It's easy to get working provided that you compile _everything_ from source. You can either omit glibc from this, or accept that it will still dynamically load some stuff at runtime even when "statically" linked, or switch to musl. A nice benefit is that LTO can then be applied to the entire program as a whole.
Re:Zig cc: A drop-in replacement for GCC/Clang
by alexeldeib on Tuesday March 24, 2020 @07:50PM
(#22680344)
Yep, exactly this. And quirks of glibc and friends make fully static compilation likely to produce odd failures, unfortunately.
Re:Zig cc: A drop-in replacement for GCC/Clang
by saagarjha on Tuesday March 24, 2020 @09:43PM
(#22681199)
Glibc does not really support static linking.
Re:Zig cc: A drop-in replacement for GCC/Clang
by alexeldeib on Tuesday March 24, 2020 @10:10PM
(#22681371)
Kind of my point — so much software depends on it, it’s difficult to statically link more things.
Re:Zig cc: A drop-in replacement for GCC/Clang
by needs on Wednesday March 25, 2020 @09:08AM
(#22684136)
Musl is a pretty good replacement, I have been using it for years without any troubles.
Re:Zig cc: A drop-in replacement for GCC/Clang
by alexeldeib on Wednesday March 25, 2020 @02:28PM
(#22687139)
I like Musl, but it is a source of pain at times too:
https://github.com/kubernetes/kubernetes/issues/64924
https://github.com/kubernetes/kubernetes/issues/33554
Admittedly you could put that on the Kubernetes folks, but the same problem doesn't exist with glibc.
Re:Zig cc: A drop-in replacement for GCC/Clang
by Hello71 on Tuesday March 24, 2020 @10:13PM
(#22681377)
I don't see how zig cc would help with that. Your distribution probably also doesn't ship all the source files for your packages either, and there's no other way to statically link.
Re:Zig cc: A drop-in replacement for GCC/Clang
by LessDmesg on Wednesday March 25, 2020 @02:43AM
(#22682492)
Gentoo does.
Re:Zig cc: A drop-in replacement for GCC/Clang
by Hello71 on Wednesday March 25, 2020 @08:00AM
(#22683747)
I've used Gentoo for almost a decade now, and no, that's not true. emerge doesn't just randomly keep source files on disk, and certainly not in a form easy to link to. In fact, Gentoo is worse than Debian for static linking, because not all packages have IUSE=static-libs. If it doesn't, you need to patch that ebuild and potentially many dependencies to support it. On the other hand, on Debian, the standard is for -dev packages to come with both headers and static libraries.