[Buildroot] [PATCH v2,1/1] package/opencv4: new package

Arnout Vandecappelle arnout at mind.be
Tue Jul 27 21:18:09 UTC 2021



On 26/12/2020 11:42, Fabrice Fontaine wrote:
> opencv4 is not fully backward compatible with opencv3 as "a lot of C API
> from OpenCV 1.x has been removed.": https://opencv.org/opencv-4-0.
> 
> Moreover, it should be noted that layout of include files as well as
> pkg-config filename changed since
> https://github.com/opencv/opencv/commit/a95673287433fc810eda2d88b94bb234298c4cd5
> 
> All these changes mean that most of buildroot packages (e.g. vlc,
> ffmpeg) are not compatible with opencv4.
> 
> Here is the most important changes between opencv3 and opencv 4.5.1:
>  - License is Apache-2.0 (https://opencv.org/opencv-4-5-0)
>  - openjpeg is an optional dependency (enabled by default) since
>    https://github.com/opencv/opencv/commit/0384eb7d8c1a31831704e31b8bdbfbc6ff854281
>    jpeg2000 can be enabled through openjpeg or jasper
>  - pkg-config must be enabled with OPENCV_GENERATE_PKGCONFIG since
>    https://github.com/opencv/opencv/commit/e755a2a6e48ae02dd5136a628cc4148566a08225
>  - cmake is not installed in /usr/share anymore so hook can be dropped
>  - C++11 is required since
>    https://github.com/opencv/opencv/commit/d4688e6474dcd59c1d66736b744a8049f386a90b
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>


 Applied to master, thanks. With a few remarks.

[snip]
> +	depends on !BR2_PACKAGE_OPENCV3

 This is very annoying. Now it's OK, but it makes it a lot harder for another
package to select opencv4 - it quickly leads to circular dependencies (I
experienced that with lapack/clapack).

 Unfortunately, I don't know a good solution. A choice doesn't help either. The
best is actually if we can make the two side-by-side installable. The only
conflicting files are the .so symlinks. So, we could install the opencv4 .so
symlinks in a different directory and add an explicit -L to the dependent packages.

 On the other hand - opencv3 is dead, so mid-term we're going to remove it
anyway. So I guess we can live with packages depending on !OPENCV3.


[snip]
> +config BR2_PACKAGE_OPENCV4_WITH_GSTREAMER1
> +	bool "gstreamer-1.x"
> +	depends on BR2_USE_MMU # gstreamer1 -> libglib2
> +	depends on BR2_USE_WCHAR # gstreamer1 -> libglib> +	depends on BR2_TOOLCHAIN_HAS_THREADS # gstreamer1 -> libglib2

 These two are redundant with the dependencies of opencv4 itself. Normally I
like to keep them anyway, but since it also allows to remove the comment below,
I removed it in this case.

 There was another one like that as well.

> +	select BR2_PACKAGE_GSTREAMER1
> +	select BR2_PACKAGE_GST1_PLUGINS_BASE
> +	select BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_APP
> +	help
> +	  Enable gstreamer support.
> +
> +comment "gstreamer support needs a toolchain w/ wchar, threads"
> +	depends on BR2_USE_MMU
> +	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS

[snip]
> +comment "opencv4 needs a toolchain w/ C++, NPTL, wchar, dynamic library, gcc >= .8"

 4.8

[snip]


More information about the buildroot mailing list