# Rust program with Soloud library, ALSA Error

**URL:** <https://forums.balena.io/t/rust-program-with-soloud-library-alsa-error/370687>\
**Category:** balenaSound\
**Tags:** raspberrypi4, sound\
**Created:** [June 7, 2024, 12:00pm UTC](https://forums.balena.io/t/rust-program-with-soloud-library-alsa-error/370687 "2024-06-07T12:00:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![valerian](https://avatars.discourse-cdn.com/v4/letter/v/977dab/32.png) [@valerian](https://forums.balena.io/u/valerian)\
**Post date:** [June 7, 2024, 12:00pm UTC](https://forums.balena.io/t/rust-program-with-soloud-library-alsa-error/370687/1 "2024-06-07T12:00:49Z")

</div>

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

```auto
# 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:

```auto
use soloud::*;

fn main() {
    let mut sound_player = Soloud::default().unwrap();
}

```

Can anyone suggest how to investigate this issue?
