rust-vmm / seccompiler

Provides easy-to-use Linux seccomp-bpf jailing.

Home Page:https://crates.io/crates/seccompiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to cross compile for OpenWrt target mips-unknown-linux-musl

sn99 opened this issue · comments

commented

related to: SubconsciousCompute/seccomp-pledge#5

dora@openwrtbuildpc:~/coderepo/openwrt/seccomp-pledge$ cargo build --release --target mips-unknown-linux-musl
   Compiling serde v1.0.152
   Compiling libc v0.2.139
   Compiling serde_json v1.0.91
   Compiling itoa v1.0.5
   Compiling ryu v1.0.12
   Compiling optional-fields-serde-macro v0.1.1
   Compiling optional-field v0.1.3
   Compiling seccompiler v0.3.0
   Compiling seccomp-pledge v0.1.0 (/home/dora/coderepo/openwrt/seccomp-pledge)
error[E0432]: unresolved import `seccompiler::BpfMap`
 --> src/main.rs:2:5
  |
2 | use seccompiler::BpfMap;
  |     ^^^^^^^^^^^^^^^^^^^ no `BpfMap` in the root

error[E0433]: failed to resolve: could not find `TargetArch` in `seccompiler`
   --> src/main.rs:411:22
    |
411 |         seccompiler::TargetArch::x86_64,
    |                      ^^^^^^^^^^ could not find `TargetArch` in `seccompiler`

error[E0425]: cannot find function `compile_from_json` in crate `seccompiler`
   --> src/main.rs:409:66
    |
409 | ...compiler::compile_from_json(
    |              ^^^^^^^^^^^^^^^^^ not found in `seccompiler`

error[E0425]: cannot find function `apply_filter` in crate `seccompiler`
   --> src/main.rs:428:21
    |
428 |     if seccompiler::apply_filter(filter).is_err() {
    |                     ^^^^^^^^^^^^ not found in `seccompiler`

Some errors have detailed explanations: E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `seccomp-pledge` due to 4 previous errors
dora@openwrtbuildpc:~/coderepo/openwrt/seccomp-pledge$

I think the issue is in the linker during cross compiling, seccompiler doesn’t define a linker target for mips https://github.com/rust-vmm/seccompiler/blob/main/.cargo/config, I found this that can help though rust-lang/rust#37507 (comment)

This library is only supported for x86_64 and aarch64.