Installation on Windows - therecipe/qt GitHub Wiki

Fast track version

If you want to install Go

https://golang.org/doc/install?download=go1.13.4.windows-amd64.msi

If you want to install the binding
  • After the setup, use the MinGW shell (%GOPATH%\bin\qtenv.bat) if you want to go run or go build your applications; optional: run setx PATH "%PATH%" inside the shell once to make go run or go build work from within your default CMD or PS as well
In GOPATH (global installation) mode
set GO111MODULE=off
go get -v github.com/therecipe/qt/cmd/... && for /f %v in ('go env GOPATH') do %v\bin\qtsetup test && %v\bin\qtsetup -test=false
In Module (per project) mode (to work around the GFW you can use a proxy like this: GOPROXY=https://goproxy.io)
set GO111MODULE=on
go get -v github.com/therecipe/qt && go install -v -tags=no_env github.com/therecipe/qt/cmd/... && go mod vendor && git clone https://github.com/therecipe/env_windows_amd64_513.git vendor/github.com/therecipe/env_windows_amd64_513 && for /f %v in ('go env GOPATH') do %v\bin\qtsetup
If you just want to compile an application
In GOPATH (global installation) mode

(replace github.com/therecipe/examples/... with the project you want to compile)

set GO111MODULE=off
go get -v github.com/therecipe/qt/cmd/... && for /f %v in ('go env GOPATH') do %v\bin\qtdeploy test desktop github.com/therecipe/examples/basic/widgets
In Module (per project) mode (to work around the GFW you can use a proxy like this: GOPROXY=https://goproxy.io)
set GO111MODULE=on
git clone https://github.com/therecipe/examples.git && cd ./examples && go install -v -tags=no_env github.com/therecipe/qt/cmd/... && go mod vendor && git clone https://github.com/therecipe/env_windows_amd64_513.git vendor/github.com/therecipe/env_windows_amd64_513 && for /f %v in ('go env GOPATH') do %v\bin\qtdeploy test desktop ./basic/widgets

Official version (with Android support)


Official version (with WebEngine/WebView support)

  • Install Qt; you can also define a custom location with QT_DIR

  • Install Go: https://golang.org/doc/install?download=go1.13.4.windows-amd64.msi

  • Clone the repo: go get -v -tags=no_env github.com/therecipe/qt/cmd/...

  • Build a custom Go version

    • Clone Go: git clone https://github.com/golang/go.git

    • Setup the build env: set CGO_ENABLED=0, set GOROOT_BOOTSTRAP=%GOROOT%, set GOROOT_FINAL=%GOROOT%

    • Checkout the changes: cd go && git fetch "https://go.googlesource.com/go" refs/changes/46/133946/5 && git checkout FETCH_HEAD

    • Build Go: cd src && make.bat

    • Replace the old Go installation with the custom one:

      • cd ../../ && rm -r %GOROOT_BOOTSTRAP% && mv go %GOROOT_FINAL%

      or

      • set GOROOT and update your PATH to point to the new %GOROOT%/bin dir
    • Running go version should now give you go version devel +6741b7009d ...

  • Install the MSVC 2017 "Visual C++-Buildtools" Workload,Select the language pack for English: https://aka.ms/vs/15/release/vs_buildtools.exe

  • Export QT_MSVC=true

  • Run the setup: %GOPATH%\bin\qtsetup.exe

  • Use qtdeploy to build and/or deploy your application


MSYS2 version (without Android support)

  • Install MSYS2 and export QT_MSYS2=true

  • Open a MinGW shell (the 64-bit version, if you want to deploy 64-bit applications) alternatively export QT_MSYS2_ARCH=amd64 or QT_MSYS2_ARCH=386

  • pacman -Syyu

  • Install Qt

    • to deploy dynamically linked 32-bit applications: pacman -S mingw-w64-i686-qt-creator mingw-w64-i686-qt5

      • optional: install the experimental webkit module: pacman -S mingw-w64-i686-qtwebkit and export QT_WEBKIT=true
    • to deploy dynamically linked 64-bit applications: pacman -S mingw-w64-x86_64-qt-creator mingw-w64-x86_64-qt5

      • optional: install the experimental webkit module: pacman -S mingw-w64-x86-qtwebkit and export QT_WEBKIT=true
    • to deploy statically linked 32-bit applications: pacman -S mingw-w64-i686-qt-creator mingw-w64-i686-qt5-static

    • to deploy statically linked 64-bit applications: pacman -S mingw-w64-x86_64-qt-creator mingw-w64-x86_64-qt5-static

  • pacman -Scc

  • Use the MinGW shell for the setup and deployments (the 64-bit version, if you want to deploy 64-bit applications) alternatively export QT_MSYS2_ARCH=amd64 or QT_MSYS2_ARCH=386

  • Export QT_MSYS2_STATIC=true if you want to deploy statically linked applications

  • Install Go: https://golang.org/doc/install?download=go1.13.4.windows-amd64.msi

  • Clone the repo: go get -v -tags=no_env github.com/therecipe/qt/cmd/...

  • Run the setup: %GOPATH%\bin\qtsetup.exe


Now that you are done with the installation you can start reading the [usage instructions](/therecipe/qt/wiki/Available-Tools) and build the [examples](/therecipe/qt/wiki/Getting-Started).