[v1,5/7] meson: Use dependency object when checking for headers
diff mbox series

Message ID 20260129164032.1380169-5-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • [v1,1/7] meson: Drop unnecessary egl, gles feature defines
Related show

Commit Message

Barnabás Pőcze Jan. 29, 2026, 4:40 p.m. UTC
A dependency might very well have custom include directories,
so use it when checking for the header file.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 src/libcamera/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Milan Zamazal Jan. 30, 2026, 1:25 p.m. UTC | #1
Barnabás Pőcze <barnabas.pocze@ideasonboard.com> writes:

> A dependency might very well have custom include directories,
> so use it when checking for the header file.
>
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>

Reviewed-by: Milan Zamazal <mzamazal@redhat.com>

> ---
>  src/libcamera/meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> index 06ed34101..72b7bf02d 100644
> --- a/src/libcamera/meson.build
> +++ b/src/libcamera/meson.build
> @@ -70,9 +70,9 @@ libcamera_deps = []
>  libatomic = cc.find_library('atomic', required : false)
>  libthreads = dependency('threads')
>  
> -mesa_works = cc.check_header('EGL/egl.h', required: false)
>  libegl = dependency('egl', required : false)
>  libglesv2 = dependency('glesv2', required : false)
> +mesa_works = cc.check_header('EGL/egl.h', required : false, dependencies : libegl)
>  
>  subdir('base')
>  subdir('converter')
Laurent Pinchart Jan. 30, 2026, 2 p.m. UTC | #2
On Thu, Jan 29, 2026 at 05:40:30PM +0100, Barnabás Pőcze wrote:
> A dependency might very well have custom include directories,
> so use it when checking for the header file.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/libcamera/meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> index 06ed34101..72b7bf02d 100644
> --- a/src/libcamera/meson.build
> +++ b/src/libcamera/meson.build
> @@ -70,9 +70,9 @@ libcamera_deps = []
>  libatomic = cc.find_library('atomic', required : false)
>  libthreads = dependency('threads')
>  
> -mesa_works = cc.check_header('EGL/egl.h', required: false)
>  libegl = dependency('egl', required : false)
>  libglesv2 = dependency('glesv2', required : false)
> +mesa_works = cc.check_header('EGL/egl.h', required : false, dependencies : libegl)

Unrelated to this patch, I'd like a comment to explain why this is
needed. There's no information in the git history, and I'd like to
remove this check in the future when/if it won't be needed anymore.

Bryan, Hans, could you shed some light on this ?

>  
>  subdir('base')
>  subdir('converter')
Barnabás Pőcze Jan. 30, 2026, 2:02 p.m. UTC | #3
2026. 01. 30. 15:00 keltezéssel, Laurent Pinchart írta:
> On Thu, Jan 29, 2026 at 05:40:30PM +0100, Barnabás Pőcze wrote:
>> A dependency might very well have custom include directories,
>> so use it when checking for the header file.
>>
>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> ---
>>   src/libcamera/meson.build | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
>> index 06ed34101..72b7bf02d 100644
>> --- a/src/libcamera/meson.build
>> +++ b/src/libcamera/meson.build
>> @@ -70,9 +70,9 @@ libcamera_deps = []
>>   libatomic = cc.find_library('atomic', required : false)
>>   libthreads = dependency('threads')
>>   
>> -mesa_works = cc.check_header('EGL/egl.h', required: false)
>>   libegl = dependency('egl', required : false)
>>   libglesv2 = dependency('glesv2', required : false)
>> +mesa_works = cc.check_header('EGL/egl.h', required : false, dependencies : libegl)
> 
> Unrelated to this patch, I'd like a comment to explain why this is
> needed. There's no information in the git history, and I'd like to
> remove this check in the future when/if it won't be needed anymore.
> 
> Bryan, Hans, could you shed some light on this ?

I have asked about this: https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056096.html
but haven't investigated in depth.


