Skip to content
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

How to Nix static build with wasmedge? #922

Open
Edingh opened this issue May 19, 2022 · 7 comments
Open

How to Nix static build with wasmedge? #922

Edingh opened this issue May 19, 2022 · 7 comments
Assignees

Comments

@Edingh
Copy link

Edingh commented May 19, 2022

The way you recommended to static build using Nix does not include wasmedge support.
So how to Nix static build with wasmedge? Is it possible?
If it's possible, would you like to release the binary with wasmedge support?
Thanks for the hlep!

@chairwa
Copy link

chairwa commented May 20, 2022

If I change nix as follows, the result crun will become dynamic.

vi default-arm64.nix
configureFlags = [ "--enable-static" "--with-wasmedge" ]

./result/bin/crun --version
crun version 1.4.5.0.0.0.25-7077-dirty
commit: 7077fa1
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +WASM:wasmedge +YAJL

file ./result/bin/crun
./result/bin/crun: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=28f43744c5fe655de47f339076eebcc64dc27cc5, for GNU/Linux 3.7.0, not stripped

@flouthoc
Copy link
Collaborator

Hi @Edingh , I don't think crun supports static binary with wasm support out of the box as of now.I think code would need a slight refactor since crun uses dlopen and dlsym and I don't know if we will loose benefits of static linking while still using dlopen under the hood. @giuseppe are there any drawbacks of dlopen and dlsym for static linking.

Since all the runtimes already ship static library i think it should not be too hard with a slight refactor but afaik its not on the roadmap yet so maybe we can keep issue open till we get more request for it ?

@giuseppe
Copy link
Member

we would need to statically build and link wasmedge as well, and not use dlopen and dlsym.

@flouthoc
Copy link
Collaborator

Yes I think it would be a small refactor. I'll try checking this issue.

@flouthoc flouthoc self-assigned this May 25, 2022
@giuseppe
Copy link
Member

I don't think it is a high priority issue that you should hurry to look at. Still it is not clear what are the advantages

@rhatdan
Copy link
Member

rhatdan commented May 25, 2022

I would leave this to community. Quite often people say they want static and then they disappear.

@chairwa
Copy link

chairwa commented May 26, 2022

As you can see, docker release include static build runc binary; and it can run on Android and other linuxKernel-based OS.
https://download.docker.com/linux/static/stable/aarch64/docker-20.10.16.tgz

k3s (or even almost all k8s-related project) also released in static build binary.

This way (static build binary), we can extend crun usage range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants