0%

How to build Qt5 with assimp?

1. Symptom

When I tried to build qt 5.15, I always obtain the following ERROR message:

1
2
3
4
5
6
7
8
9
10
Project ERROR: Library 'assimp' is not defined.
make[4]: *** [Makefile:85: sub-assimp-install_subtargets] Error 3
make[4]: Leaving directory '/opt/qt/qt-everywhere-src-5.15.12/qtquick3d/src/plugins/assetimporters'
make[3]: *** [Makefile:59: sub-assetimporters-install_subtargets] Error 2
make[3]: Leaving directory '/opt/qt/qt-everywhere-src-5.15.12/qtquick3d/src/plugins'
make[2]: *** [Makefile:206: sub-plugins-install_subtargets-ordered] Error 2
make[2]: Leaving directory '/opt/qt/qt-everywhere-src-5.15.12/qtquick3d/src'
make[1]: *** [Makefile:62: sub-src-install_subtargets] Error 2
make[1]: Leaving directory '/opt/qt/qt-everywhere-src-5.15.12/qtquick3d'
make: *** [Makefile:378: module-qtquick3d-install_subtargets] Error 2

2. Reason

Why? Please refer to QT5.15在Ubuntu22.04上编译流程.

3. Solution

  • Modify line 13 of /opt/qt/qt-everywhere-src-5.15.12/qtquick3d/src/plugins/assetimporters/assimp/assimp.pro from QMAKE_USE_PRIVATE += assimp to QMAKE_USE_PRIVATE += quick3d-assimp.
  • Don't use assimp-5.2.2 from Ubuntu default repo, but build and install assimp (5.2.3 or above) from source.