New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libxml2: add static output #41915
libxml2: add static output #41915
Conversation
@GrahamcOfBorg build libxml2.static |
Success on x86_64-linux (full log) Attempted: libxml2.static Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: libxml2.static Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: libxml2 Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: libxml2 Partial log (click to expand)
|
Does this build on Darwin? |
Success on x86_64-linux (full log) Attempted: libxml2.static Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: libxml2.static Partial log (click to expand)
|
Failure on x86_64-darwin (full log) Attempted: libxml2.static Partial log (click to expand)
|
The failure on Darwin is due to a timeout on a dependency. |
This causes a large number of rebuilds, but it does not make any functional changes, so I think it's ok for master. |
I think we need to standardize how to handle static binaries. I'd prefer to make these optional with a flag like "enableStatic". Doing this for every package that can build statically doesn't make sense. Multiple outputs can still be used - it's just building statically every time seems like a huge added cost in aggregate. See: #39580 |
I agree that a standardized flag is a good idea. But I don't see a significant added cost in this case. It's a library, and all this does is put the already compiled Building entire applications statically is a different story... Maybe we should distinguish between building libraries (always with static output if supported) and applications (controlled by a global flag) |
The purpose of staging is to accumulate mass rebuilds, not to delay risky changes. Otherwise new pull requests can not be tested while master is being rebuilt, and it takes longer to notice any breakages on https://hydra.nixos.org/jobset/nixpkgs/trunk. I have reverted this on master in ea69fba and applied to staging in 819f47b. |
Shouldn't libxml2 install the .a files on its own? Anyway having a standardized ".a" output in https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/multiple-outputs.sh would be really useful for these cases anyway (we never want to put dynamic & static libraries side by side otherwise we will have huge closures). |
It apparently does that only when configured with
Sounds good. |
It does, now there is |
This reverts commit 819f47b on staging to prevent unneeded rebuild. That change leaves the static library in two outputs, "out" and "static", and has to be reimplemented and motivated.
I have reverted this on staging too in f5c8402 because it has to be changed anyway. You can submit a new PR for |
@orivej I need it to produce a static Go binary which also uses I will open a new PR, based on staging, with a static output and requested changes. Thanks for all of your comments! |
Or wait for #41935 be merged :/ |
Doesn't it require a compatible version of a dynamic glibc on the target system, as in https://tschottdorf.github.io/golang-static-linking-bug ? (But I suppose you could link with dynamic glibc yet static libxml2 and zlib.)
You may consider bundling your application with all dynamic dependencies, as in https://github.com/orivej/ldcp/ . |
@orivej I no longer have such binaries to get more details but I don't think it required a global glibc since I could run the produced static binary in a NixOS test VM (sandboxed). For my current usecase, I'd prefer to use static libraries because the project I'm compiling is doing this upstream, on Debian and Fedora distros. so I just want to do the same on NixOS. |
I don't know if this has to be conditional (such as
pkgs.zlib
that have a booleanstatic
argument) or not (such aspkgs.glibc
).Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)