[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
Naushir Patuck Jan. 12, 2026, 9:48 a.m. UTC | #6
Hi Barnabás,

On Wed, 7 Jan 2026 at 19:36, Barnabás Pőcze
<barnabas.pocze@ideasonboard.com> 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>

I've had identical patches in my tree for C++ 20 support, so

Reviewed-by: Naushir Patuck <naush@raspberrypi.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')
> +    libcamera_gst_cpp_args += ['-Wno-volatile']
> +endif
> +
>  libcamera_gst = shared_library('gstlibcamera',
>      libcamera_gst_sources,
>      cpp_args : libcamera_gst_cpp_args,
> --
> 2.52.0
>
Laurent Pinchart Jan. 12, 2026, 10 a.m. UTC | #7
On Fri, Jan 09, 2026 at 10:42:17AM -0500, Nicolas Dufresne wrote:
> 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.

What would be the minimum GStreamer version you would recommend ?
Nicolas Dufresne Jan. 12, 2026, 1:49 p.m. UTC | #8
Hi,

Le lundi 12 janvier 2026 à 12:00 +0200, Laurent Pinchart a écrit :
> On Fri, Jan 09, 2026 at 10:42:17AM -0500, Nicolas Dufresne wrote:
> > 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.
> 
> What would be the minimum GStreamer version you would recommend ?

My personal preference is to go 2y back for dev track (which is about 2 stable
back in GStreamer), but that does not align so well with libcamera so far, since
it does not have stable release in parallel to dev. At the moment it would mean
1.24 (which has minimum of GLib 2.64). So we'd still need this workaround until
the next release (which is coming soon, 1.24 is close to 3y old now).

Another approach is to track specific distro stable like you do. But to me, it
does not make sense to track LTS that are 5y old like Ubuntu 20.04. It make no
sense to me since you expect these distro to stay stable and be conservice on
versions including libcamera. So forcing libcamera development to something that
old just creates overhead. But 1.22 from Debian previous stable is very
conservative already.

Finally, anything that predates the last libcamera ABI break is questionnable,
since the distro upgrade path isn't straighforward (specially if libcamera
existed in these distro, which is going to be always from here).

regards,
Nicolas
Laurent Pinchart Jan. 13, 2026, 10:36 p.m. UTC | #9
On Mon, Jan 12, 2026 at 08:49:03AM -0500, Nicolas Dufresne wrote:
> Le lundi 12 janvier 2026 à 12:00 +0200, Laurent Pinchart a écrit :
> > On Fri, Jan 09, 2026 at 10:42:17AM -0500, Nicolas Dufresne wrote:
> > > 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.
> > 
> > What would be the minimum GStreamer version you would recommend ?
> 
> My personal preference is to go 2y back for dev track (which is about 2 stable
> back in GStreamer), but that does not align so well with libcamera so far, since
> it does not have stable release in parallel to dev. At the moment it would mean
> 1.24 (which has minimum of GLib 2.64). So we'd still need this workaround until
> the next release (which is coming soon, 1.24 is close to 3y old now).
> 
> Another approach is to track specific distro stable like you do. But to me, it
> does not make sense to track LTS that are 5y old like Ubuntu 20.04. It make no
> sense to me since you expect these distro to stay stable and be conservice on
> versions including libcamera. So forcing libcamera development to something that
> old just creates overhead. But 1.22 from Debian previous stable is very
> conservative already.
> 
> Finally, anything that predates the last libcamera ABI break is questionnable,
> since the distro upgrade path isn't straighforward (specially if libcamera
> existed in these distro, which is going to be always from here).

There are two reasons why we try to support the current and previous LTS
of major distributions (for Ubuntu that would be 22.04 and 24.04, we
don't support 20.04). The first reason is to make it easier for users to
test the latest libcamera on their distribution. We need to support the
previous LTS for some time when a new one gets released to give people
time to upgrade, but how long this is needed is hard to tell as we have
no data on usage patterns.

The other reason is more selfish: our CI containers use Debian images
with distribution-supplied compilers. As we try to support gcc 9 and
newer, we need to compile-test libcamera on Debian 11, 12 and 13. We
could disable compilation of libcamerasrc on Debian 11, but it's best to
maximize coverage of the compilation tests if possible.

In this specific case the workaround is quite simple. We will also drop
Debian 11 from CI in August this year as that will be the end of the LTS
period, so it's all temporary. If we had more severe issues that would
hinder development, I would be fine bumping the GStreamer version
requirement.

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,