Adding Box2d library



  • Hey,

    I wanted to work with this library:
    https://github.com/qml-box2d/qml-box2d

    (At first I want to admit I'm from Java and I'm not god of using libraries in Qt)

    I created my own project and added some files from "examples" in lib github. It required adding:

    import Box2D 2.0
    

    and I managed to run project on Desktop. However when I tried to launch it in Android/iOS device, the app crashed at start.

    I have Android stacktrace:

    Starting remote process.I art     : Late-enabling -Xcheck:jni
    I art     : Background sticky concurrent mark sweep GC freed 38874(2MB) AllocSpace objects, 0(0B) LOS objects, 43% free, 14MB/25MB, paused 6.088ms total 47.402ms
    W System  : ClassLoader referenced unknown path:
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libQt5Network.so: unused DT entry: type 0xf arg 0x119c9
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libQt5Network.so: unsupported flags DT_FLAGS_1=0x81
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libQt5Qml.so: unused DT entry: type 0xf arg 0x33c4c
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libQt5Qml.so: unsupported flags DT_FLAGS_1=0x81
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libQt5Gui.so: unused DT entry: type 0xf arg 0x5042f
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libQt5Gui.so: unsupported flags DT_FLAGS_1=0x81
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libQt5Quick.so: unused DT entry: type 0xf arg 0x3d1ac
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libQt5Quick.so: unsupported flags DT_FLAGS_1=0x81
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libQt5Widgets.so: unused DT entry: type 0xf arg 0x6b3d9
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libQt5Widgets.so: unsupported flags DT_FLAGS_1=0x81
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libQt5QuickParticles.so: unused DT entry: type 0xf arg 0x365b
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libQt5QuickParticles.so: unsupported flags DT_FLAGS_1=0x81
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/plugins/platforms/android/libqtforandroid.so: unused DT entry: type 0xf arg 0x9260
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/plugins/platforms/android/libqtforandroid.so: unsupported flags DT_FLAGS_1=0x81
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/plugins/platforms/android/libqtforandroid.so: is missing DT_SONAME will use basename as a replacement: "libqtforandroid.so"
    I Qt      : qt start
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/plugins/bearer/libqandroidbearer.so: unused DT entry: type 0xf arg 0x1746
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/plugins/bearer/libqandroidbearer.so: unsupported flags DT_FLAGS_1=0x81
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/plugins/bearer/libqandroidbearer.so: is missing DT_SONAME will use basename as a replacement: "libqandroidbearer.so"
    W linker  : /data/app/org.qtproject.example.dobot_qt-2/lib/arm/libdobot-qt.so: unused DT entry: type 0x1d arg 0x514
    D         : (null):0 ((null)): QML debugging is enabled. Only use this in a safe environment.
    D OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
    I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
    I OpenGLRenderer: Initialized EGL, version 1.4
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/qml/QtQuick.2/libqtquick2plugin.so: unused DT entry: type 0xf arg 0x4bd
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/qml/QtQuick.2/libqtquick2plugin.so: unsupported flags DT_FLAGS_1=0x81
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/qml/QtQuick.2/libqtquick2plugin.so: is missing DT_SONAME will use basename as a replacement: "libqtquick2plugin.so"
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/qml/QtQuick/Controls/libqtquickcontrolsplugin.so: unused DT entry: type 0xf arg 0x41bf
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/qml/QtQuick/Controls/libqtquickcontrolsplugin.so: unsupported flags DT_FLAGS_1=0x81
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/qml/QtQuick/Controls/libqtquickcontrolsplugin.so: is missing DT_SONAME will use basename as a replacement: "libqtquickcontrolsplugin.so"
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/qml/QtQuick/Dialogs/libdialogplugin.so: unused DT entry: type 0xf arg 0x249b
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/qml/QtQuick/Dialogs/libdialogplugin.so: unsupported flags DT_FLAGS_1=0x81
    W linker  : /data/data/org.qtproject.example.dobot_qt/qt-reserved-files/qml/QtQuick/Dialogs/libdialogplugin.so: is missing DT_SONAME will use basename as a replacement: "libdialogplugin.so"
    W libdobot-qt.so: (null):0 ((null)): QQmlApplicationEngine failed to load component
    W libdobot-qt.so: (null):0 ((null)): qrc:/main.qml:4 module "Box2D" is not installed
    03-20 17:57:22.842  8672  8847 W libdobot-qt.so:
    

    So I guess the lib was not included in deployment for Android. How to fix it ? How to properly add this Box2d library/plugin ?


  • Moderators

    Do you have Box2D compiled for Android?



  • @jsulm How to achieve that ?


  • Lifetime Qt Champion

    Hi,

    It's explained in the README.md:

    qmake
    make
    make install
    

    Use the qmake matching your Android Qt installation.



  • Ok, I did that earlier but only for Desktop. So now I ended up with these after make install:

    install -m 755 -p libBox2D.so /libs/armeabi-v7a/libBox2D.so
    install -m 644 -p /Users/adamstyrc/Desktop/git/qml-box2d4/qmldir /Users/adamstyrc/Qt/5.6/android_armv7/qml/Box2D.2.0/

    What should be proper next step ?

    I tried to "Add Library"->external and add that /libs/armeabi-v7a/libBox2D.so file but then error is the same and also my import is not visible in code (QML module does not contain information about component plugin):

    import Box2D 2.0
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.