[Buildroot] [PATCH 1/1] package/libcamera: disable compliance tool

Peter Seiderer ps.report at gmx.net
Fri Oct 22 19:10:54 UTC 2021


Hello *,

On Thu, 21 Oct 2021 21:04:00 +0200, Peter Seiderer <ps.report at gmx.net> wrote:

> Hello Fabrice, Kieran,
> 
> On Thu, 21 Oct 2021 20:05:18 +0200, Peter Seiderer <ps.report at gmx.net> wrote:
> 
> > Hello Fabrice,
> > 
> > On Thu, 21 Oct 2021 19:05:38 +0200, Fabrice Fontaine <fontaine.fabrice at gmail.com> wrote:
> >   
> > > Le jeu. 21 oct. 2021 à 18:30, Kieran Bingham
> > > <kieran.bingham at ideasonboard.com> a écrit :    
> > > >
> > > > Quoting Fabrice Fontaine (2021-10-21 17:05:51)      
> > > > > Hi Kieran,
> > > > >
> > > > > Le jeu. 21 oct. 2021 à 11:22, Kieran Bingham
> > > > > <kieran.bingham at ideasonboard.com> a écrit :      
> > > > > >
> > > > > > Hi Fabrice,
> > > > > >
> > > > > > Quoting Fabrice Fontaine (2021-10-20 20:04:23)      
> > > > > > > Disable compliance tool to fix the following build failure
> > > > > > > raised since commit e1d37ab0a7b2b8735e69c070519978d2898d2e79 and
> > > > > > > https://git.linuxtv.org/libcamera.git/commit/?id=02bc1108578e8b8eb68fa7d9ae3eeea558723931:
> > > > > > >
> > > > > > > /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-1/output-1/host/lib/gcc/arm-buildroot-linux-uclibcgnueabi/10.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find -lgtest  
> 
> The failing configuration has set 'BR2_ENABLE_RUNTIME_DEBUG=y' and gtest installs
> its library as libgtestd.a (instead of libgtest.a as requested by gtest.pc), can
> be fixed by:
> 
> --- a/package/gtest/gtest.mk
> +++ b/package/gtest/gtest.mk
> @@ -46,6 +46,10 @@ ifeq ($(BR2_STATIC_LIBS),)
>  GTEST_CONF_OPTS += -DCMAKE_POSITION_INDEPENDENT_CODE=ON
>  endif
>  
> +# set build type always to Release, otherwise the library is named
> +# libgtestd.a and not found by dependent packages using gtest.pc
> +# requuesting plain libgtest.a
> +GTEST_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
>  ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
>  GTEST_CONF_OPTS += -DBUILD_GMOCK=ON
>  else
> 
> Alternative would be to fix the generation of gtest.pc...

Alternative implemented for package/gtest and added an lc-compliance
option for package/libcamera (to gain an gtest consumer in buildroot),
see [1] and [2]...

Regards,
Peter

[1] https://patchwork.ozlabs.org/project/buildroot/patch/20211022190702.7782-1-ps.report@gmx.net/
[2] https://patchwork.ozlabs.org/project/buildroot/patch/20211022190702.7782-2-ps.report@gmx.net/

