Cannot install rust crate on Windows: mediasoup-sys fails

Hi, I am unable to install the mediasoup rust crate on windows. I have:

  • Node v18.20.5
  • Python 3.12.2
  • Rust 1.84.1
  • Visual Studio Build Tools 2017 15.9.69 with no additional workloads
  • Visual Studio Community 2022 17.12.4 with “.NET desktop environment” and “Desktop development with C++” installed, all up-to-date.

Here’s the last excerpt of the log when it errors as it’s over 10,000 lines long:


  Program flatc found: YES (overridden)

  Executing subproject wingetopt

  wingetopt| Project name: wingetopt
  wingetopt| Project version: 0.95
  wingetopt| C compiler for the host machine: cl (msvc 19.42.34436 "Microsoft (R) C/C++ Optimizing Compiler Version 19.42.34436 for x64")
  wingetopt| C linker for the host machine: link link 14.42.34436.0
  wingetopt| Build targets in project: 37
  wingetopt| Subproject wingetopt finished.

  Build targets in project: 44

  mediasoup-worker undefined

    Subprojects
      abseil-cpp : YES
      catch2     : YES
      flatbuffers: YES
      libsrtp2   : YES
      libuv      : YES
      openssl    : YES
      usrsctp    : YES
      wingetopt  : YES

    User defined options
      bindir     :
      buildtype  : release
      libdir     :
      prefix     : C:/Users/user/server/target/debug/build/mediasoup-sys-7f374e33af0e5be8/out
      vsenv      : True
      b_ndebug   : true

  Found ninja.exe-1.10.2.git.kitware.jobserver-1 at C:/Users/user/server/target/debug/build/mediasoup-sys-7f374e33af0e5be8/out/out/pip_meson_ninja/bin\ninja.exe

  Visual Studio environment is needed to run Ninja. It is recommended to use Meson wrapper:
  C:\Users\user\server\target\debug\build\mediasoup-sys-7f374e33af0e5be8\out\out\pip_meson_ninja\bin\meson compile -C .
  Activating VS 17.12.4
  INFO: automatically activated MSVC compiler environment
  INFO: autodetecting backend as ninja
  INFO: calculating backend command to run: C:/Users/user/server/target/debug/build/mediasoup-sys-7f374e33af0e5be8/out/out/pip_meson_ninja/bin\ninja.exe -C C:/Users/user/server/target/debug/build/mediasoup-sys-7f374e33af0e5be8/out/build fbs\FBS

  --- stderr
  ninja: error: manifest 'build.ninja' still dirty after 100 tries

  thread 'main' panicked at C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mediasoup-sys-0.9.1\build.rs:154:9:
  Failed to build libmediasoup-worker
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I would really appreciate help with this issue. If any other details are needed please let me know. Thanks in advance.

Well, it’d be helpful to get the full log, not just last few lines

Sure thing, although it seems that .log files and .txt files are not allowed to be uploaded, and having the log inline exceeds the post length limit, so I’ve uploaded the full log to Mozilla’s Pastebin Mozilla Community Pastebin/U9X2PwW4 (Plain Code)

Additionally, I tried creating a fresh Windows 10 VM and following the instructions in the Mediasoup documentation to install the requirements but encountered the exact same issue.

Looks like you have have not installed Visual Studio C++ compiler or not activated VisualStudio environment (and Meson was not able to find it on its own):

Visual Studio environment is needed to run Ninja

Try to activate it explicitly or simply run under VisualStudio shell (there should be a shortcut for it).

If that helps, report it to Meson folks upstream to improve/implement its detection.

As I mentioned in my original post, I have installed the Visual Studio C++ compiler. Additionally, I already tried using the Visual Studio Native Tools Command Prompt (the one that opens with the following message) and had the exact same issue.

**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.12.4
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

I also suffered from the same issue in my VM right after installing Visual Studio with “Desktop development with C++” installed.

Here is a question similar to yours upstream: installation of pandas in pycharm error: This is a Meson bug and should be reported! · Issue #12687 · mesonbuild/meson · GitHub

According to discussion there installing just the components you have requested may not be enough, try to install other components as well (Build Tools for Visual Studio 2022 was mentioned there specifically). According to logs it does detect the compiler itself correctly.

Windows generally is a pain to work with as a developer, I’m sorry you have to deal with this.

Haha it’s fine, if I’m being honest it depends on the languages you use. I find Python to be the most miserable on Windows, but other languages like Node.js and Rust are completely fine. C++ is also usually fine too but I think in this case Python seems to be messing things up. Thank you for helping me regardless though.

I wasn’t aware that there was a Build Tools for VS 2022, I already had the 2017 version so I’ve now installed the 2022 version (and even tried uninstalling the 2017 version) and unfortunately I’m still having the exact same issue. I can confirm something is happening because at some point I had neither installed and the error changed to definitely complain about the lack of a compiler.

Here’s the new log: Mozilla Community Pastebin/f1vNZezS (Plain Code)
Also, here’s the Meson log which may help? I’m not sure: Mozilla Community Pastebin/SvK06yfe (Plain Code)

Meson logs feels incomplete. Error still looks similar. Not sure what else it could be, have you tried installing all visual studio components that are available in there?

I forgot to mention the actual log got cut off at 10,000 lines sorry. And each attempt takes over 10 minutes for it to spit out a log.

Here are the components I chose for the build tools:

And here are the components I chose for the IDE:

I’d try enabling latest versions of all optional components

Still no dice unfortunately. I’m also now running low on disk space lol.

Try opening issue on Meson repo or asking on their Matrix channel, not sure how to debug this further remotely

Please share the solution here once you figure it out