gcompris / GCompris-qt

GCompris in Qt Quick - Mirror of https://invent.kde.org/education/gcompris
221 stars 169 forks source link

module "Box2D" is not installed #233

Open gjherbiet opened 6 years ago

gjherbiet commented 6 years ago

Hello,

Roughly following https://mail.kde.org/pipermail/gcompris-devel/2018-January/005359.html and https://www.ynonperek.com/2017/09/18/building-gcompris-qt-on-macos/ I now have a working version of GCompris with translations.

However some activities don't work and yield the following error message:

qrc:/gcompris/src/activities/land_safe/LandSafe.qml:23:1: module "Box2D" is not installed

I tried to specify how to build Box2D using:

$ cmake -DQML_BOX2D_MODULE=submodule ..
$ make all
[...]
[ 11%] Built target BuildTranslations
[ 11%] Creating directories for 'qml_box2d'
[ 11%] No download step for 'qml_box2d'
[ 11%] No patch step for 'qml_box2d'
[ 11%] No update step for 'qml_box2d'
[ 13%] Performing configure step for 'qml_box2d'
[ 13%] Performing build step for 'qml_box2d'
[ 13%] Performing install step for 'qml_box2d'
[ 14%] Completed 'qml_box2d'
[ 14%] Built target qml_box2d
[...]

After compilation, there is a libBox2D.dylib in qml_box2d-prefix/src/qml_box2d-build under my build dir.

What step is missing to get this library in a place where it is picked up by GCompris at run-time?

petitlapin commented 6 years ago

Hi,

do you also have it in $buildFolder/lib/qml/Box2D.2.0/{libBox2D.dylib, qmldir}?

It should be using this one.

Can you try exporting QT_DEBUG_PLUGINS (export QT_DEBUG_PLUGINS=1) and check if it finds box2d (I have a specific log for box2d when running land_safe activity).

Johnny

gjherbiet commented 6 years ago

Yes, I tried the following:

$ export QT_DEBUG_PLUGINS=1
$ cd $buildFolder
$ cp lib/qml/Box2D.2.0/libBox2D.dylib bin/gcompris-qt.app/Contents/PlugIns/platforms
$ bin/gcompris-qt.app/Contents/MacOS/gcompris-qt
[..]
QFactoryLoader::QFactoryLoader() checking directory path "/Users/gjherbiet/Development/GCompris-qt/build/bin/gcompris-qt.app/Contents/Plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/Users/gjherbiet/Development/GCompris-qt/build/bin/gcompris-qt.app/Contents/Plugins/platforms/libBox2D.dylib"
Found metadata in lib /Users/gjherbiet/Development/GCompris-qt/build/bin/gcompris-qt.app/Contents/PlugIns/platforms/libBox2D.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface",
    "MetaData": {
    },
    "className": "Box2DPlugin",
    "debug": false,
    "version": 330497
}

Got keys from plugin meta data ()
[...]
qrc:/gcompris/src/activities/land_safe/LandSafe.qml:23:1: module "Box2D" is not installed

So it seems the library is found but still not loaded.

petitlapin commented 6 years ago

Yes, on my side, I have the following log: loaded library "/home/jazeix/Desktop/travail/gcompris/build/lib/qml/Box2D.2.0/libBox2D.so" after.

There is also the env var QML_IMPORT_TRACE that should display info: QQmlImports(qrc:/gcompris/src/activities/land_safe/LandSafe.qml)::addLibraryImport: "Box2D" 2.0 as "" QQmlImports(qrc:/gcompris/src/activities/land_safe/LandSafe.qml)::importExtension: loaded "/home/jazeix/Desktop/travail/gcompris/build/lib/qml/Box2D.2.0/qmldir" QQmlImportDatabase::registerPluginTypes: "Box2D" from "/home/jazeix/Desktop/travail/gcompris/build/lib/qml/Box2D.2.0"

Have you also copied the qmldir file?