On 2024/08/27 01:54, Stuart Henderson wrote:
> CVSROOT:      /cvs
> Module name:  ports
> Changes by:   [email protected]   2024/08/27 01:54:17
> 
> Modified files:
>       graphics/libavif: Makefile distinfo 
>       graphics/libavif/pkg: PLIST 
> 
> Log message:
> update to libavif-1.1.0, from Brad (maintainer)

This breaks kf5 and kf6 kimageformats:

https://exopi.bsdfrog.org/logs/latest/paths/devel/kf6/kimageformats.log
| [23/69] : && /exopi-obj/pobj/kimageformats-5.116.0/bin/c++ -fPIC 
-I/usr/local/include -fno-operator-names -Wno-gnu-zero-variadic-macro-arguments 
-Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long 
-Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual 
-Werror=return-type -Werror=init-self -Werror=undef -Wvla -Wdate-time -pedantic 
-Wzero-as-null-pointer-constant -fdiagnostics-color=always -fexceptions 
-DNDEBUG  -Wl,--fatal-warnings -Wl,--enable-new-dtags  -Wl,-Bsymbolic-functions 
-shared  -o bin/imageformats/kimg_avif.so 
src/imageformats/CMakeFiles/kimg_avif.dir/kimg_avif_autogen/mocs_compilation.cpp.o
 src/imageformats/CMakeFiles/kimg_avif.dir/avif.cpp.o  
-Wl,-z,origin,-rpath,/usr/local/lib/qt5/.:/usr/local/lib:/usr/X11R6/lib:  
/usr/local/lib/qt5/./libQt5Gui.so.4.2  /usr/local/lib/libavif.so.7.1  
/usr/local/lib/qt5/./libQt5Core.so.6.0  -lsharpyuv  -ldav1d  -laom  
-Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib && :
| FAILED: bin/imageformats/kimg_avif.so
| : && /exopi-obj/pobj/kimageformats-5.116.0/bin/c++ -fPIC -I/usr/local/include 
-fno-operator-names -Wno-gnu-zero-variadic-macro-arguments -Wall -Wextra 
-Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith 
-Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type 
-Werror=init-self -Werror=undef -Wvla -Wdate-time -pedantic 
-Wzero-as-null-pointer-constant -fdiagnostics-color=always -fexceptions 
-DNDEBUG  -Wl,--fatal-warnings -Wl,--enable-new-dtags  -Wl,-Bsymbolic-functions 
-shared  -o bin/imageformats/kimg_avif.so 
src/imageformats/CMakeFiles/kimg_avif.dir/kimg_avif_autogen/mocs_compilation.cpp.o
 src/imageformats/CMakeFiles/kimg_avif.dir/avif.cpp.o  
-Wl,-z,origin,-rpath,/usr/local/lib/qt5/.:/usr/local/lib:/usr/X11R6/lib:  
/usr/local/lib/qt5/./libQt5Gui.so.4.2  /usr/local/lib/libavif.so.7.1  
/usr/local/lib/qt5/./libQt5Core.so.6.0  -lsharpyuv  -ldav1d  -laom  
-Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib && :
| ld: error: unable to find library -lsharpyuv
| ld: error: unable to find library -ldav1d
| ld: error: unable to find library -laom
| c++: error: linker command failed with exit code 1 (use -v to see invocation)
| ninja: build stopped: subcommand failed.

Any ideas? The linker command changed which is obviously why it's
failing (no -L/usr/local/lib) :

-[...snip...] 
-Wl,-z,origin,-rpath,/usr/local/lib/qt5/.:/usr/local/lib:/usr/X11R6/lib:  
/usr/local/lib/qt5/./libQt5Gui.so.4.2  /usr/local/lib/libavif.so.7.0  
/usr/local/lib/qt5/./libQt5Core.so.6.0  
-Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib && :
+[...snip...] 
-Wl,-z,origin,-rpath,/usr/local/lib/qt5/.:/usr/local/lib:/usr/X11R6/lib:  
/usr/local/lib/qt5/./libQt5Gui.so.4.2  /usr/local/lib/libavif.so.7.1  
/usr/local/lib/qt5/./libQt5Core.so.6.0  -lsharpyuv  -ldav1d  -laom  
-Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib && :

The pc file did change, ...

 Name: libavif
 Description: Library for encoding and decoding .avif files
-Version: 1.0.4
+Version: 1.1.0
 Libs: -L${libdir} -lavif
+Libs.private: -lyuv
 Cflags: -I${includedir} -DAVIF_DLL
+Cflags.private: -UAVIF_DLL
+Requires.private: libsharpyuv dav1d aom

... but "pkg-config --libs libavif" looks ok (has -L/usr/local/lib in
both old and new versions). Not sure why kimageformats would be wanting
to pull things in from Requires.private at all (and then, if it's doing
that, why would it use shared libs, and why would it use them without
using the linker flag from "pkg-config --libs libsharpyuv"?)

...

https://exopi.bsdfrog.org/logs/latest/paths/devel/kf5/kimageformats.log

The version in kf5 has the same failure as above, plus additional
warnings which are probably worth fixing by backporting an upstream
commit

| 
/exopi-obj/pobj/kimageformats-5.116.0/kimageformats-5.116.0/src/imageformats/avif.cpp:622:9:
 warning: ignoring return value of function declared with 'nodiscard' attribute 