> 
> Regards,
> Peter
> 
> > > > > > >
> > > > > > > Fixes:
> > > > > > >  - http://autobuild.buildroot.org/results/e1bb8aa1de310f3d27b74ec7d8748d170ad444e2
> > > > > > >      
> > > > > >
> > > > > > Any idea why we're failing to find gtest?      
> > > > > Nope, I didn't take time to find out why this is failing as I think
> > > > > that lc-compliance is just not needed in the context of buildroot (as
> > > > > gtest is not installed on target).      
> > > > > >
> > > > > > Our meson.build for src/lc-compliance contains the following:
> > > > > >
> > > > > > """
> > > > > > # SPDX-License-Identifier: CC0-1.0
> > > > > >
> > > > > > libevent = dependency('libevent_pthreads', required : get_option('lc-compliance'))
> > > > > > libgtest = dependency('gtest', required : get_option('lc-compliance'))
> > > > > >
> > > > > > if not (libevent.found() and libgtest.found())
> > > > > >     lc_compliance_enabled = false
> > > > > >     subdir_done()
> > > > > > endif
> > > > > >
> > > > > > lc_compliance_enabled = true
> > > > > > """
> > > > > >
> > > > > > Which implies that libgtest was found during the configuration phase,
> > > > > > but not during the linking phase....
> > > > > >
> > > > > > Is libgtest built as part of this build configuration? If it is - I'd
> > > > > > expect lc-compliance to get built against it. If not - then it would
> > > > > > automatically be disabled by our build...      
> > > > > Yes, it is built and found by meson otherwise lc-compliance won't be
> > > > > built but for an unknown reason, the link step fails.      
> > > >
> > > > You've mentioned above that gtest won't be installed on the target... So
> > > > .. I would expect that means it isn't in the target sysroot, and can't
> > > > be linked against.
> > > >
> > > > So it seems that for some reason meson finds a host package instead of a
> > > > target package?      
> > > gtest is installed on staging (but not on target):
> > > GTEST_INSTALL_STAGING = YES
> > > GTEST_INSTALL_TARGET = NO
> > > 
> > > It should be noted that no packages are using gtest in buldroot.
> > > IMHO, we should remove it to avoid unexpected build failures and
> > > improve build reproducibility as I assume that libcamera is not the
> > > only package that has a "hidden" gtest dependency.    
> > 
> > But this is normal behavior for a (maybe static) library to be installed
> > to staging...., and the failure is a compile time one and not a
> > runtime one? If you want reproducibility you have to add a optional
> > dependency on gtest (and fix the link failure) or (as you suggested)
> > disable the need/check for gtest in the failing package...
> > 
> > I know more than one custom package using gtest (optional on the
> > target hardware for runtime tests)...
> > 
> > Regards,
> > Peter
> >   
> > > >> Do we have a way to differentiate these in buildroot?      
> > > >
> > > > I'm not sure if there's some buildroot wizardry that would make
> > > > libcamera's configure phase see only the packages that are installed on
> > > > the target when being built, but if buildroot doesn't support installing
> > > > gtest at all - then indeed there isn't any point supporting
> > > > lc-compliance which requires it.
> > > >
> > > >      
> > > > > >
> > > > > >      
> > > > > > > Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
> > > > > > > ---
> > > > > > >  package/libcamera/libcamera.mk | 1 +
> > > > > > >  1 file changed, 1 insertion(+)
> > > > > > >
> > > > > > > diff --git a/package/libcamera/libcamera.mk b/package/libcamera/libcamera.mk
> > > > > > > index 8ab95fb42a..638c9ac553 100644
> > > > > > > --- a/package/libcamera/libcamera.mk
> > > > > > > +++ b/package/libcamera/libcamera.mk
> > > > > > > @@ -17,6 +17,7 @@ LIBCAMERA_DEPENDENCIES = \
> > > > > > >  LIBCAMERA_CONF_OPTS = \
> > > > > > >         -Dandroid=disabled \
> > > > > > >         -Ddocumentation=disabled \
> > > > > > > +       -Dlc-compliance=disabled \
> > > > > > >         -Dtest=false \
> > > > > > >         -Dwerror=false
> > > > > > >  LIBCAMERA_INSTALL_STAGING = YES
> > > > > > > --
> > > > > > > 2.33.0
> > > > > > >      
> > > > > Best Regards,
> > > > >
> > > > > Fabrice      
> > > Best Regards,
> > > 
> > > Fabrice
> > > _______________________________________________
> > > buildroot mailing list
> > > buildroot at buildroot.org
> > > https://lists.buildroot.org/mailman/listinfo/buildroot    
> > 
> > _______________________________________________
> > buildroot mailing list
> > buildroot at buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot  
> 
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot



More information about the buildroot mailing list