[RFC,v1,1/5] gstreamer: Add `-Wno-volatile` for GCC
diff mbox series

Message ID 20260107193607.2168539-2-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • C++20 migration
Related show

Commit Message

Barnabás Pőcze Jan. 7, 2026, 7:36 p.m. UTC
Older versions of glib may use `volatile` qualified variables, triggering
the warning in C++20. So suppress it.

Link: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 src/gstreamer/meson.build | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Laurent Pinchart Jan. 7, 2026, 8:25 p.m. UTC | #1
On Wed, Jan 07, 2026 at 08:36:03PM +0100, Barnabás Pőcze wrote:
> Older versions of glib may use `volatile` qualified variables, triggering
> the warning in C++20. So suppress it.
> 
> Link: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> ---
>  src/gstreamer/meson.build | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build
> index fd83e073d..602f978e8 100644
> --- a/src/gstreamer/meson.build
> +++ b/src/gstreamer/meson.build
> @@ -50,6 +50,13 @@ if cc.get_id() == 'clang' and glib_dep.version().version_compare('<2.63.0')
>      libcamera_gst_cpp_args += ['-Wno-unused-function']
>  endif
>  
> +# In C++20 many operations involving the `volatile` qualifier became deprecated.
> +# glib however made use of `volatile` in certain macros that would trigger
> +# this warning. See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719.
> +if cc.get_id() == 'gcc' and glib_dep.version().version_compare('<2.67.1')

glib 2.67.1 is old. We still support due to CI on Debian Bullseye, which
is the current Debian LTS release, supported until end of August this
year. Will we then be able to drop this, or are there other users of
glib <2.67.1 ?

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

> +    libcamera_gst_cpp_args += ['-Wno-volatile']
> +endif
> +
>  libcamera_gst = shared_library('gstlibcamera',
>      libcamera_gst_sources,
>      cpp_args : libcamera_gst_cpp_args,
Barnabás Pőcze Jan. 8, 2026, 8:47 a.m. UTC | #2
2026. 01. 07. 21:25 keltezéssel, Laurent Pinchart írta:
> On Wed, Jan 07, 2026 at 08:36:03PM +0100, Barnabás Pőcze wrote:
>> Older versions of glib may use `volatile` qualified variables, triggering
>> the warning in C++20. So suppress it.
>>
>> Link: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719
>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
>> ---
>>   src/gstreamer/meson.build | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build
>> index fd83e073d..602f978e8 100644
>> --- a/src/gstreamer/meson.build
>> +++ b/src/gstreamer/meson.build
>> @@ -50,6 +50,13 @@ if cc.get_id() == 'clang' and glib_dep.version().version_compare('<2.63.0')
>>       libcamera_gst_cpp_args += ['-Wno-unused-function']
>>   endif
>>   
>> +# In C++20 many operations involving the `volatile` qualifier became deprecated.
>> +# glib however made use of `volatile` in certain macros that would trigger
>> +# this warning. See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719.
>> +if cc.get_id() == 'gcc' and glib_dep.version().version_compare('<2.67.1')
> 
> glib 2.67.1 is old. We still support due to CI on Debian Bullseye, which
> is the current Debian LTS release, supported until end of August this
> year. Will we then be able to drop this, or are there other users of
> glib <2.67.1 ?

How do you mean? Currently libcamera states that it can work with any version
of `glib-2.0`. So I imagine after debian bullseye ceases to be supported, the
version requirement, if needed, can be increased, and these workarounds removed.


> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> +    libcamera_gst_cpp_args += ['-Wno-volatile']
>> +endif
>> +
>>   libcamera_gst = shared_library('gstlibcamera',
>>       libcamera_gst_sources,
>>       cpp_args : libcamera_gst_cpp_args,
>
Laurent Pinchart Jan. 8, 2026, 9:15 a.m. UTC | #3
On Thu, Jan 08, 2026 at 09:47:01AM +0100, Barnabás Pőcze wrote:
> 2026. 01. 07. 21:25 keltezéssel, Laurent Pinchart írta:
> > On Wed, Jan 07, 2026 at 08:36:03PM +0100, Barnabás Pőcze wrote:
> >> Older versions of glib may use `volatile` qualified variables, triggering
> >> the warning in C++20. So suppress it.
> >>
> >> Link: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719
> >> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> >> ---
> >>   src/gstreamer/meson.build | 7 +++++++
> >>   1 file changed, 7 insertions(+)
> >>
> >> diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build
> >> index fd83e073d..602f978e8 100644
> >> --- a/src/gstreamer/meson.build
> >> +++ b/src/gstreamer/meson.build
> >> @@ -50,6 +50,13 @@ if cc.get_id() == 'clang' and glib_dep.version().version_compare('<2.63.0')
> >>       libcamera_gst_cpp_args += ['-Wno-unused-function']
> >>   endif
> >>   
> >> +# In C++20 many operations involving the `volatile` qualifier became deprecated.
> >> +# glib however made use of `volatile` in certain macros that would trigger
> >> +# this warning. See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719.
> >> +if cc.get_id() == 'gcc' and glib_dep.version().version_compare('<2.67.1')
> > 
> > glib 2.67.1 is old. We still support due to CI on Debian Bullseye, which
> > is the current Debian LTS release, supported until end of August this
> > year. Will we then be able to drop this, or are there other users of
> > glib <2.67.1 ?
> 
> How do you mean? Currently libcamera states that it can work with any version
> of `glib-2.0`. So I imagine after debian bullseye ceases to be supported, the
> version requirement, if needed, can be increased, and these workarounds removed.

I meant to ask if there's any other reason than Debian Bullseye to keep
supporting glib2 <2.67.1.

> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > 
> >> +    libcamera_gst_cpp_args += ['-Wno-volatile']
> >> +endif
> >> +
> >>   libcamera_gst = shared_library('gstlibcamera',
> >>       libcamera_gst_sources,
> >>       cpp_args : libcamera_gst_cpp_args,
Barnabás Pőcze Jan. 8, 2026, 9:37 a.m. UTC | #4
2026. 01. 08. 10:15 keltezéssel, Laurent Pinchart írta:
> On Thu, Jan 08, 2026 at 09:47:01AM +0100, Barnabás Pőcze wrote:
>> 2026. 01. 07. 21:25 keltezéssel, Laurent Pinchart írta:
>>> On Wed, Jan 07, 2026 at 08:36:03PM +0100, Barnabás Pőcze wrote:
>>>> Older versions of glib may use `volatile` qualified variables, triggering
>>>> the warning in C++20. So suppress it.
>>>>
>>>> Link: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719
>>>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
>>>> ---
>>>>    src/gstreamer/meson.build | 7 +++++++
>>>>    1 file changed, 7 insertions(+)
>>>>
>>>> diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build
>>>> index fd83e073d..602f978e8 100644
>>>> --- a/src/gstreamer/meson.build
>>>> +++ b/src/gstreamer/meson.build
>>>> @@ -50,6 +50,13 @@ if cc.get_id() == 'clang' and glib_dep.version().version_compare('<2.63.0')
>>>>        libcamera_gst_cpp_args += ['-Wno-unused-function']
>>>>    endif
>>>>    
>>>> +# In C++20 many operations involving the `volatile` qualifier became deprecated.
>>>> +# glib however made use of `volatile` in certain macros that would trigger
>>>> +# this warning. See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719.
>>>> +if cc.get_id() == 'gcc' and glib_dep.version().version_compare('<2.67.1')
>>>
>>> glib 2.67.1 is old. We still support due to CI on Debian Bullseye, which
>>> is the current Debian LTS release, supported until end of August this
>>> year. Will we then be able to drop this, or are there other users of
>>> glib <2.67.1 ?
>>
>> How do you mean? Currently libcamera states that it can work with any version
>> of `glib-2.0`. So I imagine after debian bullseye ceases to be supported, the
>> version requirement, if needed, can be increased, and these workarounds removed.
> 
> I meant to ask if there's any other reason than Debian Bullseye to keep
> supporting glib2 <2.67.1.

Based on https://repology.org/project/glib/versions there is ubuntu 20.04, which has 2.64.6,
but not sure how relevant that is since there is only ESM for that version.
So I cannot see anything that needs it.


> 
>>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>>
>>>> +    libcamera_gst_cpp_args += ['-Wno-volatile']
>>>> +endif
>>>> +
>>>>    libcamera_gst = shared_library('gstlibcamera',
>>>>        libcamera_gst_sources,
>>>>        cpp_args : libcamera_gst_cpp_args,
>
Nicolas Dufresne Jan. 9, 2026, 3:42 p.m. UTC | #5
Hi,

Le jeudi 08 janvier 2026 à 10:37 +0100, Barnabás Pőcze a écrit :
> > > How do you mean? Currently libcamera states that it can work with any version
> > > of `glib-2.0`. So I imagine after debian bullseye ceases to be supported, the
> > > version requirement, if needed, can be increased, and these workarounds removed.
> > 
> > I meant to ask if there's any other reason than Debian Bullseye to keep
> > supporting glib2 <2.67.1.
> 
> Based on https://repology.org/project/glib/versions there is ubuntu 20.04, which has 2.64.6,
> but not sure how relevant that is since there is only ESM for that version.
> So I cannot see anything that needs it.

Just a note that we inherit glib requirement from the GStreamer version we
depends on. Currently 1.14, so 2.40 iirc.

But honestly, these two projects at these version have hundreds of known
security vulnerability, so we are not really giving anyone a good service by
allowing that. I've said that in the past, but we should really move up our
requirement, and just not support GStreamer on older OS that we still want
libcamera to be supported on.

Nicolas

Patch
diff mbox series

diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build
index fd83e073d..602f978e8 100644
--- a/src/gstreamer/meson.build
+++ b/src/gstreamer/meson.build
@@ -50,6 +50,13 @@  if cc.get_id() == 'clang' and glib_dep.version().version_compare('<2.63.0')
     libcamera_gst_cpp_args += ['-Wno-unused-function']
 endif
 
+# In C++20 many operations involving the `volatile` qualifier became deprecated.
+# glib however made use of `volatile` in certain macros that would trigger
+# this warning. See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719.
+if cc.get_id() == 'gcc' and glib_dep.version().version_compare('<2.67.1')
+    libcamera_gst_cpp_args += ['-Wno-volatile']
+endif
+
 libcamera_gst = shared_library('gstlibcamera',
     libcamera_gst_sources,
     cpp_args : libcamera_gst_cpp_args,