I have a Dockerfile that runs a rust code that uses Soloud library. When trying to run the code on the Raspberry Pi 4 it crashes and gives this error:
[main] ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
Dockerfile.template
# Rust as the base image
FROM rust:1.78-slim AS builder
# Install dependencies
RUN apt-get update && apt-get install -y \
git \
cmake \
pkg-config \
libudev-dev \
libasound2-dev \
build-essential
# Create a new empty shell project
RUN USER=root cargo new --bin floor-rust
WORKDIR /usr/src/floor-rust
# Copy our manifests
COPY ./Cargo.* ./
RUN mkdir ./src && echo 'fn main() { println!("main"); }' > ./src/main.rs
RUN echo 'fn main() { println!("simulator"); }' > ./src/simulator.rs
# Build only the dependencies to cache them
RUN cargo build --bin real --release && rm src/*.rs
# Now that the dependency is built, copy your source code
COPY ./src ./src
COPY ./sfx ./sfx
RUN cargo build --bin real --release --target-dir .
RUN ls -la
# Now that the dependency is built, copy your source code
COPY ./src ./src
COPY ./sfx ./sfx
RUN touch -a -m ./src/main.rs
# Build for release.
RUN cargo build --release --target-dir .
# Chain builds for optimization
FROM balenalib/%%BALENA_ARCH%%-ubuntu:latest-run
RUN echo balenalib/%%BALENA_ARCH%%-debian:latest-run
# Install dependencies
RUN apt-get update && apt-get install -y \
alsa-utils
WORKDIR /usr/src/floor-rust
# Copy the binary
COPY --from=builder /usr/src/floor-rust/release/ ./release
# Run the server
CMD [ "./release/real" ]
I call Soloud from main:
use soloud::*;
fn main() {
let mut sound_player = Soloud::default().unwrap();
}
Can anyone suggest how to investigate this issue?