[-Wunused-result]
|         avifImageAllocatePlanes(avif, AVIF_PLANES_YUV);
|         ^~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
| 
/exopi-obj/pobj/kimageformats-5.116.0/kimageformats-5.116.0/src/imageformats/avif.cpp:809:13:
 warning: ignoring return value of function declared with 'nodiscard' attribute 
[-Wunused-result]
|             avifImageSetProfileICC(avif, reinterpret_cast<const uint8_t 
*>(iccprofile.constData()), iccprofile.size());
|             ^~~~~~~~~~~~~~~~~~~~~~ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 
/exopi-obj/pobj/kimageformats-5.116.0/kimageformats-5.116.0/src/imageformats/avif.cpp:981:13:
 warning: ignoring return value of function declared with 'nodiscard' attribute 
[-Wunused-result]
|             avifDecoderReset(m_decoder);
|             ^~~~~~~~~~~~~~~~ ~~~~~~~~~
| 3 warnings generated.

ok for this?

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/kf5/kimageformats/Makefile,v
diff -u -p -r1.21 Makefile
--- Makefile    14 Sep 2023 17:31:29 -0000      1.21
+++ Makefile    29 Aug 2024 10:44:25 -0000
@@ -1,5 +1,6 @@
 COMMENT =      KDE plugins for QImage supporting extra file formats
 DISTNAME =     kimageformats-${VERSION}
+REVISION =     0
 
 WANTLIB += ${COMPILER_LIBCXX} Iex-3_2 IlmThread-3_2 Imath-3_1
 WANTLIB += KF5Archive OpenEXR-3_2 Qt5Core Qt5Gui Qt5PrintSupport
Index: patches/patch-src_imageformats_avif_cpp
===================================================================
RCS file: patches/patch-src_imageformats_avif_cpp
diff -N patches/patch-src_imageformats_avif_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_imageformats_avif_cpp     29 Aug 2024 10:44:25 -0000
@@ -0,0 +1,72 @@
+From e9da5edb9a9dd518a603d7a19facf0f2fe38dde6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20Novomesk=C3=BD?= <[email protected]>
+Date: Mon, 15 Jul 2024 17:46:21 +0200
+Subject: [PATCH] avif: check return values
+
+Some libavif calls did not return values in the older versions.
+Situation changed meanwhile;
+we can check the return values for error conditions now.
+
+Index: src/imageformats/avif.cpp
+--- src/imageformats/avif.cpp.orig
++++ src/imageformats/avif.cpp
+@@ -619,7 +619,15 @@ bool QAVIFHandler::write(const QImage &image)
+         QImage tmpgrayimage = image.convertToFormat(tmpformat);
+ 
+         avif = avifImageCreate(tmpgrayimage.width(), tmpgrayimage.height(), 
save_depth, AVIF_PIXEL_FORMAT_YUV400);
++#if AVIF_VERSION >= 110000
++        res = avifImageAllocatePlanes(avif, AVIF_PLANES_YUV);
++        if (res != AVIF_RESULT_OK) {
++            qWarning("ERROR in avifImageAllocatePlanes: %s", 
avifResultToString(res));
++            return false;
++        }
++#else
+         avifImageAllocatePlanes(avif, AVIF_PLANES_YUV);
++#endif
+ 
+         if (tmpgrayimage.colorSpace().isValid()) {
+             avif->colorPrimaries = (avifColorPrimaries)1;
+@@ -806,7 +814,15 @@ bool QAVIFHandler::write(const QImage &image)
+         avif->transferCharacteristics = transfer_to_save;
+ 
+         if (iccprofile.size() > 0) {
++#if AVIF_VERSION >= 1000000
++            res = avifImageSetProfileICC(avif, reinterpret_cast<const uint8_t 
*>(iccprofile.constData()), iccprofile.size());
++            if (res != AVIF_RESULT_OK) {
++                qWarning("ERROR in avifImageSetProfileICC: %s", 
avifResultToString(res));
++                return false;
++            }
++#else
+             avifImageSetProfileICC(avif, reinterpret_cast<const uint8_t 
*>(iccprofile.constData()), iccprofile.size());
++#endif
+         }
+ 
+         avifRGBImage rgb;
+@@ -971,6 +987,8 @@ bool QAVIFHandler::jumpToNextImage()
+         return false;
+     }
+ 
++    avifResult decodeResult;
++
+     if (m_decoder->imageIndex >= 0) {
+         if (m_decoder->imageCount < 2) {
+             m_parseState = ParseAvifSuccess;
+@@ -978,11 +996,16 @@ bool QAVIFHandler::jumpToNextImage()
+         }
+ 
+         if (m_decoder->imageIndex >= m_decoder->imageCount - 1) { // start 
from beginning
+-            avifDecoderReset(m_decoder);
++            decodeResult = avifDecoderReset(m_decoder);
++            if (decodeResult != AVIF_RESULT_OK) {
++                qWarning("ERROR in avifDecoderReset: %s", 
avifResultToString(decodeResult));
++                m_parseState = ParseAvifError;
++                return false;
++            }
+         }
+     }
+ 
+-    avifResult decodeResult = avifDecoderNextImage(m_decoder);
++    decodeResult = avifDecoderNextImage(m_decoder);
+ 
+     if (decodeResult != AVIF_RESULT_OK) {
+         qWarning("ERROR: Failed to decode Next image in sequence: %s", 
avifResultToString(decodeResult));

Reply via email to