0

I've been successful in compiling Qt 5.9.2 statically using this guide. I am able to deploy basic C++ applications. However, I want to use QML and Qt3D in my application and statically link it. I've been looking online and I'm not entirely sure what modifications I need to do in order for it to work.

When I try to compile a project with QML or Qt3D, I get this error.

:-1: error: Unknown module(s) in QT: 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras datavisualization

The configure command I used to configure the build was this:

configure -debug-and-release -opensource -platform win32-msvc2012 -opengl desktop -static -nomake examples -nomake tests

This configure was done in the qtbase folder.

How do I statically compile Qt 5.9.2 to include QML and Qt3D?

Dillydill123
  • 693
  • 7
  • 22
  • You appear to only have build qtbase, you need to build the whole thing. And don't do static debug builds, those are huge and take a long time, use static linking for production only. Properly built static Qt will bundle everything in the executable, even qml modules will be compiled to static libs. – dtech Oct 12 '17 at 22:46
  • Is it as simple as running `configure.bat` inside the folder that contains qtbase? – Dillydill123 Oct 12 '17 at 22:48
  • It is as simple as running the configure that is in the source root folder, not the one in qtbase. You'd probably want to skip test and examples too. – dtech Oct 12 '17 at 22:50
  • Note that you will still have some external dependencies, like a few dlls, the static qt build will only link qt libraries statically. I haven't yet been able to make it build 100% statically linked applications. – dtech Oct 12 '17 at 22:52
  • In the guide I listed, the user sets `QTDIR` and `PATH` variables to respective values. I can set `QTDIR` to the source root folder, but do I leave the PATH addition the same? E.g., `PATH=C:\Qt\Qt5.7\qtbase\bin;%PATH%` It looks like this path is given for qmake – Dillydill123 Oct 12 '17 at 22:53
  • Dunno about that guide, I don't set any paths. I just configure and make. Also, it is beneficial to do shadow builds in order to not pollute the source. Just make a `buildtmp` folder, navigate to it in `cmd` and invoke `configure` from there, specify a prefix, make and then install. `pathToSource\configure -c++std c++11 -prefix E:\FolderToInstallQt -platform win32-msvc2012 -release -opensource -static -static-runtime -no-compile-examples -opengl desktop -skip qtscript -nomake examples -nomake tests ` – dtech Oct 12 '17 at 22:56
  • One more question before I attempt to compile it. When it finishes, which qmake.exe do I link when I'm adding a Qt version to the project? It is still `C:\Qt\5.9.2\qtbase\bin\qmake.exe`? Assume the source code folder is 5.9.2 – Dillydill123 Oct 12 '17 at 23:01
  • Is Qt Quick compiler free now? I cannot remember details but a couple of years that was such a pain in Windows. We were shipping QMLs with the product for a while and then the compiler was released as commercial so we were building with it and patching all the gaps with its build integration. That was pain. – Alexander V Oct 13 '17 at 00:02
  • @Dillydill123 you add the qmake that you just build that is in your build target folder. – dtech Oct 13 '17 at 09:55
  • @dtech I've built it and it works! I can run my QML and Qt3D applications with just the executable now. Thank you. However, I'm running into another issue. The application looks really bad on my new static build. The resolution is off, and some of the graphics are messed up. My sliders are basically black boxes. Do you know why this occurs and how to fix it? I notice a warning in my Qt Version saying "qmlscene not installed". Is this related? – Dillydill123 Oct 13 '17 at 17:53
  • It appears that it can't find some shaders. I'm getting tons of errors like `ShaderEffect: Failed to read :/QtQuick/Controls/Shaders/blur.vert` – Dillydill123 Oct 13 '17 at 18:00
  • I don't know about that, I have no such problems in static builds, I am using GCC however. – dtech Oct 13 '17 at 18:24

0 Answers0