Closed dtromb closed 5 months ago
Let me add that I'm fairly confident that the dev environment is installed correctly - this project is one of two dependencies, and the other (cmake-based) compiles just fine with the same shell. (I've tried running the two builds in both possible orders...)
I installed a fresh Visual Studio 2022, with C++ develpment package (first uninstalling all other VS versions to be sure), and running 'vcvarsall.bat x64' in a PS window, which executed sucessfully.
And yet, ninja is saying it was unable to find the file cl
to start it as a process -- which indicates somehow ninja was run in an environment that did not have an activated vcvars.
Meson also printed this log:
Activating VS 17.10.1
C++ compiler for the host machine: cl (msvc 19.40.33811 "Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33811 for x64")
C++ linker for the host machine: link link 14.40.33811.0
The "activating" message is supposed to mean that meson didn't find an existing MSVC dev command shell environment, so it ran vswhere.exe, used it to find a suitable vcvars64.bat, ran it and parsed its output to figure out what environment variables it sets, then loaded those vars into meson.
Which is a lengthy and complicated way of saying, it basically did the equivalent of running vcvars for you, but only inside the meson subprocess itself.
As for why ninja doesn't load the VS environment as well: this is a missing ninja feature tracked at https://github.com/ninja-build/ninja/issues/1610
Meson is supposed to warn you at the end:
Visual Studio environment is needed to run Ninja. It is recommended to use Meson wrapper:
meson compile -C source/
The meson wrapper doesn't really do anything that ninja can't do already, EXCEPT that since meson code runs before ninja is launched, we have the opportunity to work around the missing ninja feature, and do the VS environment loading for you.
I actually ran vcvars64.bat, just as I indicated. I didn't include the output of that portion but just said it "run successfully", here is what was output:
PS <path redated> & 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat' x64
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.10.1
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
This was run just before meson was invoked.
Are you able to run cl
from that shell? If so then I don't have a good guess as to why ninja is unable to.
@eli-schwartz - meson compile
actually works, TYVM. I was not aware of this usage! Looks like the problem lies with ninja, and meson can tell it what to do properly!
Describe the bug I'm attempting to compile an unmodified version of the head of https:/. I installed a fresh Visual Studio 2022, with C++ develpment package (first uninstalling all other VS versions to be sure), and running 'vcvarsall.bat x64' in a PS window, which executed sucessfully.
Then,
meson setup <path to thorvg> source
runs successfully and produces:In particular, notice it finds the compiler successfully.
When I run 'ninja' on the resulting build instructions, however, it fails on the very first file:
It seems to me this must be a bug in meson - the compiler is located but not indicated correctly to ninja. Is that correct, or am I doing something wrong?
To Reproduce
Just follow the report above as instructions - fresh install of VC2022, clone the repo indicated, set up a PS dev prompt with the command I showed, then run the build with the two commands I indicated.
Expected behavior
ninja
should find the compiler at the path meson found it after being configured by msoon.system parameters
Is this a cross build or just a plain native build (for the same computer)? No, native build
what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) Windows 10
what Python version are you using e.g. 3.8.0 Python is 3.12.4
what
meson --version
meson is 1.4.1what
ninja --version
if it's a Ninja build ninja is 1.11.1