jurplel / install-qt-action

Install Qt on your Github Actions workflows with just one simple action
MIT License
470 stars 82 forks source link

Project ERROR: Cannot run compiler 'cl'. Output: #49

Closed Vampire closed 4 years ago

Vampire commented 4 years ago

I have a really hard time getting this running on Windows. Let me first say that I'm not really knowing what I'm doing, C++ is not my comfort zone and Qt even less. I'm just trying to get this running on Windows too and hope you can maybe help. https://github.com/Vampire/svn2git/runs/879715535 works fine with the setup on Linux. Now I try to get it running on Windows. But here is the problem: https://github.com/Vampire/svn2git/runs/879875430 Qt is installed fine, but when trying to run qmake the error from the title is raised and I'm kind of lost. :-/

jurplel commented 4 years ago

You need to call the batch script that imports the visual studio paths on Windows. Something like this: call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"

Vampire commented 4 years ago

Ah, thanks, I needed that and that the call works shell: cmd. With that qmake was able to run through. Now make is failing though, so I have to dig further.

But regarding the bat I have to call. Wouldn't it make sense you do this in the action? I thought the intention of the action is, that you can then simply build with Qt without the installation and setup hassle you otherwise have to get it running. Or do I just miss something because I'm not familiar with the toolchain?

jurplel commented 4 years ago

On windows, to use the MSVC compiler you have to call that batch file which loads all the relevant files into path. This is just a fact of life for msvc compiling, but I think it is out of scope for my project because you may want to use a different sort of compiler.

As for your trouble with make, try using nmake instead (again, with that batch file already run).

Vampire commented 4 years ago

I see, thanks.

Why must building C++ stuff always be so hard? I'm very grateful for your help so far. Unfortunately just replacing make with nmake did not do the trick. With make I got https://github.com/Vampire/svn2git/runs/880239440

/usr/bin/bash: -c: line 1: syntax error: unexpected end of file
mingw32-make: *** [Makefile:51: sub-src-make_first] Error 1

With nmake I get https://github.com/Vampire/svn2git/runs/880257458

 Microsoft (R) Program Maintenance Utility Version 14.26.28806.0
Copyright (C) Microsoft Corporation.  All rights reserved.

    cd src\ && ( if not exist Makefile d:\a\svn2git\Qt\5.15.0\msvc2019_64\bin\qmake.exe -o Makefile D:\a\svn2git\svn2git\src\src.pro ) && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\nmake.exe" -f Makefile

Microsoft (R) Program Maintenance Utility Version 14.26.28806.0
Copyright (C) Microsoft Corporation.  All rights reserved.
    "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\nmake.exe" -f Makefile.Release

    rc /NOLOGO -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DVER="\"a6144278283d9a9906aa7c085409679be8ed15f6\"" -DNDEBUG -DQT_NO_DEBUG -DQT_CORE_LIB -fo release\svn-all-fast-export_resource.res svn-all-fast-export_resource.rc
Microsoft (R) Program Maintenance Utility Version 14.26.28806.0
Copyright (C) Microsoft Corporation.  All rights reserved.

svn-all-fast-export_resource.rc(4) : error RC2104 : undefined keyword or key name: a6144278283d9a9906aa7c085409679be8ed15f6

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\rc.EXE"' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\nmake.exe"' : return code '0x2'

If you have further tips for me, that would be great, if not, then just close this issue, as the question regarding your project actually was answered. :-)

jurplel commented 4 years ago

I'm happy to help any way I can. I think maybe you should try running vcvars and qmake in the same step. There is some kind of an issue with an invalid .rc file being generated it seems, so i might try that.

Vampire commented 4 years ago

I'm happy to help any way I can.

That's great, thanks. :-)

I think maybe you should try running vcvars and qmake in the same step.

I do, otherwise it would not work at all as a separate step means separate environment, except if I would export the variables of interest through workflow command messages. You can see the the workflow file in the run, can't you?

Also it is not failing in the qmake step now, but in the nmake step.

There is some kind of an issue with an invalid .rc file being generated it seems, so i might try that.

