Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business


OverviewFelgo 3 Support (Qt 5) › External C++ (non Qt) library load from QQmlExtensionPlugin


Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #24121



    we have a C++ library and need to integrate it in Felgo Application (Android/iOS, Desktop). In order to integrate it into QML we created QtQuick 2 Extension Plugin which loads this library and provides library functionality. Obviously this library and all its dependencies must be compiled for arm in case of Android and all this included in deployment. Is there some tutorial or example how to configure this in Felgo project? The only solution I found so far (for Android) is to manually compile library and adjust libs.xml and androidManifest.xml.




    Hi Roman,

    thank you for reaching out to us. Here you can find a small Felgo sample that integrates native C++ code: https://felgo.com/doc/felgo-appdemos-cpp-qml-integration-example/ .


    If your library (and its dependencies) can be imported in QtCreator then you’ll have arm/arm64 builds out of the box. This is generally the case with Qt or C++ libraries. Which dependencies does your library have?



    Hi Filippo,

    thank you for the link, I saw this example, but did it as qml plugin like described here https://qmlbook.github.io/ch18-extensions/extensions.html. Communication between C++ plugin and QML works perfect. This plugin should be some kind of wrapper that delegates library functionality to QML. Library gets loaded in constructor using QLibrary. I just didn’t completely understand how to integrate this library with dependencies into the project so that it will work for desktop, android and iOS. I have access to library sources as well as to sources of all dependencies. The library is built with CMake without Qt dependency.

    ro@mars:~/vaccinetrackrecords/JASCA/build/jasca$ ldd libjasca.so
    linux-vdso.so.1 (0x00007fffd275d000)
    libwebsockets.so.17 => /home/ro/vaccinetrackrecords/JASCA/src/3dParty/libwebsockets/lib/lin/libwebsockets.so.17 (0x00007fcd1e736000)
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fcd1e596000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fcd1e413000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fcd1e3f9000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcd1e238000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fcd1e233000)
    libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fcd1e19f000)
    libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fcd1deb6000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fcd1de95000)
    libuv.so.1 => /lib/x86_64-linux-gnu/libuv.so.1 (0x00007fcd1de68000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fcd1eb66000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fcd1de5e000)
    libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fcd1de43000)



    Hi Filippo,

    I have built libraries for arm and x86, included them into project and can see these libraries inside apk. But all this works only for libraries without version at the end of file name. For example libwebsockets.so depends on libmbedtls.so.13 that is symbolic link to libmbedtls.so. But androiddeployqt only allows libraries strting with lib and ending with .so. Do you know a solution without patching libraries? Here is how the libraries get included:

    android {
        OTHER_FILES += android/AndroidManifest.xml       android/build.gradle
        ANDROID_EXTRA_LIBS = $$[QT_INSTALL_QML]/eu/medrepo/libjasca_qml_plugin.so
        equals(ANDROID_TARGET_ARCH, x86)  {
            ANDROID_EXTRA_LIBS += $$PWD/../3dParty/libwebsockets_android/lib_api23_x86/libwebsockets.so \





    I managed it using patchelf –replace-needed. If somebody knows better way, please share.





    I can try suggesting a simpler option. If you only have CMake dependencies you could try migrating your app to a Felgo CMake project and simply import them in your CMakeLists.txt file.


    You can find a Felgo CMake example which should work as a boilerplate here: https://github.com/FelgoSDK/QtQuickFelgoLiveExample-CMake

Viewing 6 posts - 1 through 6 (of 6 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded