On lunes, 6 de febrero de 2023 17:59:47 -03 Peter Pentchev wrote: [snip] > FWIW, I think that you're mostly on the right path, but with a small > correction: both zstd::libzstd_shared and zstd::libzstd_static are defined > by libzstd's newly-exposed CMake config.
Exactly. > I added --trace-expand to > qt6-base's dh_auto_configure arguments, and got (among much else) this > output: > > ... > /<<PKGBUILDDIR>>/cmake/FindWrapZSTD.cmake(21): find_package(zstd CONFIG > QUIET ) /usr/lib/x86_64-linux-gnu/cmake/zstd/zstdConfigVersion.cmake(12): > set(PACKAGE_VERSION 1.5.2 ) ... > /usr/lib/x86_64-linux-gnu/cmake/zstd/zstdTargets.cmake(69): > add_library(zstd::libzstd_shared SHARED IMPORTED ) > /usr/lib/x86_64-linux-gnu/cmake/zstd/zstdTargets.cmake(71): > set_target_properties(zstd::libzstd_shared PROPERTIES > INTERFACE_INCLUDE_DIRECTORIES /usr/include ) > /usr/lib/x86_64-linux-gnu/cmake/zstd/zstdTargets.cmake(76): > add_library(zstd::libzstd_static STATIC IMPORTED ) > /usr/lib/x86_64-linux-gnu/cmake/zstd/zstdTargets.cmake(78): > set_target_properties(zstd::libzstd_static PROPERTIES > INTERFACE_INCLUDE_DIRECTORIES /usr/include ) ... > /<<PKGBUILDDIR>>/cmake/FindWrapZSTD.cmake(25): if(TARGET > zstd::libzstd_static OR TARGET zstd::libzstd_shared ) ... > /<<PKGBUILDDIR>>/cmake/FindWrapZSTD.cmake(28): if(TARGET > zstd::libzstd_static ) /<<PKGBUILDDIR>>/cmake/FindWrapZSTD.cmake(29): > set(zstdtargetsuffix _static ) ... > > So qt6-base's cmake/FindWrapZSTD.cmake file asks CMake about the zstd > configuration, then correctly determines that either the shared or > the static libraries are defined as CMake targets (they both are), and > then, at cmake/FindWrapZSTD.cmake line 28, prefers the static one to > the shared one. That's what caused the change in behavior. Once again, exactly. > > I'll open a bug upstream about this, in the meantime I'll create a > > derivative patch that forces using the shared library, ie , being more > > aggressive so it's understood. > > Thanks for your analysis and your work! My pleasure! I realized what you wrote above when writing the upstream bug. Now we will need to see what upstream does, because according to Thiago there is a chance that the CMake support in libzstd is non-official... which I do not care much for as long as it works :-) Anyways forcing the right behavior in Qt is done and that's the kind of patch I don't mind keeping.