juliaup
juliaup copied to clipboard
Link crt statically on Linux
Note that regardless of what platform we build these on, we should be testing them on x86-linux-gnu, because we need to make sure that our binaries work on systems that have glibc on the system (and do not have musl on the system).
It's fine to test on x86_64-linux-musl, as long as we also test on x86_64-linux-gnu.
Right now I'm under the impression that we can either link glibc or musl statically. If that holds for all the platforms, which one should we chose? glibc somehow seems the safer option to me, or not?
The original suggestion for all of this from @SaadiSave had the following additional arguments:
-Clto=fat -Cembed-bitcode=yes
@SaadiSave should we use those? It is not clear to me what they do :)
The other open question is: are we ok to just statically link glibc here? Would there be any benefit in using musl instead? @DilumAluthge any thoughts on that?
I'm far from an expert here, but it was my understand that glibc cannot be linked statically without breaking some things.
The original suggestion for all of this from @SaadiSave had the following additional arguments:
-Clto=fat -Cembed-bitcode=yes@SaadiSave should we use those? It is not clear to me what they do :)
@davidanthoff
lto is link-time-optimization embed-bitcode is required for lto to work
LTO not really required, that's just what I use when building locally. But it might provide a speed boost because the compiler will be able to inline more and eliminate more dead code and unused branches. Upto you whether you want to use it. It also doesn't work best with dynamically linked targets, which is what the other targets for juliaup are. But with x86_64-unknown-linux-musl, I'd recommend enabling it.
The other open question is: are we ok to just statically link glibc here? Would there be any benefit in using musl instead? @DilumAluthge any thoughts on that?
My original suggestion had the target x86_64-unknown-linux-**musl**. Static linking doesn't work well with glibc, while musl is designed for static linking. You should do it for all linux targets where it's working, e.g. aarch64 or i686.
Hopefully this fixes https://github.com/JuliaLang/juliaup/issues/321.
Merged a different version of this on main.