versatica / mediasoup

Cutting Edge WebRTC Video Conferencing

Home Page:https://mediasoup.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Rust] Unable to build mediasoup > 0.12 with Docker

PaulOlteanu opened this issue · comments

I'm trying to update from mediasoup 0.12 to 0.15, but versions 0.13 and above fail to compile when building inside of docker:

16.46 error: failed to run custom build command for `mediasoup-sys v0.7.2`
16.46 
16.46 Caused by:
16.46   process didn't exit successfully: `/target/debug/build/mediasoup-sys-8057748db0303d06/build-script-build` (exit status: 101)
16.46   --- stderr
16.46   thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/mediasoup-sys-0.7.2/build.rs:39:14:
16.46   Failed to generate Rust code from flatbuffers: Unable to write the file to rustfmt
16.46 
16.46   Caused by:
16.46       Broken pipe (os error 32)
16.46 
16.46   Location:
16.46       /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/planus-codegen-0.4.0/src/rust/mod.rs:985:14
16.46   stack backtrace:
16.46      0: rust_begin_unwind
16.46                at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
16.46      1: core::panicking::panic_fmt
16.46                at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
16.46      2: core::result::unwrap_failed
16.46                at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1653:5
16.46      3: core::result::Result<T,E>::expect
16.46                at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1034:23
16.46      4: build_script_build::main
16.46                at ./build.rs:38:9
16.46      5: core::ops::function::FnOnce::call_once
16.46                at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
16.46   note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

It's failing here in build.rs, because of this failing in planus-codegen.

This is reproducible just by creating a new Rust project, adding mediasoup = "0.15" to the dependencies, and trying to build a simple image with docker build .

# Dockerfile
FROM rust:1.75-bookworm
COPY . .
# RUN apt update && apt install -y pip
ENV RUST_BACKTRACE=full
ENV CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true
RUN cargo build

I've also created an issue on planus here, but thought it might be good to have here too

Are you sure you have rustfmt installed in a container?

🤦‍♂️ rustfmt was not installed, that fixed it

Thanks

I commented upstream, ideally it shouldn't be required in the first place, but for now it is.