You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rustix: on Linux, support a build without linux-raw-sys (#1478)
* rustix: on Android, support a build without linux-raw-sys
Rustix support was added to Mesa3D recently, but it only works
with the linux-raw-sys backend. On Linux, even the libc
backend, there is a dependency on linux-raw-sys for certain ABI
definitions.
When updating rustix in Android to support this, I realized only
the libc backend is supported in Android. This is because
Android as a platform wants to discourage raw syscalls, and to
be able to globally update libc.
Features like fdtrack would not work with the linux-raw-sys backend:
https://android.googlesource.com/platform/bionic/+/HEAD/docs/fdtrack.md
Given Android wants to incentize use of libc only, this MR introduces
the concept of "linux-raw-dep". This means that linux-raw-sys is
present as a dependency for the user. This will be on by default
even for the libc backend, but will be turned off for Android (this
is reflected in the build.rs script).
This will also help others who don't need all the features rustix
offers on Linux, so they have one less dependency to maintain. They
may append "--cfg=rustix_no_linux_raw" to Rust flags skip building
the linux raw backend. Mesa3D will use this.
Tested via:
cargo build --target arm-linux-androideabi --features=use-libc,net,std,alloc,event,fs,mm,param,pipe,use-libc-auxv,libc_errno
and on Linux with the proper RUSTFLAGS set. The Github workflows have
been modified to only use the current subset of features using in AOSP:
https://android.googlesource.com/platform/external/rust/android-crates-io/+/refs/heads/main/crates/rustix/Android.bp
That is the source of truth for an Android integration and the CI only
needs to test that. Additional features may be added as needed in the
future.
* rustix: fixes for Android musl build
Android doesn't only have a bionic toolchain, but musl
toolchain for components built on the build workstation.
---------
Co-authored-by: Gurchetan Singh <[email protected]>
0 commit comments