> 
>>   
>>   subdir('base')
>>   subdir('converter')
>
Bryan O'Donoghue Jan. 30, 2026, 4:48 p.m. UTC | #4
On 30/01/2026 14:00, Laurent Pinchart wrote:
> On Thu, Jan 29, 2026 at 05:40:30PM +0100, Barnabás Pőcze wrote:
>> A dependency might very well have custom include directories,
>> so use it when checking for the header file.
>>
>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> ---
>>   src/libcamera/meson.build | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
>> index 06ed34101..72b7bf02d 100644
>> --- a/src/libcamera/meson.build
>> +++ b/src/libcamera/meson.build
>> @@ -70,9 +70,9 @@ libcamera_deps = []
>>   libatomic = cc.find_library('atomic', required : false)
>>   libthreads = dependency('threads')
>>   
>> -mesa_works = cc.check_header('EGL/egl.h', required: false)
>>   libegl = dependency('egl', required : false)
>>   libglesv2 = dependency('glesv2', required : false)
>> +mesa_works = cc.check_header('EGL/egl.h', required : false, dependencies : libegl)
> 
> Unrelated to this patch, I'd like a comment to explain why this is
> needed. There's no information in the git history, and I'd like to
> remove this check in the future when/if it won't be needed anymore.
> 
> Bryan, Hans, could you shed some light on this ?
Building for chromeos in libcamera CI.

Checking for the libs on that platform isn't enough, you need to check 
for the header too.

---
bod
Bryan O'Donoghue Jan. 30, 2026, 4:52 p.m. UTC | #5
On 30/01/2026 14:02, Barnabás Pőcze wrote:
> 2026. 01. 30. 15:00 keltezéssel, Laurent Pinchart írta:
>> On Thu, Jan 29, 2026 at 05:40:30PM +0100, Barnabás Pőcze wrote:
>>> A dependency might very well have custom include directories,
>>> so use it when checking for the header file.
>>>
>>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
>>
>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>
>>> ---
>>>   src/libcamera/meson.build | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
>>> index 06ed34101..72b7bf02d 100644
>>> --- a/src/libcamera/meson.build
>>> +++ b/src/libcamera/meson.build
>>> @@ -70,9 +70,9 @@ libcamera_deps = []
>>>   libatomic = cc.find_library('atomic', required : false)
>>>   libthreads = dependency('threads')
>>> -mesa_works = cc.check_header('EGL/egl.h', required: false)
>>>   libegl = dependency('egl', required : false)
>>>   libglesv2 = dependency('glesv2', required : false)
>>> +mesa_works = cc.check_header('EGL/egl.h', required : false, 
>>> dependencies : libegl)
>>
>> Unrelated to this patch, I'd like a comment to explain why this is
>> needed. There's no information in the git history, and I'd like to
>> remove this check in the future when/if it won't be needed anymore.
>>
>> Bryan, Hans, could you shed some light on this ?
> 
> I have asked about this: https://lists.libcamera.org/pipermail/ 
> libcamera-devel/2026-January/056096.html
> but haven't investigated in depth.
Yeah "depends" does what it is supposed to do on all of the other build 
targets but for chromeos not so much.

The most expedient test was for the headers perhaps there's a better 
solution. depends on its own won't cover though.

I guess whatever way chromeos - still gentoo/portage ? - packages this 
the headers and the libs don't come together or - come to think of it 
now - more likely the headers aren't in the include path.

I'd have to have a look at the chromeos - docker ? - image to understand 
if the headers are just not in the default include path which as i've 
typed this email, I think is likely.

i.e. you'd expect to get the libs and the headers in one package - so 
likely depends() is correct but INCLUDES somehow is not....

Or perhaps the heades really are missing, I can't easily tell. If one of 
you can have a look I'm happy to make a patch or even if you can show me 
how to look...

