bytedance / monoio

Rust async runtime based on io-uring.
Apache License 2.0
4.02k stars 226 forks source link

statx related tests failed for `undefined reference to 'statx'` #281

Closed Xuanwo closed 3 months ago

Xuanwo commented 3 months ago

Version List the versions of all monoio crates you are using. The easiest way to get this information is using cargo tree subcommand:

on main branch.

Platform

Not related.

Description

https://github.com/bytedance/monoio/actions/runs/10211991928/job/28254402664?pr=279

error: could not compile `monoio` (test "unix_seqpacket") due to 1 previous error
error: linking with `arm-linux-gnueabihf-gcc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/rust/lib/rustlib/x86_64-unknown-linux-gnu/bin:/rust/lib/rustlib/x86_64-unknown-linux-gnu/bin:/rust/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/rust/bin" VSLANG="1033" "arm-linux-gnueabihf-gcc" "/tmp/rustcC2YCWQ/symbols.o" "/target/armv7-unknown-linux-gnueabihf/debug/deps/fs_metadata-07ea809973940676.fs_metadata.e797881e0b08203d-cgu.0.rcgu.o" "/target/armv7-unknown-linux-gnueabihf/debug/deps/fs_metadata-07ea809973940676.fs_metadata.e797881e0b08203d-cgu.1.rcgu.o" "/target/armv7-unknown-linux-gnueabihf/debug/deps/fs_metadata-07ea809973940676.6qfmu8fkhbn8hvf93g14s144t.rcgu.o" "-Wl,--as-needed" "-L" "/target/armv7-unknown-linux-gnueabihf/debug/deps" "-L" "/target/debug/deps" "-L" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-Wl,-Bstatic" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libtempfile-2f7727decbc2299e.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libfastrand-2ce4d42da5bf7040.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/librustix-fe3eada6d0e885ae.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libbitflags-2ef42a72c8bd88fe.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/liblinux_raw_sys-9314d90cbd162947.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libtest-fb7e6791e3a3a295.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libgetopts-60769ce9a81f7d58.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libunicode_width-4cf3667cc7c41e14.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/librustc_std_workspace_std-00343273908eac91.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libmonoio-20b37d26776606af.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libnix-e1f219ff0a903e5a.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libmemoffset-50b45772f62214fb.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libpin_utils-6dedcac37301ebb3.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libbitflags-5670107b56f382ad.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libcfg_if-a66a031c5ea69a8c.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libbytes-34e50d92a8d20da5.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libmio-d184dc0dee2dfcdf.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/liblog-c29b1d3bf9ebcad7.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libmemchr-8b2b45fb30cc7633.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libpin_project_lite-0ada461f5afe9737.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/libsocket2-9c7d7b4483e5d7fe.rlib" "/target/armv7-unknown-linux-gnueabihf/debug/deps/liblibc-fc2ce25757c8b8fa.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libstd-6e96b02933c46706.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libpanic_unwind-3b6039c203220145.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libobject-cac6ec52dd59f38b.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libmemchr-338bcb43fc5b7a33.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libaddr2line-ec84ce19a99dc14a.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libgimli-4a32e72434f31256.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/librustc_demangle-fbcb5060c3eb8605.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libstd_detect-163afbc8fe3247f8.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libhashbrown-752c0e7e0f2ba6be.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/librustc_std_workspace_alloc-1c841b38ebbd6c9f.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libminiz_oxide-ab2a106a2cf963c5.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libadler-3ef2cb6e8649a8a3.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libunwind-f923286d2eab6750.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libcfg_if-d0f60c22656db634.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/liblibc-7e858a0b28d0822b.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/liballoc-92441624d4e41991.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/librustc_std_workspace_core-83964be755f84e5c.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libcore-c2dec278aa26f83e.rlib" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libcompiler_builtins-b240e9bb95c8d274.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-o" "/target/armv7-unknown-linux-gnueabihf/debug/deps/fs_metadata-07ea809973940676" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libstd-6e96b02933c46706.rlib(std-6e96b02933c46706.std.eb022c7dfe60fd8d-cgu.0.rcgu.o): In function `std::sys::pal::unix::fs::try_statx::statx::hf8e4d3af91c7c73e':
          /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys/pal/unix/weak.rs:170: undefined reference to `statx'
          /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys/pal/unix/weak.rs:170: undefined reference to `statx'
          /rust/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libstd-6e96b02933c46706.rlib(std-6e96b02933c46706.std.eb022c7dfe60fd8d-cgu.0.rcgu.o): In function `std::sys::pal::unix::fs::try_statx::ha8c056006aaade32':
          /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/sync/atomic.rs:(.text._ZN3std3sys3pal4unix2fs9try_statx17ha8c056006aaade32E+0x3a4): undefined reference to `statx'
          /target/armv7-unknown-linux-gnueabihf/debug/deps/libmonoio-20b37d26776606af.rlib(monoio-20b37d26776606af.monoio.70c20d98db2a308-cgu.1.rcgu.o): In function `_$LT$monoio..driver..op..statx..Statx$LT$monoio..driver..shared_fd..SharedFd$GT$$u20$as$u20$monoio..driver..op..OpAble$GT$::legacy_call::hba7aaf8e6b95d0c7':
          /project/monoio/src/driver/util.rs:65: undefined reference to `statx'
          /target/armv7-unknown-linux-gnueabihf/debug/deps/libmonoio-20b37d26776606af.rlib(monoio-20b37d26776606af.monoio.70c20d98db2a308-cgu.1.rcgu.o): In function `_$LT$monoio..driver..op..statx..Statx$LT$alloc..ffi..c_str..CString$GT$$u20$as$u20$monoio..driver..op..OpAble$GT$::legacy_call::h7a723aa0c5d5a90d':
          /project/monoio/src/driver/util.rs:65: undefined reference to `statx'
          collect2: error: ld returned 1 exit status

  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)
Xuanwo commented 3 months ago

Hi, @Lzzzzzt, do you have any idea to get it fixed? Should we bump cross?

Lzzzzzt commented 3 months ago

Hi, @Lzzzzzt, do you have any idea to get it fixed? Should we bump cross?

if use the main branch of cross, it should work fine, expect the riscv, due to a llvm bug.

Xuanwo commented 3 months ago

if use the main branch of cross, it should work fine, expect the riscv, due to a llvm bug.

Got it. So we can:

Would you like to start a PR for this?

Lzzzzzt commented 3 months ago

if use the main branch of cross, it should work fine, expect the riscv, due to a llvm bug.

Got it. So we can:

  • use cross from main branch to fix most cases.
  • disable tests on riscv first until llvm bug fixed.

Would you like to start a PR for this?

sure

Xuanwo commented 3 months ago

sure

Thanks a lot!

Lzzzzzt commented 3 months ago

Hi, @Lzzzzzt, do you have any idea to get it fixed? Should we bump cross?

if use the main branch of cross, it should work fine, expect the riscv, due to a llvm bug.

riscv's bug fixed, but other arch meets a glibc version problem

Xuanwo commented 3 months ago

Maybe we can try use zig for those platforms: https://github.com/cross-rs/cross/blob/main/docs/config_file.md#buildzig

Lzzzzzt commented 3 months ago

Maybe we can try use zig for those platforms: https://github.com/cross-rs/cross/blob/main/docs/config_file.md#buildzig

I haven't use zig to compile before, but I'd like to have a try

Lzzzzzt commented 3 months ago

Maybe we can try use zig for those platforms: https://github.com/cross-rs/cross/blob/main/docs/config_file.md#buildzig

I haven't use zig to compile before, but I'd like to have a try

if use zig, then the previous error will happen

image
Lzzzzzt commented 3 months ago

Hi, @Lzzzzzt, do you have any idea to get it fixed? Should we bump cross?

if use the main branch of cross, it should work fine, expect the riscv, due to a llvm bug.

riscv's bug fixed, but other arch meets a glibc version problem

but i can run on my own x64 pc...

Xuanwo commented 3 months ago

but i can run on my own x64 pc...

Cross uses a Docker container to execute commands. This may be because the container only provides an outdated version of glibc.

Lzzzzzt commented 3 months ago

but i can run on my own x64 pc...

Cross uses a Docker container to execute commands. This may be because the container only provides an outdated version of glibc.

also work well on my m1 mac

Lzzzzzt commented 3 months ago

but i can run on my own x64 pc...

Cross uses a Docker container to execute commands. This may be because the container only provides an outdated version of glibc.

Cross use ubuntu:20.04 as base image except the riscv, which use ubuntu:22.04, I think we can use customized dockerfile to fix the glibc version problem.

Xuanwo commented 3 months ago

Cross use ubuntu:20.04 as base image except the riscv, which use ubuntu:22.04, I think we can use customized dockerfile to fix the glibc version problem.

Looks good to me

Lzzzzzt commented 3 months ago

Looks good to me

I fix the problem by following this, and I have already made a PR.

PTAL @Xuanwo

Xuanwo commented 3 months ago

Thank you @Lzzzzzt for fixing this!