MediaSoup Installation Error In Windows 10 in VsCode React Project

The very last message before yours says that there are updated instructions in a PR that explain how to get things going, why don’t you follow those?

actually im using vs 2019 … but i couldn’t do anything about these :

We might make everything just “automagically” work on Windows if we:
pull environment setup somehow into Makefile instead of requiring manual setup
migrate from Makefile to Python script to remove MinGW requirement

is these files in node_modules right ? … when i run npm i these files creating but after getting error in console all of theme deleting so i can not edit manually …

That is suggestion for the future, as the last line in that same comment says, it wasn’t implemented. Just read the documentation from that PR instead of guessing.

Why? You may have no write access there, but definitely should have read&execute access. This is what it is intended for - to be run by user; there is even a reference in the start menu.

i read this :

and this is what i do at all :

  1. install mingw and MSYS make
  2. add path of make file in env
  3. install vs2019 with desktop development with c++ (containing MSVC v142)
  4. add cl.exe path to env
  5. run “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat” in cmd
  6. install certificate file
  7. delete project node_modules folder
  8. using python 3
    and finaly
  9. set PYTHON=py && npm i mediasoup

but still not working … what is wrong here … what can i do ?
thnks :rose:

it was my mistake … calling in cmd with wrong syntax .
thnks :rose:

for more details
this is my output :

Directory does not contain a valid build tree:
F:\mediaserver\node_modules\mediasoup\worker\out\Release
The Meson build system
Version: 0.60.0
Source dir: F:\mediaserver\node_modules\mediasoup\worker
Build dir: F:\mediaserver\node_modules\mediasoup\worker\out\Release
Build type: native build
Project name: mediasoup-worker
Project version: undefined

meson.build:1:0: ERROR: Compiler cl can not compile program

and this is meson log :

Build started at 2021-10-23T16:55:29.352266
Main binary: C:\Users\***\AppData\Local\Programs\Python\Python310\python.exe
Build Options: -Db_ndebug=true -Db_pie=true -Db_staticpic=true -Dbuildtype=release
Python system: Windows
The Meson build system
Version: 0.59.2
Source dir: F:\mediaserver\node_modules\mediasoup\worker
Build dir: F:\mediaserver\node_modules\mediasoup\worker\out\Release
Build type: native build
Project name: mediasoup-worker
Project version: undefined
Sanity testing C compiler: cl
Is cross compiler: False.
Sanity check compiler command line: cl sanitycheckc.c /Fesanitycheckc.exe /MD /nologo /showIncludes /link
Sanity check compile stdout:
sanitycheckc.c
LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib'

-----
Sanity check compile stderr:

-----

meson.build:1:0: ERROR: Compiler cl can not compile programs. 

You are following old documentation, that PR has updates (green in the diff)

i just follow this steps :

i got new error !!

meson.build:1:0: ERROR: Unknown compiler(s): [['cl']]
The following exception(s) were encountered:
Running "cl /?" gave "[WinError 2] The system cannot find the file specified"

sorry im too confused …

I do not think you followed it fully. Visual Studio setup will set everything needed for cl to be present and to work.

finally i found the problem …
i should run npm i inside that cmd that i run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
then that cmd knows cl and libs …
but now i have ssl certificate expire problem ( I HAVE INSTALLED https://letsencrypt.org/certs/isrgrootx1.der ALREADY) …
just opening .der file and install certificate / is it okay ?

Yes, all of that is in instructions. You obviously need to setup everything before npm i because that is when worker is built.

but i installed first then open cmd and run npm i … still problem with ssl …
im really confused …

Downloading openssl source from https://www.openssl.org/source/openssl-1.1.1l.tar.gz
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)>
A fallback URL could be specified using source_fallback_url key in the wrap file

meson.build:147:0: ERROR: could not get https://www.openssl.org/source/openssl-1.1.1l.tar.gz is the internet available?

Works on my Windows 10 1903 :man_shrugging:

guys if you have any idea please share with us…

Isn’t it supposed to be in the Trusted Root store instead of Personal?

Take a look at this guide: Updating List of Trusted Root Certificates in Windows 10/8.1/7 | Windows OS Hub

it is in Trusted Root store already (imported in both)
need something to do more ?

