[libjpeg-turbo] Patch vcpkg dependencies for 3.2.0 - #52891
Conversation
|
The static versions are all likely failing due to this problem GPT 5.6 Sol found:
You might also want to fix this other bit it found while you are here but that's not blocking:
|
…static-md since MSVC is not supported
| -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12.1) | ||
| +CMAKE_MINIMUM_REQUIRED(VERSION 3.5) |
There was a problem hiding this comment.
I believe these CMAKE_MINIMUM_REQUIRED changes are not necessary in a vcpkg patch. vcpkg uses CMake > 4 and does set(ENV{CMAKE_POLICY_VERSION_MINIMUM} 3.5)
There was a problem hiding this comment.
These CMake changes are part of the upstream PR used to generate the patch file: OpenKinect/libfreenect2#1209
|
|
||
| IF(LIBFREENECT2_WITH_VT_SUPPORT) | ||
| - FIND_PACKAGE(TurboJPEG) | ||
| + find_package(libjpeg-turbo CONFIG) |
There was a problem hiding this comment.
You might do
| + find_package(libjpeg-turbo CONFIG) | |
| + find_package(TurboJPEG NAMES libjpeg-turbo) |
and get the original TurboJPEG_FOUND. And then reduce patching in other spots.
There was a problem hiding this comment.
I've regenerated the find_libjpegturbo.patch file to instead modify the cmake_modules/FindTurboJPEG.cmake file, leaving the main CMakeLists.txt file for libfreenect2 unmodified. Hopefully this is acceptable.
| + find_dependency(PkgConfig) | ||
| + if(PkgConfig_FOUND) | ||
| + pkg_check_modules(spng REQUIRED spng IMPORTED_TARGET) | ||
| + endif() |
There was a problem hiding this comment.
Using imported targets from pkgconfig is complicated for reverse dependencies with MSVC. In other ports we use the variables (and in particular <Prefix>_LINK_LIBRARIES) to get resolved libs instead.
There was a problem hiding this comment.
These patches are generated from upstream libjpeg-turbo commits which will be included in the next libjpeg-turbo release. The patches may therefore be removed from the portfile when an update is available for the next version of libjpeg-turbo.
I've included comments in the portfile referencing the upstream commits used for the patch files.
There was a problem hiding this comment.
That's not true in general. If we see something bogus we can fix bogus and submit the fix for bogus upstream. I agree with Kai Pastor (@dg0yt) and think this is incorrect. Zlib has conventions for how it is found in CMake, and libspng publishes CMake configs: https://github.com/randy408/libspng/blob/adc94393dbeddf9e027d1b2dfff7c1bab975224e/CMakeLists.txt#L65-L81
We should stay entirely in the CMake configs namespace if at all possible and it appears possible here.
There was a problem hiding this comment.
Oh, I see, this is confusing because it's patches on patches. Kai Pastor (@dg0yt) I think your comment is resolved by 0002+0003 in this series.
| + if(PkgConfig_FOUND) | ||
| + pkg_check_modules(spng REQUIRED spng IMPORTED_TARGET) | ||
| + endif() | ||
| + else() |
There was a problem hiding this comment.
Did you mean
| + else() | |
| + endif() | |
| + if(WITH_SYSTEM_ZLIB) |
(one extra line)
There was a problem hiding this comment.
This also is from the upstream libjpeg-turbo commits used to generate the patch file. The intention would be that these patches can be removed in a future release while maintining the same functionality. The specific commits used for the libjpeg-turbo patches are now listed in comments in the portfile.
Billy O'Neal (BillyONeal)
left a comment
There was a problem hiding this comment.
The pkgconfig fix for libspng is not quite right because they make libspng_static.pc for static targets. I'm trying to prepare a fix for upstream. But for now posting this stuff about the freenect2 changes because that's separable.
| # force use of OpenCL 1.2 | ||
| #string(APPEND VCPKG_CXX_FLAGS " -DCL_TARGET_OPENCL_VERSION=120") | ||
| #string(APPEND VCPKG_C_FLAGS " -DCL_TARGET_OPENCL_VERSION=120") | ||
|
|
There was a problem hiding this comment.
We should not check in commented out code unless we are documenting specific instructions on how one is to create an overlay. Also given the changes to vcpkg_cmake_configure below it seems likely that these are wrong.
Also GPT 5.6 Sol observes that both of these are dead / disconnected.
| + find_dependency(PkgConfig) | ||
| + if(PkgConfig_FOUND) | ||
| + pkg_check_modules(spng REQUIRED spng IMPORTED_TARGET) | ||
| + endif() |
There was a problem hiding this comment.
That's not true in general. If we see something bogus we can fix bogus and submit the fix for bogus upstream. I agree with Kai Pastor (@dg0yt) and think this is incorrect. Zlib has conventions for how it is found in CMake, and libspng publishes CMake configs: https://github.com/randy408/libspng/blob/adc94393dbeddf9e027d1b2dfff7c1bab975224e/CMakeLists.txt#L65-L81
We should stay entirely in the CMake configs namespace if at all possible and it appears possible here.
| "port-version": 2, | ||
| "port-version": 3, | ||
| "description": "Open source drivers for the Kinect for Windows v2 device", | ||
| "homepage": "https://github.com/OpenKinect/libfreenect2", |
There was a problem hiding this comment.
This repo appears dead for the last 6 years. Are you making this change just because it is needed to do the libjpeg-turbo fix or is this something you're actually trying to use? If the former, we should consider deindexing this thing rather than extensive patches. If the latter, do you have evidence of signs of life upstream?
| + find_dependency(PkgConfig) | ||
| + if(PkgConfig_FOUND) | ||
| + pkg_check_modules(spng REQUIRED spng IMPORTED_TARGET) | ||
| + endif() |
There was a problem hiding this comment.
Oh, I see, this is confusing because it's patches on patches. Kai Pastor (@dg0yt) I think your comment is resolved by 0002+0003 in this series.
|
:sigh: The rabbit hole deepens. The vcpkg libspng port has confused pkgconfig bindings between static and dynamic. However, upstream is not consistent about it. installs installs https://packages.debian.org/sid/amd64/libspng-dev/filelist Looks like Debian is using the meson build, given that they install |
In vcpkg we want to make sure that CMake and pkg-config customers get an experience that works, including transitively. In reviewing microsoft/vcpkg#52891 we discovered that the transitive libjpeg-turbo -> libspng .pc link is broken. In trying to fix that I ran into a transitive problem here. https://github.com/randy408/libspng/blob/adc94393dbeddf9e027d1b2dfff7c1bab975224e/CMakeLists.txt#L103-L107 installs `libspng.pc` and `libspng_static.pc`, but https://github.com/randy408/libspng/blob/adc94393dbeddf9e027d1b2dfff7c1bab975224e/meson.build#L82-L87 installs `spng.pc`. This seems to be the one `libjpeg-turbo` is looking to be compatible with. https://packages.debian.org/sid/amd64/libspng-dev/filelist Looks like Debian is using the meson build, given that they install `/usr/lib/x86_64-linux-gnu/pkgconfig/spng.pc`. Also, meson detects whether the .pc should link with `libm` by probing for existence of the library: https://github.com/randy408/libspng/blob/adc94393dbeddf9e027d1b2dfff7c1bab975224e/meson.build#L42 while CMake just assumes "Windows gets no libm, everyone else does". This change changes everything to match meson. The problems discussed here and some of the suggested outcomes are from GPT 5.6 Sol.
Related: microsoft#52891 Related: randy408/libspng#286 This changes libspng to install pkg-config on all platforms matching that installed by Debian. Also fix the declared licenses to match the SPDX expression. Their README says: >## License > >Code is licensed under the BSD 2-clause "Simplified" License. > >The project contains optimizations and test images from libpng, these are licensed under the [PNG Reference Library License version 2](http://www.libpng.org/pub/png/src/libpng-LICENSE.txt). but they don't have a copy of the license. The content under that license is incorporated into the .c so we have to install the whole thing.
|
I was going to throw up my hands and be like "well Windows pkgconfig is hopeless but at least we can make *nix work"; unfortunately that still runs into the problem that vcpkg's installed |
|
(Alternately I suppose we could patch libjpeg-turbo to use the names vcpkg installs but given that we already have a submitted PR fixing libspng so that libjpeg-turbo does the right thing it's probably best to wait for that) Thanks for your submission and sorry for the stream of consciousness :) |
Billy O'Neal (@BillyONeal), thanks for taking a look at this - I hadn't realised what a can of worms I was opening when I started this.... I'm happy to clean this PR up once the libspng PR is merged and a decision is made on libfreenect2. I can produce a PR to delist libfreenect2 if that's helpful. |
|
Billy O'Neal (@BillyONeal) Kai Pastor (@dg0yt) - thanks for your continued assistance on this one. |
PR to deindex libfreenect2: #53516 |
|
I don't have time for details before sunday. |
Kai Pastor (@dg0yt) There is a pending PR that Billy O'Neal (@BillyONeal) prepared for the libspng issue: #53510 I think that the "patches on patches" referred to is the series of 3 commits that I generated patch files for from the upstream libjpeg-turbo repo. These are still in place. It was my intention that these will then be removed when the next version of libjpeg-turbo is added to vcpkg as that version will already contain these commits. |
Probably would be less confusing to prepare one patch and just comment that it is composed of the particular commits, e.g. git apply A
git apply B
git apply C
git diff --cached --output out.diff |
…peg-turbo-3.2.0-dependencies-patch
./vcpkg x-add-version --alland committing the result.The port file update will use the zlib and libspng dependencies introduced with libjpeg-turbo 3.2.0 from vcpkg rather than building additional copies of these from the libjpeg-turbo source tree.
The libjpeg-turbo patch files have been generated directly from commits in the upstream project repository and may be removed with a port update to a future version of libjpeg-turbo. Related libjpeg-turbo issue: libjpeg-turbo/libjpeg-turbo#901