Message ID | 20251020131034.26278-1-laurent.pinchart@ideasonboard.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
On Mon, Oct 20, 2025 at 04:10:34PM +0300, Laurent Pinchart wrote: > The libyuv wrap uses a libyuv commit between versions 1770 and 1772, > more than 5 years old. This specifies CMake 2.8 as the minimum required > version. > > The most recent CMake has dropped compatibility with versions older than > 3.5 in CMake 4.0. CMake 3.5 was released in 2016, and all distributions > we care about ship more recent versions. With CMake 4.0 or newer, > shipped for instance by Gentoo, compilation of the libyuv wrap fails. > > Update the wrap to version 1921, which is the latest numbered version > (libyuv doesn't tag release by increases a version number in the > README.chromium file). This requires CMake 3.16, released 6 years ago, > and available in at least the last two LTS of major distributions. > > This update introduces an issue: due to a bug in Meson (see > https://github.com/mesonbuild/meson/issues/10764), PIC handling is > broken when a CMake project wraps a static library into another static > library that has no additional source file. Work around it by wrapping > the libyuv static library again, manually setting 'pic' to true. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> I forgot to add the tags from v1: Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > Changes since v1: > > - Update to version 1921 > --- > src/meson.build | 16 +++++++++++++++- > subprojects/libyuv.wrap | 2 +- > 2 files changed, 16 insertions(+), 2 deletions(-) > > diff --git a/src/meson.build b/src/meson.build > index 8eb8f05b362f..9b63c8e845d8 100644 > --- a/src/meson.build > +++ b/src/meson.build > @@ -55,7 +55,21 @@ if (pipelines.contains('virtual') or get_option('android').allowed()) and \ > '-Wno-unused-parameter') > libyuv_vars.append_link_args('-ljpeg') > libyuv = cmake.subproject('libyuv', options : libyuv_vars) > - libyuv_dep = libyuv.dependency('yuv') > + > + # Meson fails to apply the -fPIC flag to static libraries produced by CMake > + # that wraps other static libraries without adding any source file, despite > + # setting CMAKE_POSITION_INDEPENDENT_CODE to ON. See > + # https://github.com/mesonbuild/meson/issues/10764. > + # > + # Work around the issue by wrapping the libyuv static library into another > + # static library with 'pic' set to true. > + libyuv_static = static_library('libyuv-static', > + dependencies : libyuv.dependency('yuv'), > + pic : true, > + install : false) > + libyuv_include = libyuv.include_directories('yuv') > + libyuv_dep = declare_dependency(link_with : libyuv_static, > + include_directories : libyuv_include) > endif > > # libcamera must be built first as a dependency to the other components. > diff --git a/subprojects/libyuv.wrap b/subprojects/libyuv.wrap > index 3417e73f376c..c85b96b77345 100644 > --- a/subprojects/libyuv.wrap > +++ b/subprojects/libyuv.wrap > @@ -3,4 +3,4 @@ > [wrap-git] > directory = libyuv > url = https://chromium.googlesource.com/libyuv/libyuv.git > -revision = 93b1b332cd60b56ab90aea14182755e379c28a80 > +revision = 2b4453d46faebcad72d744d763a4e3b1e97d338d > > base-commit: 06aee9135f9fd135a8c0bc0b55971b29f7617d02
diff --git a/src/meson.build b/src/meson.build index 8eb8f05b362f..9b63c8e845d8 100644 --- a/src/meson.build +++ b/src/meson.build @@ -55,7 +55,21 @@ if (pipelines.contains('virtual') or get_option('android').allowed()) and \ '-Wno-unused-parameter') libyuv_vars.append_link_args('-ljpeg') libyuv = cmake.subproject('libyuv', options : libyuv_vars) - libyuv_dep = libyuv.dependency('yuv') + + # Meson fails to apply the -fPIC flag to static libraries produced by CMake + # that wraps other static libraries without adding any source file, despite + # setting CMAKE_POSITION_INDEPENDENT_CODE to ON. See + # https://github.com/mesonbuild/meson/issues/10764. + # + # Work around the issue by wrapping the libyuv static library into another + # static library with 'pic' set to true. + libyuv_static = static_library('libyuv-static', + dependencies : libyuv.dependency('yuv'), + pic : true, + install : false) + libyuv_include = libyuv.include_directories('yuv') + libyuv_dep = declare_dependency(link_with : libyuv_static, + include_directories : libyuv_include) endif # libcamera must be built first as a dependency to the other components. diff --git a/subprojects/libyuv.wrap b/subprojects/libyuv.wrap index 3417e73f376c..c85b96b77345 100644 --- a/subprojects/libyuv.wrap +++ b/subprojects/libyuv.wrap @@ -3,4 +3,4 @@ [wrap-git] directory = libyuv url = https://chromium.googlesource.com/libyuv/libyuv.git -revision = 93b1b332cd60b56ab90aea14182755e379c28a80 +revision = 2b4453d46faebcad72d744d763a4e3b1e97d338d
The libyuv wrap uses a libyuv commit between versions 1770 and 1772, more than 5 years old. This specifies CMake 2.8 as the minimum required version. The most recent CMake has dropped compatibility with versions older than 3.5 in CMake 4.0. CMake 3.5 was released in 2016, and all distributions we care about ship more recent versions. With CMake 4.0 or newer, shipped for instance by Gentoo, compilation of the libyuv wrap fails. Update the wrap to version 1921, which is the latest numbered version (libyuv doesn't tag release by increases a version number in the README.chromium file). This requires CMake 3.16, released 6 years ago, and available in at least the last two LTS of major distributions. This update introduces an issue: due to a bug in Meson (see https://github.com/mesonbuild/meson/issues/10764), PIC handling is broken when a CMake project wraps a static library into another static library that has no additional source file. Work around it by wrapping the libyuv static library again, manually setting 'pic' to true. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- Changes since v1: - Update to version 1921 --- src/meson.build | 16 +++++++++++++++- subprojects/libyuv.wrap | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) base-commit: 06aee9135f9fd135a8c0bc0b55971b29f7617d02 -- Regards, Laurent Pinchart