[Interest] Trouble compiling qt3d for qt6 on windows 10

Paul Lemire paul.lemire at kdab.com
Thu Feb 18 07:08:01 CET 2021


On 2/17/21 4:30 PM, Daniel Patel wrote:
> Regarding assimp, it is not in qt3d_build_dir/plugins/sceneparsers, 
> only gltf is there.
> I see in the sceneparsers\assimp source code that it seems to use 
> zlib, so perhaps this is the problem. I will recompile things with 
> zlib library included.
>
> The ability to now choose opengl/vulkan/metal/directx backend is 
> impressive work.
> Regarding using OpenGL/RHI backend, does this mean that QtQuick always 
> uses RHI and that consequently Qt3D code inside a Scene3D(which is 
> QtQuick) will also be limited to RHI type OpenGL?

In Qt 6, afaik QtQuick always uses RHI. You can still use the advanced 
opengl backend of Qt 3D (QT3D_RENDERER=opengl) but you need to make sure 
that the RHI backend selected by QtQuick is OpenGL.

> If that is the case, it will be hard to port Qt5 applications using 
> advanced Qt3D/OpenGL over to Qt6.
>
> ons. 17. feb. 2021 kl. 12:27 skrev Paul Lemire <paul.lemire at kdab.com 
> <mailto:paul.lemire at kdab.com>>:
>
>
>     On 2/17/21 11:15 AM, Daniel Patel wrote:
>>     Actually all errors except the missing assimpl plugin problem
>>     went away when also setting environment variable QSG_RHI_BACKEND
>>     to opengl
>>     So the only open question now is how to get the assimp to work.
>     Do you have a sceneparsers/libassimpgsceenimport in your
>     qt3d_build_dir/plugins/sceneparsers? Was that sceneparsers folder
>     copied to qt_install_dir/plugins/?
>>     And a new question is: why does it matter what QSG_RHI_BACKEND is
>>     set to when I already specified that qt3d should use opengl
>>     directly and not use opengl through RHI (which has limited
>>     functionality)
>
>     QSG_RHI_BACKEND does 2 things:
>
>     1) It tells Qt 3D when using the RHI rendering backend which
>     underlying API it should target (only useful when
>     QT3D_RENDERER=rhi which is the default).
>
>     2) It also tells QtQuick (which now uses RHI) which backend it
>     should work.
>
>     So what could have happened is that on an example using both
>     QtQuick and Qt3D, you had QT3D_RENDERER=opengl so Qt 3D was using
>     OpenGL but QtQuick was using RHI and defaulted to a different
>     rendering backend than OpenGL.
>
>>
>>
>>     ons. 17. feb. 2021 kl. 10:59 skrev Daniel Patel
>>     <danielpatel.no at gmail.com <mailto:danielpatel.no at gmail.com>>:
>>
>>         Thank you Mike for telling how to send in parameters
>>         correctly. For the qt-configure-module.bat the syntax
>>         "-DFEATURE_qt3d_simd_avx2=ON" worked but I didn't need to set
>>         it. The other syntax "-- -qt3d-simd=avx2" worked for the qt6
>>         configure script and I was able to tell it where zlib was by
>>         using "configure -prefix C:\Qt\Qt-6.1 -debug-and-release --
>>         -DZLIB_LIBRARY=C:/Users/danie/vcpkg/installed/x64-windows/lib/zlib.lib
>>         --
>>         -DZLIB_INCLUDE_DIR=C:/Users/danie/vcpkg/installed/x64-windows/include"
>>         I will try to use this for including zlib so that perhaps the
>>         "zlib.h not found" error goes away when compiling qt3d6.0.1
>>         (qt3d-everywhere-src-6.0.1)
>>
>>         Currently I was able to compile qt3d6.0.0
>>         (qt3d-everywhere-src-6.0.0), but I had to first compile qt6,
>>         then add the qt3d folder and then compile qt3d. If the qt3d
>>         folder is present when qt6 starts compiling, it tries to
>>         compile qt3d folder as well, but fails.
>>         Another thing is that when compiling qt6 with --paralell
>>         keyword, sometimes I got an internal compiler error. But then
>>         I would just issue the compile command again and it continued.
>>
>>         After compilation, I copied the dlls over to the install
>>         folder according to Pauls advice.
>>         I tried out the qt3d examples (after setting environment
>>         variable QT3D_RENDERER to opengl). Most worked, but a few didn't:
>>         -multiviewport example gave error "Found no suitable importer
>>         plugin for QUrl("qrc:/Gear_scene.dae")"
>>         I also actually had this error when compiling qt5.15.2. It
>>         seems like assimp is not made automatically anymore.
>>         Is it because "Checking for Assimp", and "System Assimp"
>>         returns no as shown below?
>>         ------
>>         Checking for Assimp... no
>>         Checking for Autodesk FBX... no
>>         Qt 3D:
>>           Assimp ................................. yes
>>           System Assimp .......................... no
>>         -----
>>
>>         -compute-particles and some other examples gave this error:
>>         ASSERT: "QOpenGLContext::currentContext()" in file
>>         C:\qtsrc\qt61\qt5\qt3d-everywhere-src-6.0.0\src\quick3d\imports\scene3d\scene3drenderer.cpp,
>>         line 271
>>
>>
>>         tir. 16. feb. 2021 kl. 15:17 skrev Mike Krus
>>         <mike.krus at kdab.com <mailto:mike.krus at kdab.com>>:
>>
>>             Hi
>>
>>             Assuming qt-configure-module.bat invokes qmake, the right
>>             way of passing the configure options is “-- -qt3d-simd=avx2”
>>             If it’s invokes cmake, then try -DFEATURE_qt3d_simd_avx2=ON
>>
>>             Mike
>>
>>>>             Mike Krus | mike.krus at kdab.com
>>             <mailto:mike.krus at kdab.com> | Senior Software Engineer &
>>             Teamlead
>>             KDAB (UK) Ltd., a KDAB Group company
>>             Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
>>             KDAB - The Qt Experts, C++, OpenGL Experts
>>
>>
>>             > On 16 Feb 2021, at 13:31, Daniel Patel
>>             <danielpatel.no at gmail.com
>>             <mailto:danielpatel.no at gmail.com>> wrote:
>>             >
>>             > Using a space didn't work either. I will try to use
>>             cmake though.
>>             > The reason I wanted to use avx2 was to try to get rid
>>             of the compilation error: Project ERROR: Could not find
>>             feature qt3d-simd-avx2
>>             >
>>             >
>>             > tir. 16. feb. 2021 kl. 14:22 skrev Paul Lemire
>>             <paul.lemire at kdab.com <mailto:paul.lemire at kdab.com>>:
>>             >
>>             >
>>             > On 2/16/21 1:33 PM, Daniel Patel wrote:
>>             >> Thanks a lot for the reply Paul, it was useful as always.
>>             >> Copying the files made the qt3d examples work!
>>             >> I realized that the compile error showed up because
>>             qt6 itself was only compiled in debug mode.
>>             >> With the appropriate flag to the configure script, qt6
>>             now compiles both in debug and in release.
>>             >>
>>             >> However, now when compiling qt3d I ran into the error
>>             : "Could not find feature qt3d-simd-avx2" (I already
>>             configured and compiled qt6 with -avx2 flag)
>>             >> I am just not able to tell/configure qt3d to use avx2
>>             instead of sse2. Currently "qmake .." returns:
>>             >>   Use SSE2 instructions .................. yes
>>             >>
>>             >>   Use AVX2 instructions .................. no
>>             >>
>>             >> After running configure for the qt6 build I got this
>>             text as output:
>>             >> "To configure and build other Qt modules, you can use
>>             the following convenience script:
>>             >>  C:/Qt/Qt-6.1/bin/qt-configure-module.bat"
>>             >> So i did a "c:\Qt\Qt-6.1\bin\qt-configure-module.bat
>>             qt3d-everywhere-src-6.0.0 --qt3d-simd=avx2"   but that
>>             failed with  "Unknown command line option
>>             '--qt3d-simd=avx2'"  (I also tried -avx2-qt3d-simd and
>>             -qt3d-simd-avx2)
>>             >> Anyone knows how to set configure flags for qt3d
>>             before compiling it?
>>             >
>>             > What about -qt3d-simd avx2 (just a space)? That's what
>>             I use when compiling on linux with qmake. For Qt 6, I've
>>             switched to cmake though, option to use is
>>             -DFEATURE_qt3d_simd_avx2=ON on the cmake command line.
>>             >
>>             > That being said, the avx2 option for Qt 3D essentially
>>             only yields better performance when we multiply matrices
>>             internally. The sse2 option is not much slower, a lot
>>             faster than relying on QMatrix4x4 (though this might have
>>             changed in Qt6, haven't checked).
>>             >
>>             >
>>             >
>>             >>
>>             >> On a side note I also was not able to get qt6
>>             configure script to detect zlib libraries even though I
>>             set appropriate environment variables and sent in paths
>>             using both -D option as well as -I and -L option.
>>             >>
>>             >> man. 15. feb. 2021 kl. 11:47 skrev Paul Lemire
>>             <paul.lemire at kdab.com <mailto:paul.lemire at kdab.com>>:
>>             >> I can't really help about the compile issues. But I
>>             should be able to help regarding the plugin error.
>>             >>
>>             >> You likely need to copy a few more things from the
>>             qt3d build dir to your Qt install dir:
>>             >>
>>             >> qt3d_build_dir/qml/Qt3D into Qt_Install_Dir/qml/
>>             >>
>>             >> qt3d_build_dir/qml/QtQuick/* into
>>             Qt_Install_Dir/qml/QtQuick/
>>             >>
>>             >> qt3d_build_dir/plugins/* into Qt_Install_Dir/plugins/
>>             >>
>>             >> (the plugins dir contains a renderers folder which
>>             contains the Qt3D render plugins)
>>             >>
>>             >> I hope that helps,
>>             >>
>>             >> Paul
>>             >>
>>             >> On 2/15/21 11:03 AM, Daniel Patel wrote:
>>             >>> I have compiled qt6.1 from source which works and now
>>             I am trying to compile qt3d also from source by
>>             downloading from
>>             https://download.qt.io/official_releases/additional_libraries/qt3d/6.0/6.0.0/
>>             <https://download.qt.io/official_releases/additional_libraries/qt3d/6.0/6.0.0/>
>>             and following the qmake instructions from:
>>             https://www.kdab.com/getting-your-3d-ready-for-qt-6/
>>             <https://www.kdab.com/getting-your-3d-ready-for-qt-6/>
>>             >>>
>>             >>> I first tried to download and compile
>>             qt3d-everywhere-src-6.0.1 but got an error about missing
>>             zlib.h. Instead of trying to fix this I quickly instead
>>             tried with qt3d-everywhere-src-6.0.0 and this compiled fine.
>>             >>> However it only compiled debug dlls and not release
>>             dlls. I tried to do nmake all and nmake release but the
>>             latter gave the error "NMAKE : fatal error U1073: don't
>>             know how to make 'C:\qtsrc\qt61\qt5\qtbase\lib\Qt6Gui.lib'"
>>             >>>
>>             >>> I then decided to try out the debug build. First I
>>             noticed that the qt3d dlls didnt seem to have been copied
>>             over to the correct folder when I did nmake install. So I
>>             copied them over manually and then started
>>             basicshapes-cpp.exe, but this showed the runtime error:
>>             Unable to find renderer plugin for opengl.
>>             >>> Any hints for what to do?
>>             >>>
>>             >>> Best
>>             >>> Daniel
>>             >>>
>>             >>>
>>             >>> _______________________________________________
>>             >>> Interest mailing list
>>             >>>
>>             >>> Interest at qt-project.org <mailto:Interest at qt-project.org>
>>             >>> https://lists.qt-project.org/listinfo/interest
>>             <https://lists.qt-project.org/listinfo/interest>
>>             >> --
>>             >> Paul Lemire |
>>             >> paul.lemire at kdab.com <mailto:paul.lemire at kdab.com>
>>             >>  | Senior Software Engineer
>>             >> KDAB (France) S.A.S., a KDAB Group company
>>             >> Tel: France +33 (0)4 90 84 08 53,
>>             >> http://www.kdab.fr <http://www.kdab.fr>
>>             >>
>>             >> KDAB - The Qt, C++ and OpenGL Experts
>>             >>
>>             > --
>>             > Paul Lemire |
>>             > paul.lemire at kdab.com <mailto:paul.lemire at kdab.com>
>>             >  | Senior Software Engineer
>>             > KDAB (France) S.A.S., a KDAB Group company
>>             > Tel: France +33 (0)4 90 84 08 53,
>>             > http://www.kdab.fr <http://www.kdab.fr>
>>             >
>>             > KDAB - The Qt, C++ and OpenGL Experts
>>             >
>>             > _______________________________________________
>>             > Interest mailing list
>>             > Interest at qt-project.org <mailto:Interest at qt-project.org>
>>             > https://lists.qt-project.org/listinfo/interest
>>             <https://lists.qt-project.org/listinfo/interest>
>>
>     -- 
>     Paul Lemire |paul.lemire at kdab.com  <mailto:paul.lemire at kdab.com>  | Senior Software Engineer
>     KDAB (France) S.A.S., a KDAB Group company
>     Tel: France +33 (0)4 90 84 08 53,http://www.kdab.fr  <http://www.kdab.fr>
>     KDAB - The Qt, C++ and OpenGL Experts
>
-- 
Paul Lemire | paul.lemire at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel: France +33 (0)4 90 84 08 53, http://www.kdab.fr
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210218/3f067ec3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4282 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210218/3f067ec3/attachment.bin>


More information about the Interest mailing list