---
bod
Laurent Pinchart Feb. 5, 2026, 2:58 p.m. UTC | #6
On Fri, Jan 30, 2026 at 04:52:41PM +0000, Bryan O'Donoghue wrote:
> On 30/01/2026 14:02, Barnabás Pőcze wrote:
> > 2026. 01. 30. 15:00 keltezéssel, Laurent Pinchart írta:
> >> On Thu, Jan 29, 2026 at 05:40:30PM +0100, Barnabás Pőcze wrote:
> >>> A dependency might very well have custom include directories,
> >>> so use it when checking for the header file.
> >>>
> >>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> >>
> >> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >>
> >>> ---
> >>>   src/libcamera/meson.build | 2 +-
> >>>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> >>> index 06ed34101..72b7bf02d 100644
> >>> --- a/src/libcamera/meson.build
> >>> +++ b/src/libcamera/meson.build
> >>> @@ -70,9 +70,9 @@ libcamera_deps = []
> >>>   libatomic = cc.find_library('atomic', required : false)
> >>>   libthreads = dependency('threads')
> >>> -mesa_works = cc.check_header('EGL/egl.h', required: false)
> >>>   libegl = dependency('egl', required : false)
> >>>   libglesv2 = dependency('glesv2', required : false)
> >>> +mesa_works = cc.check_header('EGL/egl.h', required : false, 
> >>> dependencies : libegl)
> >>
> >> Unrelated to this patch, I'd like a comment to explain why this is
> >> needed. There's no information in the git history, and I'd like to
> >> remove this check in the future when/if it won't be needed anymore.
> >>
> >> Bryan, Hans, could you shed some light on this ?
> > 
> > I have asked about this: https://lists.libcamera.org/pipermail/ 
> > libcamera-devel/2026-January/056096.html
> > but haven't investigated in depth.
> 
> Yeah "depends" does what it is supposed to do on all of the other build 
> targets but for chromeos not so much.
> 
> The most expedient test was for the headers perhaps there's a better 
> solution. depends on its own won't cover though.
> 
> I guess whatever way chromeos - still gentoo/portage ? - packages this 
> the headers and the libs don't come together or - come to think of it 
> now - more likely the headers aren't in the include path.
> 
> I'd have to have a look at the chromeos - docker ? - image to understand 
> if the headers are just not in the default include path which as i've 
> typed this email, I think is likely.
> 
> i.e. you'd expect to get the libs and the headers in one package - so 
> likely depends() is correct but INCLUDES somehow is not....
> 
> Or perhaps the heades really are missing, I can't easily tell. If one of 
> you can have a look I'm happy to make a patch or even if you can show me 
> how to look...

I checked, and as far as I can tell, they are indeed missing.

This is probably fixable, by adding media-libs/libglvnd to the container
image (possibly by setting the libglvnd USE flag for the
media-libs/mesa-iris package). I'm giving it a try, now that I have a
faster machine with plenty of empty disk space :-)
Laurent Pinchart Feb. 5, 2026, 6:13 p.m. UTC | #7
On Thu, Feb 05, 2026 at 04:58:51PM +0200, Laurent Pinchart wrote:
> On Fri, Jan 30, 2026 at 04:52:41PM +0000, Bryan O'Donoghue wrote:
> > On 30/01/2026 14:02, Barnabás Pőcze wrote:
> > > 2026. 01. 30. 15:00 keltezéssel, Laurent Pinchart írta:
> > >> On Thu, Jan 29, 2026 at 05:40:30PM +0100, Barnabás Pőcze wrote:
> > >>> A dependency might very well have custom include directories,
> > >>> so use it when checking for the header file.
> > >>>
> > >>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> > >>
> > >> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > >>
> > >>> ---
> > >>>   src/libcamera/meson.build | 2 +-
> > >>>   1 file changed, 1 insertion(+), 1 deletion(-)
> > >>>
> > >>> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> > >>> index 06ed34101..72b7bf02d 100644
> > >>> --- a/src/libcamera/meson.build
> > >>> +++ b/src/libcamera/meson.build
> > >>> @@ -70,9 +70,9 @@ libcamera_deps = []
> > >>>   libatomic = cc.find_library('atomic', required : false)
> > >>>   libthreads = dependency('threads')
> > >>> -mesa_works = cc.check_header('EGL/egl.h', required: false)
> > >>>   libegl = dependency('egl', required : false)
> > >>>   libglesv2 = dependency('glesv2', required : false)
> > >>> +mesa_works = cc.check_header('EGL/egl.h', required : false, 
> > >>> dependencies : libegl)
> > >>
> > >> Unrelated to this patch, I'd like a comment to explain why this is
> > >> needed. There's no information in the git history, and I'd like to
> > >> remove this check in the future when/if it won't be needed anymore.
> > >>
> > >> Bryan, Hans, could you shed some light on this ?
> > > 
> > > I have asked about this: https://lists.libcamera.org/pipermail/ 
> > > libcamera-devel/2026-January/056096.html
> > > but haven't investigated in depth.
> > 
> > Yeah "depends" does what it is supposed to do on all of the other build 
> > targets but for chromeos not so much.
> > 
> > The most expedient test was for the headers perhaps there's a better 
> > solution. depends on its own won't cover though.
> > 
> > I guess whatever way chromeos - still gentoo/portage ? - packages this 
> > the headers and the libs don't come together or - come to think of it 
> > now - more likely the headers aren't in the include path.
> > 
> > I'd have to have a look at the chromeos - docker ? - image to understand 
> > if the headers are just not in the default include path which as i've 
> > typed this email, I think is likely.
> > 
> > i.e. you'd expect to get the libs and the headers in one package - so 
> > likely depends() is correct but INCLUDES somehow is not....
> > 
> > Or perhaps the heades really are missing, I can't easily tell. If one of 
> > you can have a look I'm happy to make a patch or even if you can show me 
> > how to look...
> 
> I checked, and as far as I can tell, they are indeed missing.
> 
> This is probably fixable, by adding media-libs/libglvnd to the container
> image (possibly by setting the libglvnd USE flag for the
> media-libs/mesa-iris package). I'm giving it a try, now that I have a
> faster machine with plenty of empty disk space :-)

I enabled the libglvnd USE flag for the media-libs/mesa-iris package, but that
didn't help. It installed the media-libs/libglvnd package, which
provided more GL-related headers, but not the EGL headers. This is
because the ebuild ([1]) explicitly deletes the headers in its install
phase:

multilib_src_install_all() {
	# Remove redundant GLES headers
	rm -f "${D}"/usr/include/{EGL,GLES2,GLES3,KHR}/*.h || die "Removing GLES headers failed."
}

git blame informs me that ([2])

  When mesa is built with glvnd=true, it does not install gl headers.
  So libglvnd must install them instead, while avoiding the same
  redundant GLES headers that mesa ebuilds avoid.

The mesa-iris ebuild contains

src_install() {
	tools_to_cleanup=$(get_tools_to_cleanup)

	meson_src_install

	rm -v -rf "${ED}/usr/include"

	# Clean up the unneeded tools if any.
	for tool in ${tools_to_cleanup}; do
		rm -v -rf "${ED}/usr/bin/${tool}"
	done
}

and git blame doesn't explain why. It may be a bug in Chrome OS.

As we don't have a Soraka connected to CI at the moment, I'll disable
the cros build job. We can try to fix the issue when we reenable it
later.

[1] https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/refs/heads/release-R135-16209.B/media-libs/libglvnd/libglvnd-1.7.0.ebuild
[2] https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/f72e921b72ed881a504ff5bb79cdd0fbd4612bff%5E%21/media-libs/libglvnd/libglvnd-1.3.3.ebuild

Patch
diff mbox series

diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
index 06ed34101..72b7bf02d 100644
--- a/src/libcamera/meson.build
+++ b/src/libcamera/meson.build
@@ -70,9 +70,9 @@  libcamera_deps = []
 libatomic = cc.find_library('atomic', required : false)
 libthreads = dependency('threads')
 
-mesa_works = cc.check_header('EGL/egl.h', required: false)
 libegl = dependency('egl', required : false)
 libglesv2 = dependency('glesv2', required : false)
+mesa_works = cc.check_header('EGL/egl.h', required : false, dependencies : libegl)
 
 subdir('base')
 subdir('converter')