| Summary: | Krita 5.2.10 HEIF support does not build with libheif 1.20 | ||
|---|---|---|---|
| Product: | [Applications] krita | Reporter: | Brad Smith <brad> |
| Component: | File formats | Assignee: | Krita Bugs <krita-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | dimula73, halla |
| Priority: | NOR | ||
| Version First Reported In: | 5.2.10 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | All | ||
| Latest Commit: | https://invent.kde.org/graphics/krita/-/commit/169339accb9e4e0e0e9921176c5cd60d340b7b04 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
| Attachments: | Fix build with libheif 1.20 | ||
Yeah, maybe just build with 1.5 for now and file a bug report to the heif people? I'm pretty sure it's not good practice to change API without changing major version. Hi, Brad!
It seems like heif people have changed their API without increasing major version number. We haven't updated to this version yet, so please provide a patch and we will merge it. The issue looks simple, int vs size_t incompatibility. The patch should look like that (but in more places):
```
diff --git a/plugins/impex/heif/HeifExport.cpp b/plugins/impex/heif/HeifExport.cpp
index bb83111a62..441d692218 100644
--- a/plugins/impex/heif/HeifExport.cpp
+++ b/plugins/impex/heif/HeifExport.cpp
@@ -329,8 +329,14 @@ KisImportExportErrorCode HeifExport::convert(KisDocument *document, QIODevice *i
img.add_plane(heif_channel_Y, width, height, 8);
- int strideG = 0;
- int strideA = 0;
+#if LIBHEIF_HAVE_VERSION(1, XXX, YYY)
+ using HeifStrideType = size_t;
+#else
+ using HeifStrideType = int;
+#endif
+
+ HeifStrideType strideG = 0;
+ HeifStrideType strideA = 0;
uint8_t *ptrG = img.get_plane(heif_channel_Y, &strideG);
uint8_t *ptrA = [&]() -> uint8_t * {
```
(In reply to Dmitry Kazakov from comment #2) > Hi, Brad! > > It seems like heif people have changed their API without increasing major > version number. We haven't updated to this version yet, so please provide a > patch and we will merge it. The issue looks simple, int vs size_t > incompatibility. The patch should look like that (but in more places): Oh, thanks. I guess I thought there was more to the issue. The diff was pretty straightforward. Created attachment 183117 [details]
Fix build with libheif 1.20
I don't have a developer account to be able to create MRs. Thanks, I will check whether it still builds with the version of libheif we use. Git commit 6ad4fa68a9e1ce06fc884e34f3cedcdd4b9a2076 by Halla Rempt. Committed on 10/07/2025 at 08:08. Pushed by rempt into branch 'master'. Fix build with libheif 1.20 https://github.com/strukturag/libheif/issues/1419 introduced a source incompatible api change, this patch by Brad Smith make Krita build with 1.20. I've also checked with 1.15.2, which we use and it still builds. M +15 -9 plugins/impex/heif/HeifExport.cpp M +14 -8 plugins/impex/heif/HeifImport.cpp https://invent.kde.org/graphics/krita/-/commit/6ad4fa68a9e1ce06fc884e34f3cedcdd4b9a2076 Git commit 169339accb9e4e0e0e9921176c5cd60d340b7b04 by Halla Rempt. Committed on 10/07/2025 at 08:13. Pushed by rempt into branch 'krita/5.2'. Fix build with libheif 1.20 https://github.com/strukturag/libheif/issues/1419 introduced a source incompatible api change, this patch by Brad Smith make Krita build with 1.20. I've also checked with 1.15.2, which we use and it still builds. (cherry picked from commit 6ad4fa68a9e1ce06fc884e34f3cedcdd4b9a2076) M +15 -9 plugins/impex/heif/HeifExport.cpp M +14 -8 plugins/impex/heif/HeifImport.cpp https://invent.kde.org/graphics/krita/-/commit/169339accb9e4e0e0e9921176c5cd60d340b7b04 |
SUMMARY Krita 5.2.10 HEIF support does not build with libheif 1.20 STEPS TO REPRODUCE 1. Build with libheif 1.20 OBSERVED RESULT ``` /home/brad/ports/pobj/krita-5.2.10/krita-5.2.10/plugins/impex/heif/HeifExport.cpp:258:37: error: no matching member function for call to 'get_plane' 258 | uint8_t *ptrR = img.get_plane(heif_channel_R, &strideR); | ~~~~^~~~~~~~~ /usr/local/include/libheif/heif_cxx.h:909:32: note: candidate function not viable: no known conversion from 'int *' to 'size_t *' (aka 'unsigned long *') for 2nd argument 909 | inline const uint8_t* Image::get_plane(enum heif_channel channel, size_t* out_stride) const noexcept | ^ ~~~~~~~~~~~~~~~~~~ /usr/local/include/libheif/heif_cxx.h:914:26: note: candidate function not viable: no known conversion from 'int *' to 'size_t *' (aka 'unsigned long *') for 2nd argument 914 | inline uint8_t* Image::get_plane(enum heif_channel channel, size_t* out_stride) noexcept | ^ ~~~~~~~~~~~~~~~~~~ /home/brad/ports/pobj/krita-5.2.10/krita-5.2.10/plugins/impex/heif/HeifExport.cpp:259:37: error: no matching member function for call to 'get_plane' 259 | uint8_t *ptrG = img.get_plane(heif_channel_G, &strideG); | ~~~~^~~~~~~~~ /usr/local/include/libheif/heif_cxx.h:909:32: note: candidate function not viable: no known conversion from 'int *' to 'size_t *' (aka 'unsigned long *') for 2nd argument 909 | inline const uint8_t* Image::get_plane(enum heif_channel channel, size_t* out_stride) const noexcept | ^ ~~~~~~~~~~~~~~~~~~ /usr/local/include/libheif/heif_cxx.h:914:26: note: candidate function not viable: no known conversion from 'int *' to 'size_t *' (aka 'unsigned long *') for 2nd argument 914 | inline uint8_t* Image::get_plane(enum heif_channel channel, size_t* out_stride) noexcept | ^ ~~~~~~~~~~~~~~~~~~ /home/brad/ports/pobj/krita-5.2.10/krita-5.2.10/plugins/impex/heif/HeifExport.cpp:260:37: error: no matching member function for call to 'get_plane' 260 | uint8_t *ptrB = img.get_plane(heif_channel_B, &strideB); | ~~~~^~~~~~~~~ ... ``` EXPECTED RESULT The respective code builds Ok.