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

Crashed when instantiating QCoreApplication on Android Adb shell

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.11.1
    • Core: Event loop
    • None
    • OS: openSUSE 15
      Android NDK: 17.1
      Android SKD tools: 26
      Android Clang: 6.0.2
    • Android

    Description

      I use QtCore as like the C++ standard library. But it seems that using QtCore only is not very well on Android platform. When I was instantiating the `QCoreApplication`, the program just crahsed.

      The steps to produce the bug:

      1. build static Qt for Android using this command line:

          ./configure --prefix="/usr/local/Qt5.11.1-android-static-x86" -release -opensource -static -no-gui -no-icu -xplatform android-clang -disable-rpath -nomake tests -nomake examples -android-ndk /home/goldfish/bin/android-sdk-linux/ndk-bundle -android-sdk /home/goldfish/bin/android-sdk-linux -android-ndk-platform android-14 -android-arch x86
          make -j4 && sudo make install
      

      2. The simplest code to reproduce bug.::

      // main.cpp
      #include <QtCore/qcoreapplication.h>
      
      int main(int argc, char **argv) {
          QCoreApplication app(argc, argv);
          qDebug("ok!");
          return 0;
      }
      

      3. Build the code using cmake with Android toolchain

      #CMakeLists.txt
      CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0 FATAL_ERROR)
      PROJECT(test002)
      SET(CMAKE_AUTOMOC ON)
      SET(CMAKE_INCLUDE_CURRENT_DIR ON)
      FIND_PACKAGE(Qt5Core CONFIG REQUIRED CMAKE_FIND_ROOT_PATH_BOTH)
      
      IF(ANDROID)
          LINK_DIRECTORIES(${_qt5Core_install_prefix}/lib/)
          SET(OS_EXTRA_LINK qtpcre2 z log)
      ENDIF()
      
      ADD_EXECUTABLE(test002 main.cpp)
      TARGET_LINK_LIBRARIES(test002 Qt5::Core ${OS_EXTRA_LINK})
      

      The command line to build:

      mkdir build
      cd build
      cmake -DANDROID_ABI=x86 -DANDROID_NDK=/home/goldfish/bin/android-sdk-linux/ndk-bundle -DCMAKE_TOOLCHAIN_FILE=/home/goldfish/bin/android-sdk-linux/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-14 -DCMAKE_PREFIX_PATH=/usr/local/Qt5.11.1-android-static-x86/lib/cmake ..
      make -j4
      

      4. Upload the executable to the storage of Android phone.

      adb push test002 /data/local/tmp
      

      5. Run executable from Android ADB shell.

      adb shell
      cd /data/local/tmp
      ./test002
      

      6. It crashes. And print:

      Segmentation fault
      

      Attachments

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

        Activity

          People

            taipan BogDan Vatra
            fish0619 Goldfish Huang
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes