containerd / runwasi

Facilitates running Wasm / WASI workloads managed by containerd
Apache License 2.0
1.01k stars 82 forks source link

method not found in ScmpFilterContext #486

Open Wangyiwei-So opened 4 months ago

Wangyiwei-So commented 4 months ago

I try to compile runwasi in ubuntu: I tried ubuntu:23.10 container:

uname -a
Linux 004aed56de46 6.7.0-arch3-1 #1 SMP PREEMPT_DYNAMIC Sat, 13 Jan 2024 14:37:14 +0000 x86_64 x86_64 x86_64 GNU/Linux

and a ubuntu:20 machine

uname -a
Linux test 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

I installed dependencies

apt-get install -y build-essential
apt-get install -y protobuf-compiler
apt-get install -y libseccomp-dev

and got this message

make build FEATURES=wasmedge
error[E0599]: no method named `get_notify_fd` found for struct `ScmpFilterContext` in the current scope
   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libcontainer-0.3.0/src/seccomp/mod.rs:270:17
    |
270 |             ctx.get_notify_fd()
    |                 ^^^^^^^^^^^^^ method not found in `ScmpFilterContext`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `libcontainer` (lib) due to previous error
utam0k commented 4 months ago

May I ask you to make sure that you installed libseccomp-dev 2.5+.

Wangyiwei-So commented 4 months ago

May I ask you to make sure that you installed libseccomp-dev 2.5+.

thank you for your reply!

yes, 2.5.4 has been installed

apt-get install -y libseccomp-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libseccomp-dev is already the newest version (2.5.4-1ubuntu3).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
jprendes commented 4 months ago

Hi @Wangyiwei-So ,

Could you do cargo clean -p libseccomp -p libseccomp-sys and then try building again?

If you've tried building without installing libseccomp-dev, then the libseccomp and libseccomp-sys dependencies are build with partial support. If you don't run cargo clean ..., those dependencies will not be rebuilt with full support, even when you run make build ... just build ... again.

Wangyiwei-So commented 4 months ago

Thank you! @jprendes I tried the method you mentioned, but still...

$ cargo clean -p libseccomp -p libseccomp-sys
$ make build FEATURES=wasmedge
/bin/sh: 1: sudo: not found
cargo build --target=x86_64-unknown-linux-gnu --target-dir=./target/ -p containerd-shim-wasm --no-default-features --features generate_bindings 
   Compiling libseccomp-sys v0.2.1
   Compiling libseccomp v0.3.0
   Compiling libcontainer v0.3.0
error[E0599]: no method named `get_notify_fd` found for struct `ScmpFilterContext` in the current scope
   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libcontainer-0.3.0/src/seccomp/mod.rs:270:17
    |
270 |             ctx.get_notify_fd()
    |                 ^^^^^^^^^^^^^ method not found in `ScmpFilterContext`

For more information about this error, try `rustc --explain E0599`.
jsturtevant commented 4 months ago

@Wangyiwei-So Where did you get the FEATURES=wasmedge I don't believe we use the FEATURES env anywhere. Are you trying to build just wasmedge? If so can you try make build-wasmedge

For deps, did you run scripts/setup-linux.sh? It has a few other deps than just the three listed above

utam0k commented 4 months ago

Just be sure to use the latest runwasi code.

Compiling libcontainer v0.3.0

Wangyiwei-So commented 4 months ago

@jsturtevant @utam0k thank you both very much, i tried two methods, but report same error. do you have builder image?

utam0k commented 4 months ago

What's a builder image? Dockerfile?

Wangyiwei-So commented 4 months ago

@utam0k yes. sorry i use google translator

jprendes commented 4 months ago

@Wangyiwei-So , you could run the makefile with CARGO=cross, that will run the build inside a Dockerfile.

make CARGO=cross build-wasmedge

You will need to install cross-rs with

cargo install cross --git https://github.com/cross-rs/cross
Mossaka commented 3 months ago

Related to this issue, youki/libcontainer starts to implement their own seccomp crate which may resolve this issue.

https://github.com/containers/youki/issues/2724

jsturtevant commented 3 weeks ago

I just ran into this on WSL, @Wangyiwei-So are you using wsl as well?