Message ID | 20251019140738.30325-1-laurent.pinchart@ideasonboard.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
Hi Laurent, Quoting Laurent Pinchart (2025-10-19 16:07:38) > 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 1908, which is the oldest that requires CMake > 3.5 or newer. This introduces another 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> > --- > 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) Impressive for how long these bugs can hide given that -fPIC has been around for more than a day... Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> > 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..70039b705925 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 = 23d416d6f32539bc7e44afa2bec6ce0128dbed0b > -- > Regards, > > Laurent Pinchart >
Quoting Laurent Pinchart (2025-10-19 15:07:38) > 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 1908, which is the oldest that requires CMake > 3.5 or newer. This introduces another issue: due to a bug in Meson (see What's the pin on cmake 3.5 ? > 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. Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > 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..70039b705925 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 = 23d416d6f32539bc7e44afa2bec6ce0128dbed0b > -- > Regards, > > Laurent Pinchart >
Quoting Kieran Bingham (2025-10-20 10:47:27) > Quoting Laurent Pinchart (2025-10-19 15:07:38) > > 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 1908, which is the oldest that requires CMake > > 3.5 or newer. This introduces another issue: due to a bug in Meson (see > > What's the pin on cmake 3.5 ? Sorry it was right there above - but I glossed over it on the first pass down then read upwards on the second pass ;-) -- Kieran > > > 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. > > Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > --- > > 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..70039b705925 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 = 23d416d6f32539bc7e44afa2bec6ce0128dbed0b > > -- > > Regards, > > > > Laurent Pinchart > >
Hi 2025. 10. 19. 16:07 keltezéssel, Laurent Pinchart írta: > 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 1908, which is the oldest that requires CMake > 3.5 or newer. This introduces another issue: due to a bug in Meson (see Any reason not to update to the latest version that has acceptable dependencies for libcamera? Regards, Barnabás Pőcze > 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> > --- > 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..70039b705925 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 = 23d416d6f32539bc7e44afa2bec6ce0128dbed0b > -- > Regards, > > Laurent Pinchart >
On Mon, Oct 20, 2025 at 11:48:41AM +0200, Barnabás Pőcze wrote: > 2025. 10. 19. 16:07 keltezéssel, Laurent Pinchart írta: > > 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 1908, which is the oldest that requires CMake > > 3.5 or newer. This introduces another issue: due to a bug in Meson (see > > Any reason not to update to the latest version that has acceptable > dependencies for libcamera? Not really. The oldest CMake shipped by Debian or Ubuntu is 3.18 in Debian Bullseye. The latest libyuv version (1921) requires CMake 3.16or newer. I'll update to that. > > 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> > > --- > > 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..70039b705925 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 = 23d416d6f32539bc7e44afa2bec6ce0128dbed0b
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..70039b705925 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 = 23d416d6f32539bc7e44afa2bec6ce0128dbed0b
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 1908, which is the oldest that requires CMake 3.5 or newer. This introduces another 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> --- src/meson.build | 16 +++++++++++++++- subprojects/libyuv.wrap | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-)