cross-rs / cross

“Zero setup” cross compilation and “cross testing” of Rust crates
Apache License 2.0
6.21k stars 354 forks source link

Using cross for linux fails with: undefined reference to `memfd_create' #1510

Closed patrickelectric closed 4 weeks ago

patrickelectric commented 4 weeks ago
  = note: /target/x86_64-unknown-linux-gnu/release/deps/libnix-f82b5b7b4f999979.rlib(nix-f82b5b7b4f999979.nix.b4d0d405151210f5-cgu.04.rcgu.o): In function `nix::sys::memfd::memfd_create::hcab24415e5acb3e8':
          nix.b4d0d405151210f5-cgu.04:(.text._ZN3nix3sys5memfd12memfd_create17hcab24415e5acb3e8E+0x5): undefined reference to `memfd_create'
          collect2: error: ld returned 1 exit status

It works fine using cargo build locally.

Reference: https://github.com/patrickelectric/eframe_template/actions/runs/9419742036/job/25950196145#step:5:786

Emilgardis commented 4 weeks ago

memfd_create requires a newer glibc than what cross 0.2.5 provides by default. You need to use cross from the main branch or specify a newer image to use.

also, be advised that actions-rs is not maintained.

So, either install cross from the main branch with cargo install cross --git https://github.com/cross-rs/cross or specify a newer image in Cross.toml