What it complains about, the svn-all-fast-export_resource.rc(4) : error RC2104 : undefined keyword or key name: a6144278283d9a9906aa7c085409679be8ed15f6 is the Git commit SHA that is used as version. It is given as -DVER="\"a6144278283d9a9906aa7c085409679be8ed15f6\"" to rc and is defined in src.pro as

if(!defined(VERSION, var)) {
  VERSION = $$system(git --no-pager show --pretty=oneline --no-notes | head -1 | cut -b-40)
}
VERSTR = '\\"$${VERSION}\\"'  # place quotes around the version string
DEFINES += VER=\"$${VERSTR}\" # create a VER macro containing the version string
Vampire commented 4 years ago

Ah, having looked a bit further I'm now under the impression I should instead use one of the mingw archs and build the binary with that. If I use win64_mingw73 I get aqt.archives.ArchiveListError: Error while parsing package information! But with win64_mingw81 installation worked, qmake worked (without the VS BAT file) and also make progressed until it couldn't find the apr headers that are not yet available, so seems this is the way to go. Now I just have to find out how to get the apr and svn available.

jurplel commented 4 years ago

Sorry for not replying, I've been busy for a while. Is there anything you still need help with?

KochC commented 3 years ago

Hi, I have the same issue:

Project ERROR: Cannot run compiler 'cl'. Output:

but I do not understand the solution. Can you please explain 😀

Thanks a lot in advance

jurplel commented 3 years ago

What's the output?

KochC commented 3 years ago
Project ERROR: Cannot run compiler 'cl'. Output:
37
===================
38
===================
39
Maybe you forgot to setup the environment?
jurplel commented 3 years ago

Did you run vcvars?

KochC commented 3 years ago

no, should I? :/

jurplel commented 3 years ago

Yes, you need to run that to get the visual studio tools in path. You can alternatively use mingw qt if you prefer.

jurplel commented 3 years ago

Something like this: call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"

KochC commented 3 years ago

how do I run this

call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"

just with a run: ?

I get the following error:

call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\ …
18
     |  ~~~~
19
     | The term 'call' is not recognized as a name of a cmdlet, function, script file, or executable program.
20
     | Check the spelling of the name, or if a path was included, verify that the path is correct and try
21
     | again.
jurplel commented 3 years ago

it is using powershell by default, when call is only good for cmd prompt. I forgot about that. use shell: cmd with run

KochC commented 3 years ago

I still don't get it:

run: shell: cmd "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"

produces the following error:

Line |
16
   2 |  shell: cmd "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterpri …
17
     |  ~~~~~~
18
     | The term 'shell:' is not recognized as a name of a cmdlet, function, script file, or executable
19
     | program. Check the spelling of the name, or if a path was included, verify that the path is correct
20
     | and try again.
KochC commented 3 years ago

maybe like this?

shell: cmd
run: call ...
jurplel commented 3 years ago

Like this:

- name: Run vcvars (and presumably build after you edit this)
  run: |
    call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
  shell: cmd
KochC commented 3 years ago

When I use it like this:

      - name: Run vcvars
        run: |
          call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
        shell: cmd

      - name: Generate Makefile
        run: |
          qmake -o Makefile Test.pro

Result:

Run call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
10
**********************************************************************
11
** Visual Studio 2019 Developer Command Prompt v16.8.3
12
** Copyright (c) 2020 Microsoft Corporation
13
**********************************************************************
14
[vcvarsall.bat] Environment initialized for: 'x64'

but still

Project ERROR: Cannot run compiler 'cl'. Output:
32
===================
33
===================
34
Maybe you forgot to setup the environment?
jurplel commented 3 years ago

You have to run qmake in the same step, because the environment is not transferred between steps.

KochC commented 3 years ago

Works. Thank you very much, especially for the super fast support.

jurplel commented 3 years ago

Sure thing, no problem!

cagnulein commented 2 years ago

could you provide a full example of a running QT flow on windows? Thanks

xiaoyifang commented 2 years ago

could you provide a full example of a running QT flow on windows? Thanks

check this https://github.com/xiaoyifang/goldendict/blob/staged/.github/workflows/windows.yml

cagnulein commented 2 years ago

Thanks @xiaoyifang I also fixed my repo https://github.com/cagnulein/qdomyos-zwift/commit/fc1c246e8cce20e09eac8cd70fdf83b2cbb9a5e5