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

libunwind is not excluded on android-clang builds

XMLWordPrintable

    • Android
    • 74e04d6ace7aa949db97ae2e46c38a4dc0d4d36a (qt/qtbase/5.12)

      When building Qt for Android with clang and NDK 18 for ARMv7 libunwind has to be added to exclude-libs. Here is a discussion in issue thread on NDK GitHub:
      https://github.com/android-ndk/ndk/issues/889
      When building with CMake it is set properly by CMake toolchain file provided by NDK:

      # STL specific flags.
      set(ANDROID_STL_PATH "${ANDROID_NDK}/sources/cxx-stl/llvm-libc++")
      if(ANDROID_STL STREQUAL system)
        set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
          "${ANDROID_NDK}/sources/cxx-stl/system/include")
      elseif(ANDROID_STL MATCHES "^c\\+\\+_")
        if(ANDROID_ABI MATCHES "^armeabi")
          list(APPEND ANDROID_LINKER_FLAGS -Wl,--exclude-libs,libunwind.a)
        endif()
      
        list(APPEND ANDROID_COMPILER_FLAGS_CXX -std=c++11)
      
        # Add the libc++ lib directory to the path so the linker scripts can pick up
        # the extra libraries.
        list(APPEND ANDROID_LINKER_FLAGS
          "-L${ANDROID_STL_PATH}/libs/${ANDROID_ABI}")
      
        set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES "${ANDROID_STL_PATH}/include")
      
        if(ANDROID_PLATFORM_LEVEL LESS 21)
          set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
            "${CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES}"
            "${ANDROID_NDK}/sources/android/support/include")
        endif()
      
        set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
          "${CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES}"
          "${ANDROID_STL_PATH}abi/include")
      endif()
      

      This is not reflected in qtbase/mkspecs/android-clang/qmake.conf.

      This is important when dealing with exceptions as without that application crashes when exception is caught as it gets symbols from wrong libraries.

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

            taipan BogDan Vatra
            faldżip Filip Piechocki
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes