mesonbuild / mesonbuild/meson

Despite --vsenv command meson doesn't seem to recognize Visual Studio environment

Open
#9,864 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.6k
Forks
1.9k
Avg merge
2d 6h
Merged PRs (30d)
33

Description

**Describe the bug**
Despite --vsenv command meson doesn't seem to recognize Visual Studio environment at all.

**To Reproduce**
I'm trying to build [https://github.com/versatica/mediasoup/](https://github.com/versatica/mediasoup/ ) on Windows.
So to reproduce just install the requirements [https://mediasoup.org/documentation/v3/mediasoup/installation/](https://mediasoup.org/documentation/v3/mediasoup/installation/) and run `npm install`.

```
npm-scripts.js [INFO] executing command: make -C worker
make: Entering directory `/d/Repos/mediasoup/worker'
/d/Repos/mediasoup/worker/out/pip/bin/meson setup \
--prefix /d/Repos/mediasoup/worker/out/Release \
--bindir '' \
--libdir '' \
--buildtype release \
-Db_ndebug=true \
-Db_pie=true \
-Db_staticpic=true \
--reconfigure \
--vsenv \
/d/Repos/mediasoup/worker/out/Release/build || \
/d/Repos/mediasoup/worker/out/pip/bin/meson setup \
--prefix /d/Repos/mediasoup/worker/out/Release \
--bindir '' \
--libdir '' \
--buildtype release \
-Db_ndebug=true \
-Db_pie=true \
-Db_staticpic=true \
--vsenv \
/d/Repos/mediasoup/worker/out/Release/build
The Meson build system
Version: 0.61.1
Source dir: D:\Repos\mediasoup\worker
Build dir: D:\Repos\mediasoup\worker\out\Release\build
Build type: native build
Project name: mediasoup-worker
Project version: undefined
C compiler for the host machine: gcc (gcc 6.3.0 "gcc (MinGW.org GCC-6.3.0-1) 6.3.0")
C linker for the host machine: gcc ld.bfd 2.28

meson.build:1:0: ERROR: Unknown linker(s): [['gcc-ar'], ['ar'], ['gar']]
The following exception(s) were encountered:
Running "gcc-ar --version" gave "[WinError 2] The system cannot find the file specified"
Running "ar --version" gave "[WinError 2] The system cannot find the file specified"
Running "gar --version" gave "[WinError 2] The system cannot find the file specified"
```

**Expected behavior**
Meson shouldn't error when trying to use MSVS.

**system parameters**
* what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
-- Windows 10 Version 21H2 (OS Build 19044.1466)
* what Python version are you using e.g. 3.8.0
-- Python 3.10.0
* what `meson --version`
-- Meson 0.61.1
* what Visual Studio Version
-- Microsoft Visual Studio 2022 Version 17.0.5

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported Meson 0.61.1 setup command with --vsenv on Windows 10 and inspect the compiler and linker detection path. The fix is complete when Meson recognizes the Visual Studio environment instead of selecting MinGW gcc and setup proceeds without the gcc-ar, ar, or gar error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.