i will read this guide also … thanks :pray:

@engi I faced similar issue as yours. I believe python certificates are managed in a different place than windows certificates. So I ended up installing certifi and ended up adding the root cert and chain in the pem file, and then specified that file in the variable SSL_CERT_FILE.

  1. Note: cafile=None in the below.
mediasoup>python -c "import ssl; print(ssl.get_default_verify_paths())"
DefaultVerifyPaths(cafile=None, capath=None, openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='C:\\Program Files\\Common Files\\SSL/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='C:\\Program Files\\Common Files\\SSL/certs')
  1. Run c:>python -c “import certifi; print(certifi.where())” to find out where the certfile is.

C:\Users\xxx\Envs\p38\lib\site-packages\certifi\cacert.pem (in my system)

  1. Manually add by copy pasting the a) ISRG Root X1 and b) certificate chain (which is an intermediate certificate) in the above pem file.
  2. Run python -c “import ssl; print(ssl.get_default_verify_paths())” to make sure the path is picked up.
  3. Verify by running, by now you should not get certificate error. python>>> import urllib.request; response = urllib.request.urlopen(‘https://www.openssl.org/source/openssl-1.1.1l.tar.gz’); html = response.read()

Now this may not be best solution, but it worked for me.

For the other error “LINK : fatal error LNK1104: cannot open file ‘MSVCRT.lib’” if you are still facing it, its due to two linker programs one from microsoft and another from mingw32. You want the microsoft one to appear before the mingw32 in the PATH.
Other option is to completely get rid of mingw32 and use gnuutils make binaries for windows. Make for Windows. You will also need to download the zip
from the same page look towards the end [dependencies zip file]. Then extract them in the same folder and make and add to PATH. Both approach works, later one has fewer files and there are no compilers/linkers in this distribution.
Hope that all.

@nazar-pc I did a git pull and ran. But I am getting this below issue.

Found ninja.exe-1.10.2.git.kitware.jobserver-1 at C:/myprojects/mediasoup/worker/out/pip/bin/ninja.exe
WARNING: msvc does not support C++11; attempting best effort; setting the standard to C++14
/c/myprojects/mediasoup/worker/out/pip/bin/meson compile -j 1 -C /c/myprojects/mediasoup/worker/out/Release mediasoup-worker

ERROR: Current directory is not a meson build directory: `C:\c\myprojects\mediasoup\worker\out\Release`.
Please specify a valid build dir or change the working directory to it.
It is also possible that the build directory was generated with an old
meson version. Please regenerate it in this case.
make: *** [mediasoup-worker] Error 1
make: Leaving directory `c:/myprojects/mediasoup/worker'

(p38) c:\myprojects\mediasoup>

I am suspecting it is due to mixing up of forward slash and backslashes. I tried running the same npm install from git-bash but same error as above.

With the makefile hack its starting to compile.

Found ninja.exe-1.10.2.git.kitware.jobserver-1 at c:/myprojects/mediasoup/worker/out/pip/bin/ninja.exe
WARNING: msvc does not support C++11; attempting best effort; setting the standard to C++14
c:/myprojects/mediasoup/worker/out/pip/bin/meson compile -j 1 -C c:/myprojects/mediasoup/worker/out/Release mediasoup-worker
ninja: Entering directory `C:/myprojects/mediasoup/worker/out/Release'
[3/24] Compiling C++ object mediasoup-worker.exe.p/src_RTC_RtpStream.cpp.obj

This is the makefile hack to get the path with forward slashes but starting with c:/myprojects instead of /c/myprojects.

Makefile:
----------------
ifeq ($(OS),Windows_NT)
MEDIASOUP_OUT_DIR ?= $(shell pwd| sed -E 's/^\/([[:alpha:]])/\1\:/' )/out
else
MEDIASOUP_OUT_DIR ?= $(shell pwd)/out
endif

I don’t know what environment you have, but with regular Command Prompt and PowerShell, combined with MinGW/MSYS’ GNU Make it works fine on my Windows 10 VM.

The changes you suggest break things, I have tried them. Also Certificates if imported the way documentation suggests also work on my VM just fine.

With those instructions followed, you should need to do 0 modification to mediasoup, it should “just work”.