Skip to contentSkip to conversation

package/opencv: depend on webp mux/demux

PATCH In review Alessandro Rubini 2 participants 8 messages Jul 26 – Aug 29

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/opencv: depend on webp mux/demux

Without this dependency, autoconfiguration fails:

CMake Error: The following variables are used in this project,
but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly
in the CMake files:
WEBP_DEMUX_LIBRARY
linked by target "opencv_imgcodecs"
in directory [...]/build/opencv4-4.13.0/modules/imgcodecs
WEBP_MUX_LIBRARY
linked by target "opencv_imgcodecs"
in directory [...]/build/opencv4-4.13.0/modules/imgcodecs

---
 package/opencv4/Config.in  | 2 ++
 package/opencv4/opencv4.mk | 1 +
 2 files changed, 3 insertions(+)
package/opencv4/Config.in +2 -0
index 47c1cf3f4a..856f3e8abd 100644
@@ -7,6 +7,8 @@ menuconfig BR2_PACKAGE_OPENCV4
 	depends on !BR2_STATIC_LIBS # include dlfcn.h
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11
 	select BR2_PACKAGE_ZLIB
+	select BR2_PACKAGE_WEBP_DEMUX
+	select BR2_PACKAGE_WEBP_MUX
 	help
 	  OpenCV (Open Source Computer Vision) is a library of
 	  programming functions for real time computer vision.
package/opencv4/opencv4.mk +1 -0
index 0e2567eb6f..b08e8a33d4 100644
@@ -261,6 +261,7 @@ OPENCV4_CONF_OPTS += \
 	-DWITH_XINE=OFF
 
 OPENCV4_DEPENDENCIES += host-pkgconf zlib
+OPENCV4_DEPENDENCIES += webp
 
 ifeq ($(BR2_PACKAGE_OPENCV4_CONTRIB),y)
 # OPENCV4 depends on OPENCV4_CONTRIB, and not the other way around.
Signature · 5 lines
2.47.3
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Alessandro,

Thanks for your patch!

Quoted 24 lines · Alessandro Rubini

Without this dependency, autoconfiguration fails:

CMake Error: The following variables are used in this project,
but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly
in the CMake files:
WEBP_DEMUX_LIBRARY
linked by target "opencv_imgcodecs"
in directory [...]/build/opencv4-4.13.0/modules/imgcodecs
WEBP_MUX_LIBRARY
linked by target "opencv_imgcodecs"
in directory [...]/build/opencv4-4.13.0/modules/imgcodecs

---
 package/opencv4/Config.in  | 2 ++
 package/opencv4/opencv4.mk | 1 +
 2 files changed, 3 insertions(+)
package/opencv4/Config.in +0 -0
index 47c1cf3f4a..856f3e8abd 100644

package/opencv4/Config.in menuconfig BR2_PACKAGE_OPENCV4 · line 11

Quoted 5 lines
package/opencv4/Config.in +2 -0
@@ -7,6 +7,8 @@ menuconfig BR2_PACKAGE_OPENCV4
 	depends on !BR2_STATIC_LIBS # include dlfcn.h
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11
 	select BR2_PACKAGE_ZLIB
+	select BR2_PACKAGE_WEBP_DEMUX
+	select BR2_PACKAGE_WEBP_MUX

I don't think this is correct, because here a build of opencv4 with nothing special works fine, so it means that webp doesn't seem to be a mandatory dependency of opencv4, but your patch turns webp into a mandatory dependency of opencv4.

Basically here:

BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_AARCH64_GLIBC_STABLE=y BR2_PACKAGE_OPENCV4=y

builds fine.

But I do see autobuilder failures for this issue, for example:

https://autobuild.buildroot.net/results/acb/acbddbea6d18272b5830be1b5fa5f40cf37e0389/build-end.log

In the autobuilders, I see that the few occurrences of this failures occur when BR2_PACKAGE_OPENCV4_WITH_WEBP is enabled, which pulls in webp as a dependency already.

So two things need to be figured out:

1. Under what conditions exactly is webp required, so that the dependency can be added only when needed

2. Since when the problem exists. Indeed, when we are fixing bugs, we always have to figure out if the fix needs to be backported to our stable branch (currently 2025.02.x), so every fix must come with a reference to the commit that introduced the problem in the first place. Or at least figure out whether 2025.02.x was affected or not.

Also, your patch could anyway not be correct, because we already have:

ifeq ($(BR2_PACKAGE_OPENCV4_WITH_WEBP),y)
OPENCV4_CONF_OPTS += -DWITH_WEBP=ON
OPENCV4_DEPENDENCIES += webp
else
OPENCV4_CONF_OPTS += -DWITH_WEBP=OFF
endif

which adds webp conditionally, and it wouldn't make sense to add it unconditionally, and then have some logic to add it conditionally.

Could you have a look into this?

Thanks a lot!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
Quoted 3 lines · Thomas Petazzoni

In the autobuilders, I see that the few occurrences of this failures occur when BR2_PACKAGE_OPENCV4_WITH_WEBP is enabled, which pulls in webp as a dependency already.

Ah, I can indeed reproduce the problem with:

BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_AARCH64_GLIBC_STABLE=y BR2_PACKAGE_OPENCV4=y BR2_PACKAGE_OPENCV4_WITH_WEBP=y

but in this case, webp is already added as a dependency of opencv4. So your patch is not actually correct.

What I guess happens is that we build webp without demux/mux support, so we're missing features. So I believe the correct fix is probably:

package/opencv4/Config.in +2 -0
index 47c1cf3f4a..e4a15f742b 100644
@@ -369,6 +369,8 @@ config BR2_PACKAGE_OPENCV4_WITH_V4L
 config BR2_PACKAGE_OPENCV4_WITH_WEBP
        bool "webp support"
        select BR2_PACKAGE_WEBP
+       select BR2_PACKAGE_WEBP_DEMUX
+       select BR2_PACKAGE_WEBP_MUX
        help
          Enable WebP support.
 

Remains to figure out since when this problem occurs. The 4.12.0 -> 4.13.0 bump of opencv4 in commit 33178c538541be224e49b5f548bd5404de3912fa ? But this one has been around for quite a while.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
Quoted 4 lines · Thomas Petazzoni via buildroot

Remains to figure out since when this problem occurs. The 4.12.0 -> 4.13.0 bump of opencv4 in commit 33178c538541be224e49b5f548bd5404de3912fa ? But this one has been around for quite a while.

So, I've tested on 2025.02.16, the latest commit of our oldest maintained LTS branch, and the issue is there. I don't think it is worth the effort tracing it down further than that, stating in the commit log that the issue exists in 2025.02.x should be good enough.

Alessandro, will you submit an updated patch, or should I do so?

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Thank you Thomas for your feedback and comments.

Quoted 1 line

Alessandro, will you submit an updated patch, or should I do so?

I am almost offline and very busy, until the 26th included, so please take it over if you want (this applies to all of your messages sent on Aug 21st). I will be albe to work on Buildroot on the 27th, but it may be inconveniently late.

grazie, saluti
/alessandro

Signature · 6 lines
  +39-0382-529554 sempre, solo se ci sono
  +39-349-2689041 sempre, solo se c'è campo
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

PATCH v2 1/1 package/opencv: fix a webp dependency

In reply to Thomas Petazzoni via buildroot

When BR2_PACKAGE_OPENCV4_WITH_WEBP=y we need to enable mux and demux too, otherwise build fails as follows:

CMake Error: The following variables are used in this project,
but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly
in the CMake files:
WEBP_DEMUX_LIBRARY
linked by target "opencv_imgcodecs"
in directory [...]/build/opencv4-4.13.0/modules/imgcodecs
WEBP_MUX_LIBRARY
linked by target "opencv_imgcodecs"
in directory [...]/build/opencv4-4.13.0/modules/imgcodecs

The issue already exists in 2025.02.x (thanks Thomas for checking), but not in 2023.08.x whence my defconfig originated.

---

This is v2 of what was called "package/opencv: depend on webp mux/demux", but as suggested by Thomas the dependency is not uplevel, so this is fixed according to his suggestions. Tested on current master.

 package/opencv4/Config.in | 2 ++
 1 file changed, 2 insertions(+)
package/opencv4/Config.in +2 -0
index 47c1cf3f4a..e4a15f742b 100644
@@ -369,6 +369,8 @@ config BR2_PACKAGE_OPENCV4_WITH_V4L
 config BR2_PACKAGE_OPENCV4_WITH_WEBP
 	bool "webp support"
 	select BR2_PACKAGE_WEBP
+	select BR2_PACKAGE_WEBP_DEMUX
+	select BR2_PACKAGE_WEBP_MUX
 	help
 	  Enable WebP support.
 
Signature · 5 lines
2.47.3
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by Thomas Petazzoni on v2 1/1
#6 lore raw

Re: [Buildroot] [PATCH v2] package/opencv: fix a webp dependency

Hello,

Thanks for this new iteration!

Quoted 14 lines · Alessandro Rubini

When BR2_PACKAGE_OPENCV4_WITH_WEBP=y we need to enable mux and demux too, otherwise build fails as follows:

CMake Error: The following variables are used in this project,
but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly
in the CMake files:
WEBP_DEMUX_LIBRARY
linked by target "opencv_imgcodecs"
in directory [...]/build/opencv4-4.13.0/modules/imgcodecs
WEBP_MUX_LIBRARY
linked by target "opencv_imgcodecs"
in directory [...]/build/opencv4-4.13.0/modules/imgcodecs

Quoted 2 lines

The issue already exists in 2025.02.x (thanks Thomas for checking), but not in 2023.08.x whence my defconfig originated.

The mention of 2023.08.x and your defconfig here is not very useful.

Quoted 2 lines

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

Re: [Buildroot] [PATCH v2] package/opencv: fix a webp dependency

In reply to Alessandro Rubini
Quoted 14 lines · Alessandro Rubini

When BR2_PACKAGE_OPENCV4_WITH_WEBP=y we need to enable mux and demux too, otherwise build fails as follows:

CMake Error: The following variables are used in this project,
but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly
in the CMake files:
WEBP_DEMUX_LIBRARY
linked by target "opencv_imgcodecs"
in directory [...]/build/opencv4-4.13.0/modules/imgcodecs
WEBP_MUX_LIBRARY
linked by target "opencv_imgcodecs"
in directory [...]/build/opencv4-4.13.0/modules/imgcodecs

Quoted 4 lines

The issue already exists in 2025.02.x (thanks Thomas for checking), but not in 2023.08.x whence my defconfig originated.

Applied to master after slightly tweaking the commit message, especially to add a reference to the autobuilder failure being fixed, thanks!

Best regards,

Thomas Petazzoni

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot