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. qmake SUBDIRS and Qt libraries dependencies
Qt 6.11 is out! See what's new in the release blog

qmake SUBDIRS and Qt libraries dependencies

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 2 Posters 1.3k 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.
  • SeeLookS Offline
    SeeLookS Offline
    SeeLook
    wrote on last edited by
    #1

    Hi!

    I have quite complex project divided on libraries.
    In qmake file I'm using SUBDIRS template, more-less like this:

    SUBDIRS = src/lib1\
              src/lib2\
              src/main\
    

    In main there are files for android build and I'm adding the libraries with the following statement:

    ANDROID_EXTRA_LIBS += $$OUT_PWD/lib1.so\
                            $$OUT_PWD/lib2.so\
    

    All works fine, Android apk is built correctly.

    The problem occurs when some library, i.e. lib1 depends on Qt module that main application library doesn't.
    Concretely, lib1 uses QtNetwork mod but main doesn't
    In that case the application crashes during launch due to unable to load QtNetwork lib (even if I'm trying to add it with ANDROID_EXTRA_LIBS and apk contains it).
    My workaround for it is to add some dummy method in main (never called) that uses something from QtNetwork mod. This way all works.

    So, is there any better way ?

    kshegunovK 1 Reply Last reply
    0
    • SeeLookS SeeLook

      Hi!

      I have quite complex project divided on libraries.
      In qmake file I'm using SUBDIRS template, more-less like this:

      SUBDIRS = src/lib1\
                src/lib2\
                src/main\
      

      In main there are files for android build and I'm adding the libraries with the following statement:

      ANDROID_EXTRA_LIBS += $$OUT_PWD/lib1.so\
                              $$OUT_PWD/lib2.so\
      

      All works fine, Android apk is built correctly.

      The problem occurs when some library, i.e. lib1 depends on Qt module that main application library doesn't.
      Concretely, lib1 uses QtNetwork mod but main doesn't
      In that case the application crashes during launch due to unable to load QtNetwork lib (even if I'm trying to add it with ANDROID_EXTRA_LIBS and apk contains it).
      My workaround for it is to add some dummy method in main (never called) that uses something from QtNetwork mod. This way all works.

      So, is there any better way ?

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @SeeLook
      Hi,
      Take a look here it should be helpful for your case. Just add the appropriate modules to each of the targets and set the targets' dependencies appropriately.

      Kind regards.

      Read and abide by the Qt Code of Conduct

      SeeLookS 1 Reply Last reply
      0
      • kshegunovK kshegunov

        @SeeLook
        Hi,
        Take a look here it should be helpful for your case. Just add the appropriate modules to each of the targets and set the targets' dependencies appropriately.

        Kind regards.

        SeeLookS Offline
        SeeLookS Offline
        SeeLook
        wrote on last edited by SeeLook
        #3

        @kshegunov
        Thank You for the answer and sorry for my late response....

        SUBDIRS documentation was quite interesting but a solution is rather not there.
        To properly load all dependencies during launching under Android, the apk has to have the list of them and androiddeployqt is responsible for that.
        I dig its doc and found ANDROID_DEPLOYMENT_DEPENDENCIES variable which can overwrite the list of libs automatically detected by androiddeployqt but I have to take responsibility to put there all dependencies in proper order.
        I will try so...

        Thanks

        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