runwasi icon indicating copy to clipboard operation
runwasi copied to clipboard

method not found in ScmpFilterContext

Open Wangyiwei-So opened this issue 1 year ago • 13 comments

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

Wangyiwei-So avatar Feb 19 '24 03:02 Wangyiwei-So

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

utam0k avatar Feb 19 '24 12:02 utam0k

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.

Wangyiwei-So avatar Feb 20 '24 06:02 Wangyiwei-So

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.

jprendes avatar Feb 20 '24 10:02 jprendes

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`.

Wangyiwei-So avatar Feb 22 '24 03:02 Wangyiwei-So

@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

jsturtevant avatar Feb 22 '24 17:02 jsturtevant

Just be sure to use the latest runwasi code.

Compiling libcontainer v0.3.0

utam0k avatar Feb 25 '24 12:02 utam0k

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

Wangyiwei-So avatar Feb 29 '24 01:02 Wangyiwei-So

What's a builder image? Dockerfile?

utam0k avatar Mar 02 '24 06:03 utam0k

@utam0k yes. sorry i use google translator

Wangyiwei-So avatar Mar 02 '24 07:03 Wangyiwei-So

@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

jprendes avatar Mar 02 '24 07:03 jprendes

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

Mossaka avatar Apr 08 '24 00:04 Mossaka

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

jsturtevant avatar Jun 13 '24 21:06 jsturtevant

I ran into this on WSL as well - managed to get make build running after:

cargo clean
cargo clean -p libseccomp -p libseccomp-sys
# making just I have libseccomp-dev 2.5+

danbugs avatar Aug 13 '24 16:08 danbugs