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

Add crate feature to disable libwasmedge static linking #210

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

jprendes
Copy link
Collaborator

Fixes #206

@jprendes
Copy link
Collaborator Author

@cpuguy83 @ipuustin PTAL :-)

@cpuguy83
Copy link
Member

Can we add tests to validate static vs dynamic linking?

@cpuguy83
Copy link
Member

I say this as I'm trying to validate this manually and no matter what I do I'm getting a dynamically linked binary.

cargo build --package containerd-shim-wasmedge --features "static"

@jprendes
Copy link
Collaborator Author

It would still generate a dynamically linked binary, just not to libwasmedge.so (it would still dynamically link to libc, libsystemd, etc).

This is similar to how the wasmtime shim doesn't link against a libwasmtime.so but its still a dynamically linked binary.

If you do ldd containerd-shim-wasmedge you should see an entry to libwasmedge.so only when the static feature is enabled (and its enabled by default).

I can still add a test for it.

Copy link
Member

@Mossaka Mossaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Mossaka Mossaka merged commit 180b63d into containerd:main Aug 2, 2023
7 checks passed
@cpuguy83
Copy link
Member

cpuguy83 commented Aug 3, 2023

I don't see wasmedge.so in either case.

$ cargo build --package containerd-shim-wasmedge --features "static"
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
$ ldd ./target/debug/containerd-shim-wasmedge-v1
        linux-vdso.so.1 (0x00007ffd3e5d3000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007faadb897000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007faadb66b000)
        libseccomp.so.2 => /lib/x86_64-linux-gnu/libseccomp.so.2 (0x00007faadb64b000)
        libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007faadb5fd000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007faadb3d5000)
        /lib64/ld-linux-x86-64.so.2 (0x00007faae325f000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007faadb3b3000)
        libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007faadb2ec000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007faadb2c1000)
        libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007faadb1f2000)
        liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007faadb1d2000)
        libcap.so.2 => /lib/x86_64-linux-gnu/libcap.so.2 (0x00007faadb1c7000)
        libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007faadb087000)
        libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007faadb061000)
$ cargo build --package containerd-shim-wasmedge --features "standalone"
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
$ ldd ./target/debug/containerd-shim-wasmedge-v1
        linux-vdso.so.1 (0x00007ffdc31ef000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0db3d53000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f0db3b27000)
        libseccomp.so.2 => /lib/x86_64-linux-gnu/libseccomp.so.2 (0x00007f0db3b07000)
        libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f0db3ab9000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0db3891000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f0dbb71b000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0db386f000)
        libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f0db37a8000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f0db377d000)
        libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007f0db36ae000)
        liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f0db368e000)
        libcap.so.2 => /lib/x86_64-linux-gnu/libcap.so.2 (0x00007f0db3683000)
        libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f0db3543000)
        libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f0db351d000)

@jprendes
Copy link
Collaborator Author

jprendes commented Aug 3, 2023

Indeed, my bad, the "static" feature is always enabled here.
I'm fixing that and adding a test in a new PR.

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

Successfully merging this pull request may close these issues.

Static compilation of libwasmedge should be a crate feature
3 participants