Qt: Cannot run with MSYS2

Created on 30 Dec 2016  路  14Comments  路  Source: therecipe/qt

When I try to 'generate, install and test', using the msys2 mingw 64 bit shell
After entering %GOPATH%binqtsetup,
I just get "bash: fg: %GOPATH%binqtsetup: no such job".

My GOPATH is setup, the binaries are in the bin folder. But I cant get msys2 to run them.

Do I need to add msys2 to the path or something?

Thanks

Most helpful comment

Great :)

btw, qtsetup and qtdeploy should work now with only QT_MSYS2_DIR being set.
This makes it a bit more convenient to run the setup in the future, leaving this here just for the reference.

All 14 comments

Hey

You probably need to run $GOPATH/bin/qtsetup instead.
I believe the mingw shells don't understand the windows specific % symbol nor \.

You can also run env inside the shell, to see if GOPATH is already exported (I believe so).

Thanks, that was a step in the right direction.
$ $GOPATH/bin/qtsetup
time="2016-12-30T17:57:53Z" level=error msg="failed to run command" cmd="git rev-parse --verify HEAD" error="exec: "git": executable file not found in %PATH%" func=RunCmdOptional name="get git hash" output= (its just blank)

time="2016-12-30T17:57:53Z" level=info msg="QT_DIR: C:\Qt\Qt5.7.0"
time="2016-12-30T17:57:53Z" level=info msg="QT_MSYS2: " <-- Should be set to true...
time="2016-12-30T17:57:53Z" level=info msg="QT_MSYS2_DIR: "
time="2016-12-30T17:57:53Z" level=info msg="IsMsys2QtDir: false"
time="2016-12-30T17:57:53Z" level=info msg="UseMsys2: false"
time="2016-12-30T17:57:53Z" level=panic msg="failed to find Qt dir, did you export QT_DIR?" error="open C:\Qt\Qt5.7.0: The system cannot find the file specified."
panic: (*logrus.Entry) (0x5dc660,0xc042009900)

The errors that arose (cut abit out), first I thought was an easy fix, but 'C:Program FilesGitcmd' is already in the path. And I thought I changed the QT_MSYS2 to true, guess not. So where can I change the QT_MSYS2, and the directory?

Running env, yeah gopath is there.

The first error ("exec: "git": executable file not found in %PATH%") is more a warning then an error and shouldn't have an effect on the installation/setup.

You can either use set QT_MSYS2=true to set the env variable temporary, or you can just use the advanced system settings like usual. (You probably need to close all open mingw shells and then re-open them to get the new env variable.)

And you probably can create/edit the .bash_profile or .profile to set env variables, but I'm not sure.

Msys cannot install any of the components,
"failed to run command" cmd="go install github.com/therecipe/qt/help" error="exec: "go": executable file not found in %PATH%" func=RunCmdOptional name=install.help output=

But C:Gobin and C:projectsgobin are in the system path, do I need to add msys to the path? it isnt in the documentation for it.

It's a bug, you probably need to copy or symlink the go.exe into
C:\msys2{ 32 | 64 }\mingw{ 32 | 64 }\usr\bin\go.exe first

or rebuild qtsetup after you updated this file (which hopefully fixes this) https://github.com/therecipe/qt/blob/2fa4966d4f67f28ee7ec1711468fd351cb70664a/cmd/qtsetup/prep.go

Thanks that helped, but now I am getting errors with mingw, it looks like it cant find it, I tried adding there locations to the path, but no luck.

Just a wall of text
http://i.imgur.com/EnreQJA.png

Could you maybe run qtsetup test?
That will skip the "installation" and continue with building the examples.

I will setup a fresh windows box to test MSYS2 again and report back.

edit: and maybe could you show me the output of qtsetup check?

Made a few changes with https://github.com/therecipe/qt/commit/8fdb852dd5e830c8a71eb36f976586042922a9b0

You probably need to clone the repo or pull the changes for this to work.
Also I would remove all qt* binaries in your GOPATH/bin and also remove the GOPATH/pkg/github.com/therecipe before cloning the repo with go get ... again.

I needed to set the following env variables to get it working:

  1. QT_STUB=true
  2. QT_MSYS2_DIR=C:\msys32 (can be msys64 as well, depending on the msys2 installation you downloaded)
  3. QT_MSYS2=true

My output from $GOPATH/bin/qtsetup check (inside mingw32 shell)

time="2017-01-02T21:30:47+01:00" level=info msg="running setup/check desktop"
time="2017-01-02T21:30:47+01:00" level=info msg="VERSION: 0.0.4"
time="2017-01-02T21:30:47+01:00" level=info msg="GOOS: windows"
time="2017-01-02T21:30:47+01:00" level=info msg="GOARCH: amd64"
time="2017-01-02T21:30:47+01:00" level=info msg="GOVERSION: go1.7.1"
time="2017-01-02T21:30:47+01:00" level=info msg="GOROOT: C:\\Go\\"
time="2017-01-02T21:30:47+01:00" level=info msg="GOPATH: C:\\work"
time="2017-01-02T21:30:47+01:00" level=info msg="GOBIN: C:\\work\\bin"
time="2017-01-02T21:30:47+01:00" level=error msg="failed to run command" cmd="git rev-parse --verify HEAD" error="exec: \"git\": executable file not found in %PATH%" func=RunCmdOptional name="get git hash"

time="2017-01-02T21:30:47+01:00" level=info msg="HASH: "
time="2017-01-02T21:30:47+01:00" level=info msg="QT_VERSION: 5.7.0"
time="2017-01-02T21:30:47+01:00" level=info msg="QT_DIR: C:\\Qt\\Qt5.7.0"
time="2017-01-02T21:30:47+01:00" level=info msg="QT_STUB: true"
time="2017-01-02T21:30:47+01:00" level=info msg="QT_MSYS2: true"
time="2017-01-02T21:30:47+01:00" level=info msg="QT_MSYS2_DIR: C:\\msys32"
time="2017-01-02T21:30:47+01:00" level=info msg="IsMsys2QtDir: true"
time="2017-01-02T21:30:47+01:00" level=info msg="UseMsys2: true"

Then simply run $GOPATH/bin/qtsetup as usual

Yeah that worked a treat, so close. Getting build issues now, when trying the example:

C:projectsgosrc>%GOPATH%/bin/qtdeploy build desktop ./qtExample

time="2017-01-02T21:52:36Z" level=error msg="failed to run command" cmd="C:\pro
jects\go\bin\qtrcc C:\projects\go\src\qtExample" error="exit status 1" fu
nc=RunCmd name="execute qtrcc for desktop on windows"

time="2017-01-02T21:52:36Z" level=error msg="failed to run command" cmd="C:\msy
s64\mingw32\bin\rcc -project -o C:\projects\go\src\qtExample\rrc.qrc" er
ror="exec: "C:\\msys64\\mingw32\\bin\\rcc": file does not exist" func=
RunCmd name="execute rcc.1 on windows"

I'll have to mess around with this tomorrow, it stumped me a little bit. Does it need the mingw32 as well?
Thanks for all the help so far

No problem, you are welcome :)

It seems like the rcc binary is not installed or maybe you just used qtdeploy from within the wrong shell.

If you installed the Qt package with pacman -S mingw-w64-i686-..., you need to run qtdeploy (and the other qt* tools) from within the mingw32 shell, otherwise you need to use the mingw64 shell.

Or did the examples at the end of the setup already show up? If not, then this is probably the solution.

The examples did show up, yeah I tried with cmd so thats likely the reason aha, but with msys I get the following(bellow). Looks like when I ran pacman -S mingw-w64-x86_64... it installed version 5.6.2.

I've run the commands to update everything again, tried reinstalling but it says its already up to date.
Is there another repository I could get it from?

$ $GOPATH/bin/qtdeploy build desktop ./qtExample time="2017-01-03T13:26:14Z" level=warning msg="failed to find moc structs" func=appMoc.generate

time="2017-01-03T13:26:16Z" level=error msg="failed to load C:\\msys64\\mingw64\ \include\\QtGui\\5.7.0\\QtGui\\qpa\\qplatformgraphicsbuffer.h" error="open C:\\msys64\\mingw64\\include\\QtGui\\5.7.0\\QtGui\\qpa\\qplatformgraphicsbuffer.h: The system cannot find the path specified."

time="2017-01-03T13:26:16Z" level=error msg="failed to load C:\\msys64\\mingw64\\include\\QtGui\\5.7.0\\QtGui\\qpa\\qplatformsystemtrayicon.h" error="open C:\\msys64\\mingw64\\include\\QtGui\\5.7.0\\QtGui\\qpa\\qplatformsystemtrayicon.h: The system cannot find the path specified."

So its looking for C:\msys64\mingw64\include\QtGui\5.7.0..., but whats there is C:\msys64\mingw64\include\QtGui\5.6.2.

I get the same error messages while running qtdeploy, so those are expected.

The reason the first error failed to find moc structs shows up, is because I made qtdeploy a bit more verbose. I will change that soon.

And the second error failed to load ... is also expected, because the MSYS2 mode currently still uses infos fromQt5.7.0(bundled in the repo) to generate the binding. This will probably take some time until it is resolved. (But it should work with 5.6.2 nevertheless)

But does qtdeploy work now? It can take like 20-30 sec to finish.

Ah, no I did not check the folder. It works, tis all good.

Thanks so much :)

Great :)

btw, qtsetup and qtdeploy should work now with only QT_MSYS2_DIR being set.
This makes it a bit more convenient to run the setup in the future, leaving this here just for the reference.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

quantonganh picture quantonganh  路  6Comments

joeblew99 picture joeblew99  路  7Comments

Litarvan picture Litarvan  路  3Comments

amlwwalker picture amlwwalker  路  3Comments

angiglesias picture angiglesias  路  5Comments