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

Android .aab bundle fails to link static library in subdir

    XMLWordPrintable

Details

    • Android
    • ebac49dd45ca75b1592122df5935017d4592c89d (qt/qtbase/dev)

    Description

      Trying to build an Android .aab for armeabi-v7a and arm64-v8a with a SUBDIRS based project. There is one subdir with

      TEMPLATE = lib
      TARGET = nymea-app
      CONFIG += staticlib
      

      and another subdir with

      TEMPLATE = app
      TARGET = nymea-app
      LIBS += -L../libnymea-app/ -lnymea-app

      The lib is built in

      $$OUT_PWD/libnymea-app/

      In there, it creates subfolders for the two architectures, however, the final libnymea-app.a is created directly in there and depending on which architecture finishes last, it will overwrite the other.

      This causes one of the arch builds of the app to fail linking as the lib is only available for one architecture.

      I have gotten around this by adding this to the lib:

      android: {
          DESTDIR = $${ANDROID_TARGET_ARCH}
      }
      

      and this to the app

      android: { 
          LIBS += -L $${top_builddir}/libnymea-app/$${ANDROID_TARGET_ARCH}
      }

      This makes it build successfully, however, I believe the build system should do this on its own, shouldn't it?

       

      I have found this branch which afaict fixes exactly this issue:

      https://codereview.qt-project.org/c/qt/qtbase/+/282873/3/mkspecs/features/android/android.prf

      However, this only seems to be run if for dynamic libs as it explicitly contains `!static` in the qmake condition.

      Attachments

        Issue Links

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

          Activity

            People

              alexandru.croitor Alexandru Croitor
              mzanetti2 Michael Zanetti
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes