mediasoup Windows build runs into meson bug

It sounds like mediasoup has a lot of Windows build issues. Here’s another one -

As per the instructions on the install page, I have

  1. Installed the ancient sourceforge-linked version of msys
  2. Added the msys/1.0/bin dir to my path
  3. Opened the msys terminal and attempted to build mediasoup-worker

This fails:

Found ninja.exe-1.10.2.git.kitware.jobserver-1 at c:/Users/middl/Documents/Projects/sr/showrunner/node_modules/mediasoup/worker/out/pip/bin/ninja.exe

Visual Studio environment is needed to run Ninja. It is recommended to use Meson wrapper:
C:\Users\middl\Documents\Projects\sr\showrunner\node_modules\mediasoup\worker\out\pip\bin\meson compile -C out\Release\build
WARNING: msvc does not support C++11; attempting best effort; setting the standard to C++14
/c/Users/middl/Documents/Projects/sr/showrunner/node_modules/mediasoup/worker/scripts/cpu_cores.sh: line 9: nproc: command not found
/c/Users/middl/Documents/Projects/sr/showrunner/node_modules/mediasoup/worker/out/pip/bin/meson compile -C /c/Users/middl/Documents/Projects/sr/showrunner/node_modules/mediasoup/worker/out/Release/build -j 4 mediasoup-worker
Activating VS 17.3.6
Traceback (most recent call last):
File “c:\Users\middl\Documents\Projects\sr\showrunner\node_modules\mediasoup\worker\out\pip\mesonbuild\mesonmain.py”, line 148, in run
return options.run_func(options)
File “c:\Users\middl\Documents\Projects\sr\showrunner\node_modules\mediasoup\worker\out\pip\mesonbuild\mcompile.py”, line 332, in run
setup_vsenv(b.need_vsenv)
File “c:\Users\middl\Documents\Projects\sr\showrunner\node_modules\mediasoup\worker\out\pip\mesonbuild\mesonlib\vsenv.py”, line 107, in setup_vsenv
return _setup_vsenv(force)
File “c:\Users\middl\Documents\Projects\sr\showrunner\node_modules\mediasoup\worker\out\pip\mesonbuild\mesonlib\vsenv.py”, line 101, in _setup_vsenv
k, v = bat_line.split(‘=’, 1)
ValueError: not enough values to unpack (expected 2, got 1)

ERROR: Unhandled python exception

This is a Meson bug and should be reported!

make: *** [mediasoup-worker] Error 2
make: Leaving directory `/c/Users/middl/Documents/Projects/sr/showrunner/node_modules/mediasoup/worker’

I’ve looked this up in the meson source, and indeed meson is Doing Exactly The Wrong Thing - it can’t find the path to cl.exe (visual studio’s compiler) so it sets about trying to find environment variables in vcvars64.bat, which unfortunately (as of Visual Studio 20XX some year) no longer actually contains environment variables but instead simply invokes “vcvarsall.bat x64”

At the same time I have a colleague who insists that “it works for [him]” which is probably because he has a lingering path to the compiler (in which case meson doesn’t need to go rummaging around for batch files) which makes me think that given that mutliple people have followed the mediasoup instructions and have gotten very different results, this build system is a bit random.

Is there something that I should be doing that I’m not? In that case can the mediasoup install instructions be changed to include this? I’m a fairly good C++ developer and I was thinking that I’d be more than willing to take a swing at the worker build toolchain and convert the Windows part of it to something that makes more sense on Windows (ie just using nmake or perhaps even cmake) - would there be any interest in that?