Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QT6.3 Android couldn't link with OpenSSL libs
Forum Updated to NodeBB v4.3 + New Features

QT6.3 Android couldn't link with OpenSSL libs

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
7 Posts 7 Posters 2.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • OmaritoO Offline
    OmaritoO Offline
    Omarito
    wrote on last edited by
    #1

    Despite having the correct setup in the cmake file as per the documentation. Upon loading the App fails to load the correct OpenSSL libs.

    CMake file :

    if (ANDROID)
        # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Android")
        include(${ANDROID_SDK_ROOT}/android_openssl/CMakeLists.txt)
    endif(ANDROID)
    
    # ....
    
    qt_add_executable(App ${SHARED_SOURCES} ${APP_SOURCES})
    

    Error messages upon the App start :

    E linker  : library "/system/lib/libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/org.qtproject.example.App-1Pt7KXEJt1AnzN4e1jlymg==/lib/arm/libQt6Core_armeabi-v7a.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/org.qtproject.example.App-1Pt7KXEJt1AnzN4e1jlymg==/lib/arm:/data/app/org.qtproject.example.App-1Pt7KXEJt1AnzN4e1jlymg==/base.apk!/lib/armeabi-v7a", permitted_paths="/data:/mnt/expand:/data/data/org.qtproject.example.App"]
    W qt.tlsbackend.ossl: : Failed to load libssl/libcrypto.
    W qt.network.ssl: : The backend "cert-only" does not support QSslKey
    W qt.network.ssl: : Active TLS backend does not support key creation
    

    I have the android_openssl folder (got it from KDAB's GitHub repo) correctly installed in the ANDROID SDK folder. I even tried to manually copy the correct .so from there to put them in ...\cmake-build\Android_Qt_6_3_1_Clang_armeabi_v7a\Debug\App\android-build\libs\armeabi-v7a but still got the same error.

    Also before I manually copy the relevant .so files the android-build\libs\armeabi-v7a folder didn't have any OpenSSL related libraries inside it, so I suspect that there might be a bug in the way that the build tools handle ANDROID_EXTRA_LIBS not copying them to the right directory.

    Anyone might have an idea what went wrong here ?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rampe
      wrote on last edited by Rampe
      #2

      Had you tried installing android_openssl with Qt Creator to your Windows 10 (assumption, please correct if wrong) host?

      You could also check is the ANDROID_SDK_ROOT setup properly or replace it by absolute path like to see does it work.

      if (ANDROID)
          include(/home/youruseridhere/Android/Sdk/android_openssl/CMakeLists.txt)
      endif()
      
      1 Reply Last reply
      0
      • P Offline
        P Offline
        Petriv
        wrote on last edited by
        #3

        @Omarito, we've detected a problem with the documentation - the android_openssl repository does not use the correct target property to set these extra libraries.

        Until the repository has been updated, this problem can be fixed on the project side in two ways:

        First method: using your current method, but add line:

        set_target_properties(appssl PROPERTIES QT_ANDROID_EXTRA_LIBS "${ANDROID_EXTRA_LIBS}")
        

        after " include(${ANDROID_SDK_ROOT}/android_openssl/CMakeLists.txt)".

        Second method:

        Do not include the CMakeLists.txt, but instead follow the secondary method in documentation, with updated property name:

        set(QT_ANDROID_EXTRA_LIBS
            <path_to_libs_dir>/ibcrypto_1_1.so
            <path_to_libs_dir>/libssl_1_1.so
        CACHE INTERNAL "")
        

        This should fix the problem. We're currently working on updating the documentation for this.

        M 1 Reply Last reply
        2
        • G Offline
          G Offline
          gween
          wrote on last edited by
          #4

          For posterity, building for android arm64-v8a with Qt 6.4.0 using cmake only required adding the step in the docs for me:

          set_property(TARGET <target name> PROPERTY QT_ANDROID_EXTRA_LIBS
              <path_to_libs_dir>/libcrypto_1_1.so
              <path_to_libs_dir>/libssl_1_1.so)
          
          T 1 Reply Last reply
          0
          • P Petriv

            @Omarito, we've detected a problem with the documentation - the android_openssl repository does not use the correct target property to set these extra libraries.

            Until the repository has been updated, this problem can be fixed on the project side in two ways:

            First method: using your current method, but add line:

            set_target_properties(appssl PROPERTIES QT_ANDROID_EXTRA_LIBS "${ANDROID_EXTRA_LIBS}")
            

            after " include(${ANDROID_SDK_ROOT}/android_openssl/CMakeLists.txt)".

            Second method:

            Do not include the CMakeLists.txt, but instead follow the secondary method in documentation, with updated property name:

            set(QT_ANDROID_EXTRA_LIBS
                <path_to_libs_dir>/ibcrypto_1_1.so
                <path_to_libs_dir>/libssl_1_1.so
            CACHE INTERNAL "")
            

            This should fix the problem. We're currently working on updating the documentation for this.

            M Offline
            M Offline
            matzrm
            wrote on last edited by matzrm
            #5

            @Petriv This works also if the target is a library? In my case not!

            I try also another way because In the android_openssl repository a contribuitor speaks about to call
            qt_add_executable with the MANUAL_FINALIZATION flag, then include android_openssl/CMakeLists.txt (updated for Qt6) and call qt_finalize_target(...) at the end.

            I can say that after build a simple example this works!

            But if the target is a library qt_finalize_target() macro is empty (according to qt6 docs) and the library is not builded at all!

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Lilde
              wrote on last edited by
              #6

              Hi,

              I have same errors with Qt6.5 Beta2, but it works with Qt6.4.2.

              Can you help me with that ?

              (I use Qt6.5 because of QtLocation is packaged with it)

              1 Reply Last reply
              2
              • G gween

                For posterity, building for android arm64-v8a with Qt 6.4.0 using cmake only required adding the step in the docs for me:

                set_property(TARGET <target name> PROPERTY QT_ANDROID_EXTRA_LIBS
                    <path_to_libs_dir>/libcrypto_1_1.so
                    <path_to_libs_dir>/libssl_1_1.so)
                
                T Offline
                T Offline
                TiagoSD
                wrote on last edited by
                #7

                @gween said in QT6.3 Android couldn't link with OpenSSL libs:

                For posterity, building for android arm64-v8a with Qt 6.4.0 using cmake only required adding the step in the docs for me:

                set_property(TARGET <target name> PROPERTY QT_ANDROID_EXTRA_LIBS
                    <path_to_libs_dir>/libcrypto_1_1.so
                    <path_to_libs_dir>/libssl_1_1.so)
                

                How you make it get the correct library from the correct directory for either the V7 V8 and X86-64 (for the emulator) ? Or I need to change that manually for each target?

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved