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 and linking against Android zlib
Forum Updated to NodeBB v4.3 + New Features

qmake and linking against Android zlib

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 2 Posters 720 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,

    What a statement I have to put in qmake to link against /system/libs/libz.so for any Android target?

    All compiles fine, #include <zlib.h> works out of the box without any additional INCLUDEPATH
    but linking fails.
    All Android docs say zlib is part of Android NDK.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIK

      LIBS += -lz
      

      should be enough if zlib is Androïd standard library.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • SeeLookS Offline
        SeeLookS Offline
        SeeLook
        wrote on last edited by
        #3

        Not that easy,
        LIBS += -lz doesn't work - still the same linking error.

        I found that library in the location:
        toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/30/
        of the NDK
        or actually, inside many locations with different numbers and architectures.
        Probably some -Lsomewhere has to prelude -lz

        1 Reply Last reply
        0
        • SeeLookS Offline
          SeeLookS Offline
          SeeLook
          wrote on last edited by SeeLook
          #4

          I found the solution:

          My project was already linked with zlib and probably all Qt Android projects are,
          so the statement LIBS += -lz is not necessary at all.

          I was trying to compile minizip library (part of zlib project) but Android doesn't support fopen64.
          The solution was to add USE_FILE32API to definitions to say minizip not to use that.
          Adding to my qmake: DEFINES += USE_FILE32API solved linking errors.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved