Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Configure & Build Qt 5.15.1 with MSVC 19.12 using external 3rd party libraries
Forum Updated to NodeBB v4.3 + New Features

Configure & Build Qt 5.15.1 with MSVC 19.12 using external 3rd party libraries

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
5 Posts 3 Posters 1.5k Views 3 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.
  • F Offline
    F Offline
    FlorianWolters
    wrote on last edited by FlorianWolters
    #1

    I'm trying to build the Open Source edition of Qt v5.15.1 from source, using qt-everywhere-src-5.15.1.zip.

    The toolchain is x64-windows-msvc1912-v141-dynamic-md (OS: Windows 7).

    This means in summary:

    • Build Qt LGPLv3 modules only.
    • Build Qt shared libraries only.
    • Use the compiler MSVC 19.12 with the platform toolset v141.
    • Use the shared Run-Time Library.

    Some of the 3rd party libraries (e.g. libtiff, zlib) Qt uses are already dependencies of existing components in my source code. In order to avoid problems due to ABI/API incompatibilities between the already build external 3rd party libraries and the bundled Qt 3rd party libraries I would like to configure Qt to use the already build ones.

    Here are my problems:

    1. I'm unable to build both the Release and the Debug build config when using external 3rd party libraries. It seems that the Qt build tries to use the Release library file for the Debug config as well. This results in _ITERATOR_DEBUG_LEVEL and RuntimeLibrary mismatch errors raised by MSVC. Each 3rd party library is build and "installed" using its official CMake file. The install tree for an external 3rd party library looks as follows:

      double-conversion-3.1.5
      +---x64-windows-msvc1912-v141-dynamic-md
      |   +---bin
      |   |       double-conversion.dll
      |   |       double-conversiond.dll
      |   +---include
      |   |   [...]      
      |   \---lib
      |       |   double-conversion.lib
      |       |   double-conversiond.lib
      |   [...]  
      \---x64-windows-msvc1912-v141-static-md
          +---include
          |   |   [...]
          \---lib
              |   double-conversion.lib
              |   double-conversiond.lib
          [...]
      
    2. I'm able to build Qt with the Release build config using only shared external 3rd party libraries. I would like to avoid this in order to minimize the total number of runtime dependencies. Trying to configure/build Qt using only static external 3rd party libraries fails (libjpeg, libpng, libtiff). This issue seems to be related to the following:

      • Existing compile/link dependencies between the prebuilt 3rd party libraries libraries (e.g. libtiff uses libjpeg, libpng uses zlib, etc.).
      • The Qt build wants to use a diffent install tree filesystem layout for 3rd party libraries (e.g. libpng uses the filename libpng16_static.lib).

    The following configure call is currently used:

    configure.bat^
     -recheck-all^
     -prefix "%install_prefix%"^
     -opensource^
     -confirm-license^
     -debug-and-release^
     -shared^
     -platform win32-msvc^
     -c++std 11^
     -make-tool jom^
     -mp^
     -silent^
     -skip qtcharts^
     -skip qtdatavis3d^
     -skip qtlottie^
     -skip qtnetworkauth^
     -skip qtvirtualkeyboard^
     -skip qtquick3d^
     -skip webglplugin^
     -skip webengine^
     -nomake examples^
     -nomake tests^
     -gui^
     -widgets^
     -accessibility^
     -no-glib^
     -no-icu^
     -ssl^
     -schannel^
     -opengl dynamic^
     -no-assimp^
     -system-doubleconversion^
     -system-freetype^
     -system-harfbuzz^
     -system-libjpeg^
     -system-libpng^
     -system-pcre^
     -system-sqlite^
     -system-tiff^
     -no-webp^
     -system-zlib^
     -I "%assimp_path%\include"^
     -L "%assimp_path%\lib"^
     -I "%doubleconversion_path%\include"^
     -L "%doubleconversion_path%\lib"^
     -I "%freetype_path%\include"^
     -L "%freetype_path%\lib"^
     -I "%harfbuzz_path%\include"^
     -L "%harfbuzz_path%\lib"^
     -I "%libjpeg_path%\include"^
     -L "%libjpeg_path%\lib"^
     -I "%libpng_path%\include"^
     -L "%libpng_path%\lib"^
     -I "%pcre2_path%\include"^
     -L "%pcre2_path%\lib"^
     -I "%sqlite_path%\include"^
     -L "%sqlite_path%\lib"^
     -I "%libtiff_path%\include"^
     -L "%libtiff_path%\lib"^
     -I "%libwebp_path%\include"^
     -L "%libwebp_path%\lib"^
     -I "%zlib_path%\include"^
     -L "%zlib_path%\lib"
    

    My questions are:

    1. Is there any way to specify the filename of each external 3rd party library for each build config, e.g. something like -D LIBPNG_LIBRARY_DEBUG=libpng16_staticd.lib and -D LIBPNG_LIBRARY_RELEASE=libpng16_static.lib?
    2. Is it required to use another install tree filesystem layout for the external 3rd party libraries and use two shadow builds (one using -debug and one using release)?
    3. Is it required to build the external 3rd party libraries with a very specific set of configure options? For example, breaks the dependency from libtiff to libjpeg (or any other dependency) the Qt build?
    4. Is all this unnecessary and I should use the libraries shipped with Qt because ABI/API concerns are not a problem in this case?

    In general, I need some advice how-to deal with this issues.

    Update: I've been able to build Qt with "minimal" bundled dependencies (-qt-doubleconversion and -qt-pcre, all other set with the -no- prefix). In this case the two 3rd party libraries seem to be linked static.

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

      Hi,

      From memory, on Windows, the usual way to separate debug and release builds is to use two different folders and use the same library name for both builds. Not the most practical indeed.

      If you want to custom these, you will likely have to tweak the .json files of the feature system of Qt. I am not sure it's worth the effort.

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

      F 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        From memory, on Windows, the usual way to separate debug and release builds is to use two different folders and use the same library name for both builds. Not the most practical indeed.

        If you want to custom these, you will likely have to tweak the .json files of the feature system of Qt. I am not sure it's worth the effort.

        F Offline
        F Offline
        FlorianWolters
        wrote on last edited by
        #3

        @SGaist Thanks for the answer. It seems one have to come up with a custom implemented superbuild (preferably in CMake) that does the build/install of the 3rd party libraries, renaming of library files (to be picked up by Qt, these are temporary files that can be deleted later), shadow building twice (one for debug, one for release, both with different paths pointing to the correct library files). Then a shared version of Qt (but with statically linked 3rd party libraries) should be possible.

        Wow...

        Certainly doable, but I think I will go with minimal deps first. VTK is on my list too, which bundles a lot more libraries... I think building Qt is easy in comparison to VTK. This takes so many hours. The C++ ecosystem is still a disgrace, imo.

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

          I haven't used it yet but maybe Conan might be an option for your third party librairies.

          IIRC, there's work done with it for Qt 6

          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
          • T Offline
            T Offline
            Taytoo
            wrote on last edited by
            #5

            @FlorianWolters I'm facing the same issue, were you able to figure out a solution?

            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