Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qmake does not work on windows #8180

Closed
duyanning opened this issue Sep 15, 2019 · 12 comments · Fixed by #8222
Closed

qmake does not work on windows #8180

duyanning opened this issue Sep 15, 2019 · 12 comments · Fixed by #8222
Assignees
Labels
requires:more-information This Issue requires more information to solve

Comments

@duyanning
Copy link

Describe the bug
A clear and concise description of what the bug is.

Environment

  • OS: win10
  • Compiler: visual studio 2019

`
F:\helloqt>"F:\vcpkg\installed\x86-windows\tools\qt5\debug\bin\qmake.exe" -tp quit.pro
WARNING: Unable to generate output for: F:/helloqt/Makefile.Debug [TEMPLATE quit.proapp]
QIODevice::write: device not open
WARNING: Unable to generate output for: F:/helloqt/Makefile.Release [TEMPLATE quit.proapp]
QIODevice::write: device not open

F:\helloqt>"F:\vcpkg\installed\x86-windows\tools\qt5\bin\qmake.exe" -tp quit.pro
Could not find qmake spec 'win32-msvc'.
Error processing project file: F:\helloqt\quit.pro

F:\helloqt>"F:\vcpkg\installed\x86-windows\tools\qt5-base\bin\qmake.exe" -tp quit.pro
Could not find qmake spec 'win32-msvc'.
Error processing project file: F:\helloqt\quit.pro

`

@Neumann-A
Copy link
Contributor

What is the output of qmake -query ?
You might need to add -qtconf qt.conf with a qt.conf containing the correct paths to the archdatadir.

@PhoebeHui PhoebeHui added the requires:more-information This Issue requires more information to solve label Sep 16, 2019
@PhoebeHui PhoebeHui self-assigned this Sep 16, 2019
@Neumann-A
Copy link
Contributor

after investigating:
I think your are using qmake wrong:
"F:\vcpkg\installed\x86-windows\tools\qt5\debug\bin\qmake.exe" -tp quit.pro
why do you use the -tp switch? the help says:
-tp prefix | Overrides TEMPLATE so that prefix is prefixed into the value
so you are missing a argument and probably want to do:
"F:\vcpkg\installed\x86-windows\tools\qt5\debug\bin\qmake.exe" quit.pro
without the -tp switch

@duyanning
Copy link
Author

oh, sorry
i omitted 'vc' after -tp

duyanning@EDU-NOTEBOOK F:\helloqt
$ "F:\vcpkg\installed\x86-windows\tools\qt5\bin\qmake.exe" -tp vc quit.pro
Could not find qmake spec 'win32-msvc'.
Error processing project file: quit.pro

duyanning@EDU-NOTEBOOK F:\helloqt
$ "F:\vcpkg\installed\x86-windows\tools\qt5\debug\bin\qmake.exe" -tp vc quit.pro

duyanning@EDU-NOTEBOOK F:\helloqt
$ "F:\vcpkg\installed\x86-windows\tools\qt5-base\bin\qmake.exe" -tp vc quit.pro
Could not find qmake spec 'win32-msvc'.
Error processing project file: quit.pro

@PhoebeHui
Copy link
Contributor

It seems qmake can't find qmake spec, after installed qt-base, it installed mkspec to share\qt5\ folder which contains qmake.conf.

Reference find_qt_mkspec.cmake

@Neumann-A
Copy link
Contributor

I still need:
Output of qmake -query ?

If you renamed/moved vcpkg after build the hardcoded paths in qmake are all wrong and you need to use a qt.conf. That is why I need to see the output of qmake -query
I am also not able to reproduce your failure locally.

@PhoebeHui

Reference find_qt_mkspec.cmake

has nothing to do with the problem.

@duyanning
Copy link
Author

duyanning@EDU-NOTEBOOK C:\Users\duyanning\Desktop
$ "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat"


** Visual Studio 2019 Developer Command Prompt v16.2.0
** Copyright (c) 2019 Microsoft Corporation


[vcvarsall.bat] Environment initialized for: 'x86'

