Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-88483

UnsatisfiedLinkError: dlopen failed: library "libgnustl_shared.so" not found

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.13.0
    • Build System
    • None
    • Qt 5.13.0
      Android 9
    • Android

    Description

      First, the work environment configuration is QT 5.13.0 with NDK_r18b and SDK_r24.4.1. 

      Based on this environment, I open an old program (This old program is used on QT 5.11. ). Then build it , there is no error. But when I build it on the phone , an error occured, like this:

      E AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread
      E AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread
      E AndroidRuntime: Process: com.roflying.mobile.gcs, PID: 9127
      E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: library "libgnustl_shared.so" not found
      E AndroidRuntime:  at java.lang.Runtime.load0(Runtime.java:928)
      E AndroidRuntime:  at java.lang.System.load(System.java:1633)
      E AndroidRuntime:  at org.qtproject.qt5.android.QtNative$3.run(QtNative.java:236)
      E AndroidRuntime:  at org.qtproject.qt5.android.QtThread$2.run(QtThread.java:87)
      E AndroidRuntime:  at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
      E AndroidRuntime:  at java.lang.Thread.run(Thread.java:764)
      

      Then I go to find this "libgnustl_shared.so" library in the libs file, it is really not exist in that. And in this issue[https://developer.android.com/ndk/guides/cpp-support.html,] I know libc++ is the only STL available in the NDK begin NDK r18.  As a rule, Qt can auto call the "libc++_shared.so", not the "libgnustl_shared.so" library .  But in fact, the program is actually finding the "libgnustl_shared.so",at last ,this library is not found.

      There is my build.gradle:

      buildscript {
          repositories {
              jcenter()
          }
      
          dependencies {
              classpath 'com.android.tools.build:gradle:2.2.3'
          }
      }
      
      allprojects {
          repositories {
              jcenter()
              flatDir {
                  dirs 'libs' // 该目录用于引入video sdk的aar文件
              }
          }
      }
      
      apply plugin: 'com.android.application'
      
      dependencies {
          compile fileTree(dir: 'libs', include: ['*.jar'])
          compile "commons-io:commons-io:2.5" // 必须引入
      	compile files('libs/libammsdk.jar')
          // sdk库文件
          compile(name: 'uartVideo-release', ext: 'aar')
          compile(name: 'fpvlibrary-v1.0.2', ext: 'aar')
      }
      
      android {
          /*******************************************************
           * The following variables:
           * - androidBuildToolsVersion,
           * - androidCompileSdkVersion
           * - qt5AndroidDir - holds the path to qt android files
           *                   needed to build any Qt application
           *                   on Android.
           *
           * are defined in gradle.properties file. This file is
           * updated by QtCreator and androiddeployqt tools.
           * Changing them manually might break the compilation!
           *******************************************************/
      
          compileSdkVersion androidCompileSdkVersion.toInteger()
      
          buildToolsVersion androidBuildToolsVersion
      
          sourceSets {
              main {
                  manifest.srcFile 'AndroidManifest.xml'
                  java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
                  aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
                  res.srcDirs = [qt5AndroidDir + '/res', 'res']
                  resources.srcDirs = ['src']
                  renderscript.srcDirs = ['src']
                  assets.srcDirs = ['assets']
                  jniLibs.srcDirs = ['libs']
             }
          }
      
          lintOptions {
              abortOnError false
          }
      
      }
      
      

      And this is my *.pro file:

      QT += quick \
          gui \
          widgets \
          sql \
          network \
          location-private \
          positioning-private \
          xml \
          core \
          texttospeech \
          qml
      
      CONFIG += c++11
      #CONIFG += qtquickcompiler
      
      TEMPLATE = app
      TARGET = HK-GCS
      
      # The following define makes your compiler emit warnings if you use
      # any feature of Qt which as been marked deprecated (the exact warnings
      # depend on your compiler). Please consult the documentation of the
      # deprecated API in order to know how to port your code away from it.
      DEFINES += QT_DEPRECATED_WARNINGS
      
      QMAKE_PROJECT_DEPTH = 0
      
      # You can also make your code fail to compile if you use deprecated APIs.
      # In order to do so, uncomment the following line.
      # You can also select to disable deprecated APIs only up to a certain version of Qt.
      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
      
      linux-g++-64 {
          message(Linux build x64_86)
          CONFIG += LinuxBuild
          DEFINES += Q_LINUX_64
          DISTRO = $$system(lsb_release -i)
          contains( DISTRO, "Ubuntu" ) {
               DEFINES += Q_UBUNTU
          }
      }
      else: linux-g++ {
          message(Linux build x86)
          CONFIG += LinuxBuild
          DEFINES += Q_LINUX_32
          DISTRO = $$system(lsb_release -i)
          contains( DISTRO, "Ubuntu" ) {
               DEFINES += Q_UBUNTU
          }
      }
      else : win32-msvc2015 {
          message(Windows build 2015)
          CONFIG += WindowsBuild
          DEFINES += WindowsBuild
      }else : win32-x-g++|win64-x-g++ {
          message(Windows Cross Build)
          CONFIG += WindowsCrossBuild
          DEFINES += WindowsCrossBuild
      }
      
      else : android-g++ {
          message(Android Build)
          CONFIG += AndroidBuild
          DEFINES += AndroidBuild
      }
      else : android-clang{
          message(Android Build)
          CONFIG += AndroidBuild
          DEFINES += AndroidBuild
      }
      else {
          error(Unsupported build type)
      }
      
      
      !iOSBuild {
          OBJECTS_DIR  = $${OUT_PWD}/obj
          MOC_DIR      = $${OUT_PWD}/moc
          UI_DIR       = $${OUT_PWD}/ui
          RCC_DIR      = $${OUT_PWD}/rcc
          QMLCACHE_DIR = ./qmlCache
      }
      
      SOURCES += \
              main.cpp \
      
      RESOURCES += file.qrc \
          qml.qrc
      
      # Additional import path used to resolve QML modules in Qt Creator's code model
      QML_IMPORT_PATH =
      
      # Additional import path used to resolve QML modules just for Qt Quick Designer
      QML_DESIGNER_IMPORT_PATH =
      
      # Default rules for deployment.
      #qnx: target.path = /tmp/$${TARGET}/bin
      #else: unix:!android: target.path = /opt/$${TARGET}/bin
      #!isEmpty(target.path): INSTALLS += target
      
      HEADERS += 
      
      DISTFILES += \
          readMe \
          Android_file/gradle/wrapper/gradle-wrapper.jar \
          Android_file/gradlew \
          Android_file/res/values/libs.xml \
          Android_file/build.gradle \
          Android_file/gradle/wrapper/gradle-wrapper.properties \
          Android_file/gradlew.bat \
          Android_file/res/xml/device_filter.xml \
          Android_file/libs/d2xx.jar \
          Android_file/assets/configs_static/version_define.xml \
          Android_file/src/com/roflying/mobile/gcs/QGCActivity.java \
          Android_file/gradle/wrapper/gradle-wrapper.jar \
          Android_file/gradlew \
          Android_file/res/values/libs.xml \
          Android_file/build.gradle \
          Android_file/gradle/wrapper/gradle-wrapper.properties \
          Android_file/gradlew.bat \
          Android_file/assets/configs_static/agricultureService.json \
          Android_file/assets/configs_static/version_define.xml \
          Android_file/libs/libammsdk.jar \
          Android_file/AndroidManifest.xml \
      
      AndroidBuild{
          message(+++++++++++++++++++++++++++++++++++++++++++++++)
          message(Android libs files)
          message(+++++++++++++++++++++++++++++++++++++++++++++++)
      
          include(Libs\qtandroidserialport\src\qtandroidserialport.pri)
          QT += androidextras \
                  bluetooth
      
          HEADERS += Model/FounditionExtend/Link/LinkConfiguration.h \
                      Model/FounditionExtend/Link/rbluetoothlink.h
      
          SOURCES += Model/FounditionExtend/Link/LinkConfiguration.cc \
                      Model/FounditionExtend/Link/rbluetoothlink.cc
      
          contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
              ANDROID_EXTRA_LIBS = \
              $$PWD/Libs/ffmpeg/libs/android/libavcodec.so\
              $$PWD/Libs/ffmpeg/libs/android/libavfilter.so\
          }
          ANDROID_PACKAGE_SOURCE_DIR = $$PWD/Android_file
      }
      
      

      And all of  the version code , minimum required and target SDK version are  21.

       

      These are details of my question.

      And I want to know why is Qt finding the "libgnustl_shared.so" library , and how can I solve this problem?

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtandroidteam Qt Android Team
            sunrise hu xiaofei
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes