Qt5 not found on windows.

294 views
Skip to first unread message

Nick Anthony

unread,
Dec 23, 2021, 11:11:58 PM12/23/21
to The Meson Build System
I'm trying to use Qt5 as a dependency on Windows. I have Qt5.15 installed but when I run Meson with `dependency('qt5', modules: ['Core', 'Gui'])` I get this:

```
qmake found: NO need ['>= 5', '< 6']
Run-time dependency qt5 (modules: Core, Gui) found: NO (tried pkgconfig and config-tool)

meson.build:8:0: ERROR: Dependency "qt5" not found, tried pkgconfig and config-tool
```

meson-log.txt provides only a little more information: 

```
Pkg-config binary for MachineChoice.HOST is cached.
Determining dependency 'Qt5Core' with pkg-config executable 'C:\\msys64\\mingw64\\bin\\pkg-config.EXE'
env[PKG_CONFIG_PATH]:
Called `C:\msys64\mingw64\bin\pkg-config.EXE --modversion Qt5Core` -> 1

Pkg-config binary for MachineChoice.HOST is cached.
Determining dependency 'Qt5Core' with pkg-config executable 'C:\\msys64\\mingw64\\bin\\pkg-config.EXE'
env[PKG_CONFIG_PATH]:
qmake binary missing from cross or native file, or env var undefined.
Trying a default qmake fallback at qmake-Qt5
Trying a default qmake fallback at qmake
qmake found: NO need ['>= 5', '< 6']
Run-time dependency qt5 (modules: Core, Gui) found: NO (tried pkgconfig and config-tool)

meson.build:8:0: ERROR: Dependency "qt5" not found, tried pkgconfig and config-tool
```

How can I figure out why Qt5 is not detected?

Nick Anthony

unread,
Dec 24, 2021, 10:39:16 AM12/24/21
to The Meson Build System
After setting up PyCharm to debug Meson I figured out what the issue was which should have been obvious. Qmake needed to be on my PATH. Adding C:\Qt\5.15\msvc2019_64\bin to my PATH environment variable fixed it. Now if there is a way that I can configure a native-file or some other feature of Meson to set the PATH that would be perfect, I don't see it documented though.

Eli Schwartz

unread,
Dec 24, 2021, 2:07:33 PM12/24/21
to meson...@googlegroups.com
On 12/24/21 10:39 AM, Nick Anthony wrote:
> After setting up PyCharm to debug Meson I figured out what the issue was
> which should have been obvious. Qmake needed to be on my PATH. Adding
> C:\Qt\5.15\msvc2019_64\bin to my PATH environment variable fixed it. Now if
> there is a way that I can configure a native-file or some other feature of
> Meson to set the PATH that would be perfect, I don't see it documented
> though.


Do you need it in PATH, or do you just need meson to locate the qmake
executable?

Meson does not allow setting environment variables in a native file. It
does allow you to override the location of program lookups using the
binaries section:

https://mesonbuild.com/Machine-files.html#binaries


--
Eli Schwartz

Nick Anthony

unread,
Dec 24, 2021, 2:30:59 PM12/24/21
to The Meson Build System

Thank you! Adding a `qmake` entry to the binaries section also appears to work, I'll go with that approach.
Reply all
Reply to author
Forward
0 new messages