Skip to content

Conversation

@luodeb
Copy link

@luodeb luodeb commented Nov 20, 2025

--- stderr
  /home/debin/.cargo/git/checkouts/lwext4_rust-54dccac8b9756226/033fa2c/c/lwext4/src/ulibc.c: In function ‘fflush’:
  /home/debin/.cargo/git/checkouts/lwext4_rust-54dccac8b9756226/033fa2c/c/lwext4/src/ulibc.c:73:18: warning: unused parameter ‘f’ [-Wunused-parameter]
     73 | int fflush(FILE *f)
        |            ~~~~~~^
  /home/debin/.cargo/git/checkouts/lwext4_rust-54dccac8b9756226/033fa2c/c/lwext4/src/ulibc.c: In function ‘qsort’:
  /home/debin/.cargo/git/checkouts/lwext4_rust-54dccac8b9756226/033fa2c/c/lwext4/src/ulibc.c:159:42: warning: cast between incompatible function types from ‘__compar_fn_t’ {aka ‘int (*)(const void *, const void *)’} to ‘int (*)(const void *, const void *, void *)’ [-Wcast-function-type]
    159 |         return qsort_r(base, nel, width, (__compar_d_fn_t)comp, NULL);
        |                                          ^
  /home/debin/.cargo/git/checkouts/lwext4_rust-54dccac8b9756226/033fa2c/c/lwext4/src/ulibc.c:159:16: warning: ISO C forbids ‘return’ with expression, in function returning void [-Wpedantic]
    159 |         return qsort_r(base, nel, width, (__compar_d_fn_t)comp, NULL);
        |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/debin/.cargo/git/checkouts/lwext4_rust-54dccac8b9756226/033fa2c/c/lwext4/src/ulibc.c:154:6: note: declared here
    154 | void qsort(void *base,
        |      ^~~~~

  thread 'main' panicked at /home/debin/.cargo/registry/src/rsproxy.cn-e3de039b2554c837/bindgen-0.72.1/codegen/mod.rs:939:25:
  assertion `left == right` failed: Target platform requires `--no-size_t-is-usize`. The size of `ssize_t` (4) does not match the target pointer size (8)
    left: 4
   right: 8
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
make[2]: *** [scripts/make/build.mk:53: _cargo_build] Error 101
make[2]: Leaving directory '/home/debin/Codes/starry/starrys/StarryOS-Realtek/arceos'
make[1]: *** [Makefile:39: build] Error 2
make[1]: Leaving directory '/home/debin/Codes/starry/starrys/StarryOS-Realtek'
make: *** [Makefile:52: opi5p] Error 2

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bindgen compilation failure encountered during cross-compilation for 64-bit targets. The error occurred because bindgen detected that ssize_t was 4 bytes while the target platform had 8-byte pointers, causing an assertion failure.

  • Adds .size_t_is_usize(false) to the bindgen builder configuration to handle cross-compilation scenarios where C's size_t doesn't match Rust's target pointer size

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AsakuraMizu
Copy link

Which platform are you using to build this? We haven't encountered this problem before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants