Skip to content

Commit

Permalink
Cross-compile for aarch64-linux. (#96)
Browse files Browse the repository at this point in the history
* Cross-compile for aarch64-linux.

This architecture has a different c_char: u8, rather than i8.

Due to rust-lang/rust#113735, this causes a
build breakage, since CStr::from_ptr was documented to take an i8 but
actually takes a c_char.

* Fix some new nightly clippy findings

* Exclude systest from cross-compile

* Fix another clippy finding
  • Loading branch information
mutexlox-signal authored Oct 7, 2024
1 parent d9be0bf commit 90738b2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,24 @@ jobs:
shell: bash
run: rustup run ${{ matrix.rust }} cargo run -p systest

build_arm_linux:
name: Cross-compile for aarch64 linux

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Install Rust
shell: bash
run: rustup target add aarch64-unknown-linux-gnu

- name: Install crossbuild headers
shell: bash
run: sudo apt-get update && sudo apt-get install -y crossbuild-essential-arm64

- name: Build cross compile aarch64
shell: bash
run: cargo build --workspace --exclude systest --target aarch64-unknown-linux-gnu
2 changes: 1 addition & 1 deletion cubeb-api/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl<'a, F> StreamBuilder<'a, F> {
}
}

impl<'a, F> Default for StreamBuilder<'a, F> {
impl<F> Default for StreamBuilder<'_, F> {
fn default() -> Self {
StreamBuilder {
name: None,
Expand Down
8 changes: 4 additions & 4 deletions cubeb-core/src/device_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type CType = ffi::cubeb_device_collection;
#[derive(Debug)]
pub struct DeviceCollection<'ctx>(CType, &'ctx ContextRef);

impl<'ctx> DeviceCollection<'ctx> {
impl DeviceCollection<'_> {
pub(crate) fn init_with_ctx(ctx: &ContextRef, coll: CType) -> DeviceCollection {
DeviceCollection(coll, ctx)
}
Expand All @@ -24,7 +24,7 @@ impl<'ctx> DeviceCollection<'ctx> {
}
}

impl<'ctx> Drop for DeviceCollection<'ctx> {
impl Drop for DeviceCollection<'_> {
fn drop(&mut self) {
unsafe {
let _ = call!(ffi::cubeb_device_collection_destroy(
Expand All @@ -35,7 +35,7 @@ impl<'ctx> Drop for DeviceCollection<'ctx> {
}
}

impl<'ctx> ::std::ops::Deref for DeviceCollection<'ctx> {
impl ::std::ops::Deref for DeviceCollection<'_> {
type Target = DeviceCollectionRef;

#[inline]
Expand All @@ -45,7 +45,7 @@ impl<'ctx> ::std::ops::Deref for DeviceCollection<'ctx> {
}
}

impl<'ctx> ::std::convert::AsRef<DeviceCollectionRef> for DeviceCollection<'ctx> {
impl ::std::convert::AsRef<DeviceCollectionRef> for DeviceCollection<'_> {
#[inline]
fn as_ref(&self) -> &DeviceCollectionRef {
self
Expand Down

0 comments on commit 90738b2

Please sign in to comment.