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

[cmake] static linked Qt brings wrong 3rdparty usage requirements

    XMLWordPrintable

    Details

      Description

      i'm building statically linked Qt against statically linked binaries of libpng/libjpeg (but also libz, though that's less critical).

      to do this, i'm configuring my builds via

      -system-libpng -I path/to/my/libpng/include -L path/to/my/libpng/libs

      this approach worked fine for the last few years, as Qt didn't provide transitive usage requirements (i had do explicitly link my qt-based binaries against my libpng (or libjpeg)

      Qt-5.13 pulls in transitive usage requirements but brings the 3rdparty usage requirements for those 3rdparty libraries, too. however the builds are not relocatable any more.

      cmake will try to link via:

       

      c++ /buildserver/path/to/3rdparty-builds/libpng/lib/osx/libpng.a /buildserver/path/to/3rdparty-builds/zlib/lib/osx/libz.a /local/path/to/qt/checkout/Qt-5.13.0-macx-clang-static/lib/libQt5Core_debug.a [snip]
      

      the paths to the static qt libraries are resolved correctly (locally), but for the 3rdparty libraries, it includes the buildserver path.

      i'm not sure what's the best way to resolve it. possible options:

      • don't bring transitive usage requirements for system libraries if they are static
      • bundle static system libraries with qt (copy them into INSTALL_PREFIX/libs)

      note: for zlib it's merely a cosmetic issue because zlib is in qt prefixes all symbols, so it won't name-clash with a different zlib in the same DSO. for libpng and libjpeg the situation is different: it's not namespaced (by prefixing symbols) and one cannot mix binaries / headers of different version (i cannot link against qt's libpng, but compile against my libpng headers as the header version is encoded into the binary and it will cause run-time sanity checks / failures. same applies to libjpeg)

        Attachments

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

          Activity

            People

            • Assignee:
              kkohne Kai Köhne
              Reporter:
              timblechmann tim blechmann
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes