Add nix derivation for static builds#366
Conversation
|
The latest version at least builds the static binary: |
|
@saschagrunert when I download the original https://github.com/containers/crun/releases/download/0.13/crun-0.13-static-x86_64 it should look like: |
|
I think libcap should also be static. I've tried with this version: and I get: It is still missing libseccomp. Also, could we move it under |
I thinks if it locate under People from CRI-O and Podman seems putting |
Good point, If CRI-O and Podman are already doing it, let's leave |
|
We're getting closer to an actual solution. The current version is able to build, but I'm wondering why it does not pickup the static libseccomp.a: I also had to skip the tests (via I think that's not good ☝️ Since we're using glibc, it will also complain about some runtime deps which are still needed when linking statically: Beside that, the libocispec is complaining that it still tries to be linked dynamically: |
|
One solution could be to switch to musl libc. This would result in a much higher build time for sure. |
Maybe with |
It should not hurt to add that. 👍 |
I think the issue is with using pkg-config for seccomp. If I revert 3310cd2 then it works fine. @hswong3i could we rewrite 3310cd2 to not use pkg-config? Is it still needed now that we have a static build? :-) |
Iet’s revert it, if nix build works and crun master won’t works for openSUSE 15.1/15.2 due to systemd 234 < 237, we should have no active reason to keep it ;-P |
|
Yes the PKG config seems to fail in the configure script, not sure what the exact reason is because usually it should find the right libs. In any case, we now have support for criu as well: |
I think it is better if we revert the patch and not use pkg-config. It is not needed anymore now that we have a proper static build :-) |
I opened the PR for the revert in #368 |
|
P.S. I will create an Ansible Role for install nix with root, therefore update role for crun building static binary with nix; will also PR for .travis.yml so we could include nix build by ourselves independently. |
we are currently creating a static binary with |
81a6f9b to
3ed8c19
Compare
We probably should push the static builder somewhere since it contains dependencies which take some time to compile. I'll change the Dockerfile and Makefile accordingly to the nix build. |
affa6d3 to
71051b9
Compare
|
Alright, ready for review. Something like |
|
thanks, it LGTM. Could you just tweak the
yes, I was planning on doing it (https://quay.io/organization/crun) but I never started working on it :-) |
|
We have quay.io/containers |
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
| make -C contrib/static-builder-x86_64 build-image RUNTIME=$RUNTIME | ||
| make -C contrib/static-builder-x86_64 build-crun CRUN_SOURCE=$(pwd) RUNTIME=$RUNTIME | ||
|
|
||
| strip static-build/crun |
There was a problem hiding this comment.
the nix build process already strips
|
I thought the build will take forever but now I'm kinda impressed that we managed to build the binary in roughly 11 minutes. |
|
thanks, all green now! :) |
yes, 11 minutes is not too bad. I think it is always faster than Travis |
Switching from the current static build to a nix based derivation.
Fixes #364