duyanning@EDU-NOTEBOOK C:\Users\duyanning\Desktop
$ "F:\vcpkg\installed\x86-windows\tools\qt5-base\bin\qmake.exe" -query
QT_SYSROOT:
QT_INSTALL_PREFIX:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin
QT_INSTALL_ARCHDATA:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin
QT_INSTALL_DATA:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin
QT_INSTALL_DOCS:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/doc
QT_INSTALL_HEADERS:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/include
QT_INSTALL_LIBS:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/lib
QT_INSTALL_LIBEXECS:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/bin
QT_INSTALL_BINS:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/bin
QT_INSTALL_TESTS:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/tests
QT_INSTALL_PLUGINS:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/plugins
QT_INSTALL_IMPORTS:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/imports
QT_INSTALL_QML:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/qml
QT_INSTALL_TRANSLATIONS:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/translations
QT_INSTALL_CONFIGURATION:
QT_INSTALL_EXAMPLES:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/examples
QT_INSTALL_DEMOS:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/examples
QT_HOST_PREFIX:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin
QT_HOST_DATA:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin
QT_HOST_BINS:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/bin
QT_HOST_LIBS:F:/vcpkg/installed/x86-windows/tools/qt5-base/bin/lib
QMAKE_SPEC:win32-msvc
QMAKE_XSPEC:win32-msvc
QMAKE_VERSION:3.1
QT_VERSION:5.12.4

duyanning@EDU-NOTEBOOK C:\Users\duyanning\Desktop
$ "F:\vcpkg\installed\x86-windows\tools\qt5\bin\qmake.exe" -query
QT_SYSROOT:
QT_INSTALL_PREFIX:F:/vcpkg/installed/x86-windows/tools/qt5/bin
QT_INSTALL_ARCHDATA:F:/vcpkg/installed/x86-windows/tools/qt5/bin
QT_INSTALL_DATA:F:/vcpkg/installed/x86-windows/tools/qt5/bin
QT_INSTALL_DOCS:F:/vcpkg/installed/x86-windows/tools/qt5/bin/doc
QT_INSTALL_HEADERS:F:/vcpkg/installed/x86-windows/tools/qt5/bin/include
QT_INSTALL_LIBS:F:/vcpkg/installed/x86-windows/tools/qt5/bin/lib
QT_INSTALL_LIBEXECS:F:/vcpkg/installed/x86-windows/tools/qt5/bin/bin
QT_INSTALL_BINS:F:/vcpkg/installed/x86-windows/tools/qt5/bin/bin
QT_INSTALL_TESTS:F:/vcpkg/installed/x86-windows/tools/qt5/bin/tests
QT_INSTALL_PLUGINS:F:/vcpkg/installed/x86-windows/tools/qt5/bin/plugins
QT_INSTALL_IMPORTS:F:/vcpkg/installed/x86-windows/tools/qt5/bin/imports
QT_INSTALL_QML:F:/vcpkg/installed/x86-windows/tools/qt5/bin/qml
QT_INSTALL_TRANSLATIONS:F:/vcpkg/installed/x86-windows/tools/qt5/bin/translations
QT_INSTALL_CONFIGURATION:
QT_INSTALL_EXAMPLES:F:/vcpkg/installed/x86-windows/tools/qt5/bin/examples
QT_INSTALL_DEMOS:F:/vcpkg/installed/x86-windows/tools/qt5/bin/examples
QT_HOST_PREFIX:F:/vcpkg/installed/x86-windows/tools/qt5/bin
QT_HOST_DATA:F:/vcpkg/installed/x86-windows/tools/qt5/bin
QT_HOST_BINS:F:/vcpkg/installed/x86-windows/tools/qt5/bin/bin
QT_HOST_LIBS:F:/vcpkg/installed/x86-windows/tools/qt5/bin/lib
QMAKE_SPEC:win32-msvc
QMAKE_XSPEC:win32-msvc
QMAKE_VERSION:3.1
QT_VERSION:5.12.4

duyanning@EDU-NOTEBOOK C:\Users\duyanning\Desktop
$ "F:\vcpkg\installed\x86-windows\tools\qt5\debug\bin\qmake.exe" -query
QT_SYSROOT:
QT_INSTALL_PREFIX:F:/vcpkg/installed/x86-windows
QT_INSTALL_ARCHDATA:F:/vcpkg/installed/x86-windows/tools/qt5/debug
QT_INSTALL_DATA:F:/vcpkg/installed/x86-windows/share/qt5/debug
QT_INSTALL_DOCS:F:/vcpkg/installed/x86-windows/share/qt5/debug/doc
QT_INSTALL_HEADERS:F:/vcpkg/installed/x86-windows/include
QT_INSTALL_LIBS:F:/vcpkg/installed/x86-windows/debug/lib
QT_INSTALL_LIBEXECS:F:/vcpkg/installed/x86-windows/tools/qt5/debug
QT_INSTALL_BINS:F:/vcpkg/installed/x86-windows/debug/bin
QT_INSTALL_TESTS:F:/vcpkg/installed/x86-windows/tests
QT_INSTALL_PLUGINS:F:/vcpkg/installed/x86-windows/debug/plugins
QT_INSTALL_IMPORTS:F:/vcpkg/installed/x86-windows/tools/qt5/debug/imports
QT_INSTALL_QML:F:/vcpkg/installed/x86-windows/debug/qml
QT_INSTALL_TRANSLATIONS:F:/vcpkg/installed/x86-windows/share/qt5/debug/translations
QT_INSTALL_CONFIGURATION:
QT_INSTALL_EXAMPLES:F:/vcpkg/installed/x86-windows/share/qt5/debug/examples
QT_INSTALL_DEMOS:F:/vcpkg/installed/x86-windows/share/qt5/debug/examples
QT_HOST_PREFIX:F:/vcpkg/installed/x86-windows/tools/qt5/debug
QT_HOST_DATA:F:/vcpkg/installed/x86-windows/tools/qt5/debug
QT_HOST_BINS:F:/vcpkg/installed/x86-windows/tools/qt5/debug/bin
QT_HOST_LIBS:F:/vcpkg/installed/x86-windows/tools/qt5/debug/lib
QMAKE_SPEC:win32-msvc
QMAKE_XSPEC:win32-msvc
QMAKE_VERSION:3.1
QT_VERSION:5.12.4

i use ConEmu

@Neumann-A
Copy link
Contributor

As a workaround use either x64-windows-static or a qt.conf file. Qt seems to do something strange with the hardcoded paths in some triplets.

The paths should look like:

$ ./qmake.exe -query                                                                                                    QT_SYSROOT:
QT_INSTALL_PREFIX:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static
QT_INSTALL_ARCHDATA:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/tools/qt5
QT_INSTALL_DATA:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/share/qt5
QT_INSTALL_DOCS:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/share/qt5/doc
QT_INSTALL_HEADERS:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/include
QT_INSTALL_LIBS:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/lib
QT_INSTALL_LIBEXECS:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/tools/qt5
QT_INSTALL_BINS:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/bin
QT_INSTALL_TESTS:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/tests
QT_INSTALL_PLUGINS:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/plugins
QT_INSTALL_IMPORTS:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/tools/qt5/imports
QT_INSTALL_QML:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/qml
QT_INSTALL_TRANSLATIONS:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/share/qt5/translations
QT_INSTALL_CONFIGURATION:
QT_INSTALL_EXAMPLES:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/share/qt5/examples
QT_INSTALL_DEMOS:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/share/qt5/examples
QT_HOST_PREFIX:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/tools/qt5
QT_HOST_DATA:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/tools/qt5
QT_HOST_BINS:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/tools/qt5/bin
QT_HOST_LIBS:G:/vcpkg_test/qt_5.12.4/installed/x64-windows-static/tools/qt5/lib
QMAKE_SPEC:win32-msvc
QMAKE_XSPEC:win32-msvc
QMAKE_VERSION:3.1
QT_VERSION:5.12.5

I could confirm the strange qt paths with another version of qt (build from git bash; maybe that is one problem?):

$ ./qmake.exe -query                                                                                                    QT_SYSROOT:
QT_INSTALL_PREFIX:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin
QT_INSTALL_ARCHDATA:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin
QT_INSTALL_DATA:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin
QT_INSTALL_DOCS:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/doc
QT_INSTALL_HEADERS:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/include
QT_INSTALL_LIBS:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/lib
QT_INSTALL_LIBEXECS:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/bin
QT_INSTALL_BINS:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/bin
QT_INSTALL_TESTS:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/tests
QT_INSTALL_PLUGINS:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/plugins
QT_INSTALL_IMPORTS:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/imports
QT_INSTALL_QML:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/qml
QT_INSTALL_TRANSLATIONS:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/translations
QT_INSTALL_CONFIGURATION:
QT_INSTALL_EXAMPLES:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/examples
QT_INSTALL_DEMOS:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/examples
QT_HOST_PREFIX:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin
QT_HOST_DATA:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin
QT_HOST_BINS:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/bin
QT_HOST_LIBS:G:/vcpkg_test/qt_5.12.4/installed/x86-windows/tools/qt5/bin/lib
QMAKE_SPEC:win32-msvc
QMAKE_XSPEC:win32-msvc
QMAKE_VERSION:3.1
QT_VERSION:5.13.1

If you need an example for a qt.conf there is qt_debug.conf and qt_release.conf in tools/qt5. just replace ${CURRENT_INSTALLED_DIR} with F:\vcpkg\installed\x86-windows in your case

From my point of view this looks like a Qt issue since we actually passed all the paths correctly.

@Neumann-A
Copy link
Contributor

A another thing i just saw is that your debug build of qmake actually works as expected.
So it probably happens when the paths are similar to qt5 default installation paths?

@spindensity
Copy link

The same problem here.

With vcpkg Qt 5.12.5 update, qmake.exe in the debug directory(%VCPKG_ROOT%\installed\x64-windows\tools\qt5\debug\bin) works fine, but in the default release directory(%VCPKG_ROOT%\vcpkg\installed\x64-windows\tools\qt5\bin), it's not working due to wrong paths.

Default(Wrong paths):
Snipaste_2019-09-18_00-02-25

Debug(Correct paths):
Snipaste_2019-09-18_00-04-12

Envrionment:

OS: Win10 1903
MSVC: 2019 16.2.5
Triplet: x64-windows
Qt: 5.12.5

@Neumann-A
Copy link
Contributor

The real funny part here is that the installation is done into the correct path.
I opened up an qt issue here: https://bugreports.qt.io/browse/QTBUG-78459

@spindensity
Copy link

@Neumann-A

After some investigation, I found the culprit is the nearly empty qt.conf file installed in %VCPKG_ROOT%\vcpkg\installed\x64-windows\tools\qt5\bin.

Here the detail:

In %VCPKG_ROOT%\buildtrees\qt5-base\x64-windows-rel\qmake directory, here is a file named qmake.exe with md5 value 6fbecce7bf911b5ec7630ef925a4cb22 and correct paths output when executing qmake.exe -query:
Snipaste_2019-09-18_04-39-51
Snipaste_2019-09-18_04-32-50

In %VCPKG_ROOT%\installed\x64-windows\tools\qt5\bin directory, here is the qmake.exe file with the exactly same md5 value 6fbecce7bf911b5ec7630ef925a4cb22 but wrong paths output when executing qmake.exe -query:
Snipaste_2019-09-18_04-38-38
Snipaste_2019-09-18_04-41-24

Obviously, the problem is nothing to do with the qmake.exe hardcoded paths, then I found there is a qt.conf file in %VCPKG_ROOT%\installed\x64-windows\tools\qt5\bin directory:
Snipaste_2019-09-18_04-43-46
And it's content:
Snipaste_2019-09-18_04-44-26

Finally, remove the file or rename it to anything else solved the problem:
Snipaste_2019-09-18_04-46-07
Snipaste_2019-09-18_04-47-16

@Neumann-A
Copy link
Contributor

Neumann-A commented Sep 17, 2019

@spindensity. Ah this explains why I don't have the error in x64-windows-static because that file does not exists. It is still qt's fault since it is installing that file not vcpkg.
The behavior is also unexpected since an empty qt.conf should not override any paths...

but thats means it is easy to fix ;)

Neumann-A added a commit to Neumann-A/vcpkg that referenced this issue Sep 17, 2019
Rastaban pushed a commit that referenced this issue Sep 20, 2019
* forward extra arguments to vcpkg_configure_qmake from submodules
* make image format dependent on tiff and libwebp
* make tools dependent on imageformat
* build options must be passed a bit different then normal qmake options
* add the required dependencies
* a new dependency discovered in qt5-declarative
* need webpdemux also
* qt5-declarative is dependent on imageformats so we can drop it here
* remove empty qt.conf if it exists. closes #8180
* add all recommended dependencies as dependencies in control.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires:more-information This Issue requires more information to solve
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants