Has anyone succeeded with CrystaX NDK instead of the Google one?



  • Hello All

    I'm trying to port one simple application to android (I don't have much experience with mobile development so it is pure Qt/QtQuick with the hope that it will work :)).

    On desktop (5.8, linux, g++) it compiles and runs just fine.
    When I try to build using android-ndk-r13 then I'm getting errors about missing std::to_string functions. From searching around I've learned that this is a result of "deficiency" of libc shipped on android (lack of support of wide characters) with suggestion to use CrystaX as a replacement (the web page of this NDK claims that it is much more "portable" - in the sense that it should smoothen porting desktop apps to android).

    So I installed this CrystaX NDK pointed QtCreator to it and tried to compile. It nearly was OK since linker complained about missing crystax library so I've added:

    android: QMAKE_LIBDIR += /opt/crystax-ndk-10.3.2/sources/crystax/libs/armeabi-v7a
    

    to the .pro and compilation succeeded. However when I try to deploy/run (from within QtCreator) I get errors:

    D/dalvikvm( 1532): Trying to load lib /data/data/org.qtproject.example.treadmill/lib/libgnustl_shared.so 0x41b04ff0
    E/linker  ( 1532): load_library(linker.cpp:759): library "libcrystax.so" not found
    E/linker  ( 1532): soinfo_link_image(linker.cpp:1652): could not load library "libcrystax.so" needed by "libgnustl_shared.so"; caused by load_library(linker.cpp:759): library "libcrystax.so" not found
    E/dalvikvm( 1532): dlopen("/data/data/org.qtproject.example.treadmill/lib/libgnustl_shared.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1652): could not load library "libcrystax.so" needed by "libgnustl_shared.so"; caused by load_library(linker.cpp:759): library "libcrystax.so" not found
    

    It seems to me that this libcrystax.so is not packaged properly into .apk. How do I convince andrioddeployqt (or whoever is responsible for that) to package it so that it can be loaded on the target?

    Has anyone succeeded with deployment of Qt app on android and using CrystaX NDK?
    I'd appreciate any tip.

    Best regards
    Andrzej

    PS. In this particular case I could probably implement my own to_string() functions but for the moment I'd like to try to use CrystaX (since two - out of three - goals of this NDK are Better standard compatibility and Easy porting of existing code to Android)



  • I've used CrystaX NDK but then I've changed for Google's NDK. I remember that I had to include a library (probably libcrystax.so) and to deploy your .so with your application you have to add in .pro

    ANDROID_EXTRA_LIBS += path/to/crystax/libcrystax.so
    

    Don't forget to include the ".so"



  • Thank you @Ferni for your reply.

    That pushes me a bit further (but not much). After changing this android: line in .pro into:

     android {
      QMAKE_LIBDIR += /opt/crystax-ndk-10.3.2/sources/crystax/libs/armeabi-v7a
      ANDROID_EXTRA_LIBS += /opt/crystax-ndk-10.3.2/sources/crystax/libs/armeabi-v7a/libcrystax.so
    }
    

    I see this libcrystax.so copied into PROJECT_BUILD_DIR/android-build/libs/armeabi-v7a/libcrystax.so so hopefully it is now packaged into the .apk however any attempt to run it on device end up the same way:

    W/ADB_SERVICES( 4817): create_local_service_socket() name=shell:while true; do sleep 1; cat /proc/6159/cmdline > /dev/null; done
    W/ADB_SERVICES( 4817): LS(84): bound to 'shell:while true; do sleep 1; cat /proc/6159/cmdline > /dev/null; done' via 56
    D/dalvikvm( 6159): Trying to load lib /data/data/org.qtproject.example.treadmill/lib/libgnustl_shared.so 0x41b08190
    E/linker  ( 6159): load_library(linker.cpp:759): library "libcrystax.so" not found
    E/linker  ( 6159): soinfo_link_image(linker.cpp:1652): could not load library "libcrystax.so" needed by "libgnustl_shared.so"; caused by load_library(linker.cpp:759): library "libcrystax.so" not found
    E/dalvikvm( 6159): dlopen("/data/data/org.qtproject.example.treadmill/lib/libgnustl_shared.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1652): could not load library "libcrystax.so" needed by "libgnustl_shared.so"; caused by load_library(linker.cpp:759): library "libcrystax.so" not found
    

    Do you happen to remember what else you were doing to make apps with CrystaX runnable?
    And out of my curiosity - what is the reason that you have switched back to the Google NDK?

    Best regards
    Andrzej



  • @AndrzejO said in Has anyone succeeded with CrystaX NDK instead of the Google one?:

    Thank you @Ferni for your reply.

    That pushes me a bit further (but not much). After changing this android: line in .pro into:

     android {
      QMAKE_LIBDIR += /opt/crystax-ndk-10.3.2/sources/crystax/libs/armeabi-v7a
      ANDROID_EXTRA_LIBS += /opt/crystax-ndk-10.3.2/sources/crystax/libs/armeabi-v7a/libcrystax.so
    }
    

    I see this libcrystax.so copied into PROJECT_BUILD_DIR/android-build/libs/armeabi-v7a/libcrystax.so so hopefully it is now packaged into the .apk however any attempt to run it on device end up the same way:

    W/ADB_SERVICES( 4817): create_local_service_socket() name=shell:while true; do sleep 1; cat /proc/6159/cmdline > /dev/null; done
    W/ADB_SERVICES( 4817): LS(84): bound to 'shell:while true; do sleep 1; cat /proc/6159/cmdline > /dev/null; done' via 56
    D/dalvikvm( 6159): Trying to load lib /data/data/org.qtproject.example.treadmill/lib/libgnustl_shared.so 0x41b08190
    E/linker  ( 6159): load_library(linker.cpp:759): library "libcrystax.so" not found
    E/linker  ( 6159): soinfo_link_image(linker.cpp:1652): could not load library "libcrystax.so" needed by "libgnustl_shared.so"; caused by load_library(linker.cpp:759): library "libcrystax.so" not found
    E/dalvikvm( 6159): dlopen("/data/data/org.qtproject.example.treadmill/lib/libgnustl_shared.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1652): could not load library "libcrystax.so" needed by "libgnustl_shared.so"; caused by load_library(linker.cpp:759): library "libcrystax.so" not found
    

    Do you happen to remember what else you were doing to make apps with CrystaX runnable?
    And out of my curiosity - what is the reason that you have switched back to the Google NDK?

    Best regards
    Andrzej

    I would write

    android {
    LIBS += -L/opt/crystax-ndk-10.3.2/sources/crystax/libs/armeabi-v7a -lcrystax
    ANDROID_EXTRA_LIBS += /opt/crystax-ndk-10.3.2/sources/crystax/libs/armeabi-v7a/libcrystax.so
    }
    Here you can find what are the differences (http://doc.qt.io/qt-5/qmake-variable-reference.html#libs)

    I've changed to Google's NDK because there is no compatibility between compiled libraries with CrystaX and Google's NDK. I had many dependencies in my project and found most of them already compiled for Android (with official NDK).


Log in to reply
 

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