4 ms·
So does that mean no statically linked binaries since glibc can't be statically linked?
by ashishmax31 6y ago
So does that mean no statically linked binaries since glibc can't be statically linked?
- deleted 6y ago[deleted]
- tephra 6y agoOpenBSD does not use glibc.
- dilyevsky 6y agoNot glibc in mac os/openbsd case but yeah can’t have fully static go binaries on those.
- pjmlp 6y agoglibc is Linux only.
- sanxiyn 6y agoglibc also supports Hurd.
- pjmlp 6y agoYep, it is already at 1.0 finally?
- Blikkentrekker 6y agoDid Debian not also port most of glibc to support FreeBSD's kernel?
- sanxiyn 6y agoYes they did. See http://www.nongnu.org/glibc-bsd/ http://www.nongnu.org/glibc-bsd/.
- makapuf 6y agoBut if even Go can't use static binaries, does that mean that static binaries are not supported by those systems ?
- ashishmax31 6y agoI would think so. Can anyone eli5 why statically linking binaries is a big deal? Even light weight container oriented linux distributions like alpine ship with musl. In which scenario would it find it use cases?
- saagarjha 6y agoSome have the viewpoint that static linking allows for what is essentially dependency pinning of binaries.
- q3k 6y agoMassively simplifies the build process, especially for cross-compilation. You can just build the binary, copy it over and run it, without having to ever touch containers, or having to worry about sysroots. You can go ahead and do the following on your Mac: GOARCH=riscv GOOS=linux go build to build a binary that just runs on Linux on RISC-V.
- arp242 6y agoOne advantage is that you need to worry less about versions; if I build a dynamic library that uses a feature from GNU libc 2.30, and someone tries to run it with GNU libc 2.23 then they will get an error. These versions are not chosen at random: I ran in to this issue with people trying to run my binary on Ubuntu 16.04 (LTS release), which was solved by linking it statically. Also, people may use musl libc, and while it has some compatibility with GNU libc this is far from complete. So in short, linking it statically means it will work for the largest amount of people with a minimal of fuss for both the person building the binaries, and the people running them. As people have mentioned, these issues are less present on non-Linux systems.
- account42 6y ago