conda-forge / qt-main-feedstock

A conda-smithy repository for qt-main.
BSD 3-Clause "New" or "Revised" License
5 stars 29 forks source link

Managing additional external DLLs when packaging binary release with Qt dependency #191

Open mlaveaux opened 1 year ago

mlaveaux commented 1 year ago

Comment:

For our application we are depending on Qt5 and so far I have been using the binary installer provided by Qt itself. Then I use windeployqt.exe to copy all the required DLL dependencies by Qt next to the executable to package a binary release using cpack. This has been working fine so far, the package can be used on other machines as well. However, switching to conda-forge qt-main it seems that linking Qt (for example Qt5Core.dll) now also required several other DLLs such as:

pcre2-16.dll
liblzma.dll
Lerc.dll
zlib.dll
tiff.dll
libpng16.dll

However, these are not copied by windeployqt.exe since they are external to the Qt project. This means that it is no longer possible to create a package as easily since now we need to include these DLLs as well and they are kind of external to the build system. In fact I am unsure how to resolve this issue in general. Is this a limitation of using the qt-main package or is there something that I am missing?

hmaarrfk commented 1 year ago

I have not tried to use windeployqt.

We do link to the shared conda-forge libraries, see system flags https://github.com/conda-forge/qt-main-feedstock/blob/main/recipe/bld.bat#L88

I think we might have to patch https://code.qt.io/cgit/qt/qttools.git/tree/src/windeployqt/main.cpp?h=5.15

to find these external shared libraries.

not sure how though. patches would be welcome.

hmaarrfk commented 1 year ago

There are a few upstream bug reports and some hints for workarounds too https://bugreports.qt.io/browse/QTBUG-58088?jql=text+%7E+%22windeployqt%22

mlaveaux commented 1 year ago

I suppose patching windeployqt might work, will have to see about that since I am not so familiar with Conda behind the scenes. For deploying Linux the assumption is that these system provided libraries are always available? For Mac deployment the macdeployqt tool also might have to be adapted. Right now there is a bit of a pitfall between deploying binaries using the official Qt distribution vs using the Conda package.

hmaarrfk commented 1 year ago

conda(-forge) aims to provide as much of the libraries as it can. some must be provided by the operating system.

Library resolution between the different operations at runtime is quite different though.