[CI,2/2] Add compilation test with gcc 14
diff mbox series

Message ID 20240527174016.11415-3-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Miscellaneous CI coverage extensions
Related show

Commit Message

Laurent Pinchart May 27, 2024, 5:40 p.m. UTC
Compile with gcc 14 on Debian trixie. Compiling with C++20 would trigger
the following warning, introduced in gcc 14:

../src/libcamera/base/log.cpp: In member function ‘void libcamera::Logger::write(const libcamera::LogMessage&)’:
../src/libcamera/base/log.cpp:468:61: error: ‘std::shared_ptr<_Tp> std::atomic_load(const shared_ptr<_Tp>*) [with _Tp = libcamera::LogOutput]’ is deprecated: use 'std::atomic<std::shared_ptr<T>>' instead [-Werror=deprecated-declarations]
  468 |         std::shared_ptr<LogOutput> output = std::atomic_load(&output_);
      |                                             ~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/memory:81,
                 from ../include/libcamera/base/class.h:10,
                 from ../include/libcamera/base/log.h:15,
                 from ../src/libcamera/base/log.cpp:8:
/usr/include/c++/14/bits/shared_ptr_atomic.h:142:5: note: declared here
  142 |     atomic_load(const shared_ptr<_Tp>* __p)
      |     ^~~~~~~~~~~

As std::atomic<std::shared_ptr<T>> got introduced in C++20, we can't use
it while remaining compatible with C++17. Disabling the
-Werror=deprecated-declarations option would prevent other deprecated
declarations from being noticed, so it's not a good solution either.

To work around the problem, use C++17 when compiling with gcc 14. gcc 13
still gives us decent test coverage of C++20 compilation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 .gitlab-ci/setup-container.sh | 12 +++++++++---
 gitlab-ci.yml                 | 20 ++++++++++++--------
 2 files changed, 21 insertions(+), 11 deletions(-)

Comments

Kieran Bingham May 28, 2024, 2:37 p.m. UTC | #1
Quoting Laurent Pinchart (2024-05-27 18:40:16)
> Compile with gcc 14 on Debian trixie. Compiling with C++20 would trigger
> the following warning, introduced in gcc 14:
> 
> ../src/libcamera/base/log.cpp: In member function ‘void libcamera::Logger::write(const libcamera::LogMessage&)’:
> ../src/libcamera/base/log.cpp:468:61: error: ‘std::shared_ptr<_Tp> std::atomic_load(const shared_ptr<_Tp>*) [with _Tp = libcamera::LogOutput]’ is deprecated: use 'std::atomic<std::shared_ptr<T>>' instead [-Werror=deprecated-declarations]
>   468 |         std::shared_ptr<LogOutput> output = std::atomic_load(&output_);
>       |                                             ~~~~~~~~~~~~~~~~^~~~~~~~~~
> In file included from /usr/include/c++/14/memory:81,
>                  from ../include/libcamera/base/class.h:10,
>                  from ../include/libcamera/base/log.h:15,
>                  from ../src/libcamera/base/log.cpp:8:
> /usr/include/c++/14/bits/shared_ptr_atomic.h:142:5: note: declared here
>   142 |     atomic_load(const shared_ptr<_Tp>* __p)
>       |     ^~~~~~~~~~~
> 
> As std::atomic<std::shared_ptr<T>> got introduced in C++20, we can't use
> it while remaining compatible with C++17. Disabling the
> -Werror=deprecated-declarations option would prevent other deprecated
> declarations from being noticed, so it's not a good solution either.
> 
> To work around the problem, use C++17 when compiling with gcc 14. gcc 13
> still gives us decent test coverage of C++20 compilation.

That's fine with me.

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  .gitlab-ci/setup-container.sh | 12 +++++++++---
>  gitlab-ci.yml                 | 20 ++++++++++++--------
>  2 files changed, 21 insertions(+), 11 deletions(-)
> 
> diff --git a/.gitlab-ci/setup-container.sh b/.gitlab-ci/setup-container.sh
> index fc3c0568bf7c..93a9f9cc91e8 100755
> --- a/.gitlab-ci/setup-container.sh
> +++ b/.gitlab-ci/setup-container.sh
> @@ -93,10 +93,16 @@ archs=( amd64 )
>  
>  declare -A components
>  
> -# On Debian bullseye, install gcc 9 in addition to the default gcc 10.
> -if [[ $FDO_DISTRIBUTION_VERSION == 'bullseye' ]] ; then
> +# Install additional gcc versions On Debian bullseye (gcc 9) and trixie (gcc
> +# 14).
> +case $FDO_DISTRIBUTION_VERSION in
> +'bullseye')
>         PKGS_LIBCAMERA_RUNTIME+=( g++-9 )
> -fi
> +       ;;
> +'trixie')
> +       PKGS_LIBCAMERA_RUNTIME+=( g++-14 )
> +       ;;
> +esac

shellcheck is quite noisy on setup-container.sh, but nothing seems to be
introduced by this addition.

>  
>  # We use Debian bookworm containers to produce ARM binaries and run unit tests
>  # with virtme, and other Debian versions for compilation-testing on amd64 only.
> diff --git a/gitlab-ci.yml b/gitlab-ci.yml
> index 465931a761fc..50b81e591458 100644
> --- a/gitlab-ci.yml
> +++ b/gitlab-ci.yml
> @@ -69,7 +69,7 @@ include:
>  .libcamera-ci.debian:13:
>    variables:
>      FDO_DISTRIBUTION_VERSION: 'trixie'
> -    FDO_DISTRIBUTION_TAG: '2024-05-27.0'
> +    FDO_DISTRIBUTION_TAG: '2024-05-27.1'
>  
>  .container-debian:
>    extends:
> @@ -219,13 +219,17 @@ build-full:debian:13:
>    needs:
>      - job: container-debian:13
>        artifacts: false
> -  variables:
> -    ARCH: amd64
> -    CC: gcc-13
> -    CXX: g++-13
> -    MESON_OPTIONS: >-
> -      ${MESON_ALL_OPTIONS}
> -      -D cpp_std=c++20
> +  parallel:
> +    matrix:
> +      - ARCH: amd64
> +        CC: gcc-13
> +        CXX: g++-13
> +        MESON_OPTIONS: >-
> +          ${MESON_ALL_OPTIONS}
> +          -D cpp_std=c++20
> +      - ARCH: amd64
> +        CC: gcc-14
> +        CXX: g++-14

I guess this is where comments describing the intent of each build
config might be clearer, but I don't think it's necessary.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

>  
>  # Build each commit in the branch individually to detect compilation breakages.
>  build-history:
> -- 
> Regards,
> 
> Laurent Pinchart
>
Laurent Pinchart May 28, 2024, 3:49 p.m. UTC | #2
On Tue, May 28, 2024 at 03:37:32PM +0100, Kieran Bingham wrote:
> Quoting Laurent Pinchart (2024-05-27 18:40:16)
> > Compile with gcc 14 on Debian trixie. Compiling with C++20 would trigger
> > the following warning, introduced in gcc 14:
> > 
> > ../src/libcamera/base/log.cpp: In member function ‘void libcamera::Logger::write(const libcamera::LogMessage&)’:
> > ../src/libcamera/base/log.cpp:468:61: error: ‘std::shared_ptr<_Tp> std::atomic_load(const shared_ptr<_Tp>*) [with _Tp = libcamera::LogOutput]’ is deprecated: use 'std::atomic<std::shared_ptr<T>>' instead [-Werror=deprecated-declarations]
> >   468 |         std::shared_ptr<LogOutput> output = std::atomic_load(&output_);
> >       |                                             ~~~~~~~~~~~~~~~~^~~~~~~~~~
> > In file included from /usr/include/c++/14/memory:81,
> >                  from ../include/libcamera/base/class.h:10,
> >                  from ../include/libcamera/base/log.h:15,
> >                  from ../src/libcamera/base/log.cpp:8:
> > /usr/include/c++/14/bits/shared_ptr_atomic.h:142:5: note: declared here
> >   142 |     atomic_load(const shared_ptr<_Tp>* __p)
> >       |     ^~~~~~~~~~~
> > 
> > As std::atomic<std::shared_ptr<T>> got introduced in C++20, we can't use
> > it while remaining compatible with C++17. Disabling the
> > -Werror=deprecated-declarations option would prevent other deprecated
> > declarations from being noticed, so it's not a good solution either.
> > 
> > To work around the problem, use C++17 when compiling with gcc 14. gcc 13
> > still gives us decent test coverage of C++20 compilation.
> 
> That's fine with me.
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  .gitlab-ci/setup-container.sh | 12 +++++++++---
> >  gitlab-ci.yml                 | 20 ++++++++++++--------
> >  2 files changed, 21 insertions(+), 11 deletions(-)
> > 
> > diff --git a/.gitlab-ci/setup-container.sh b/.gitlab-ci/setup-container.sh
> > index fc3c0568bf7c..93a9f9cc91e8 100755
> > --- a/.gitlab-ci/setup-container.sh
> > +++ b/.gitlab-ci/setup-container.sh
> > @@ -93,10 +93,16 @@ archs=( amd64 )
> >  
> >  declare -A components
> >  
> > -# On Debian bullseye, install gcc 9 in addition to the default gcc 10.
> > -if [[ $FDO_DISTRIBUTION_VERSION == 'bullseye' ]] ; then
> > +# Install additional gcc versions On Debian bullseye (gcc 9) and trixie (gcc
> > +# 14).
> > +case $FDO_DISTRIBUTION_VERSION in
> > +'bullseye')
> >         PKGS_LIBCAMERA_RUNTIME+=( g++-9 )
> > -fi
> > +       ;;
> > +'trixie')
> > +       PKGS_LIBCAMERA_RUNTIME+=( g++-14 )
> > +       ;;
> > +esac
> 
> shellcheck is quite noisy on setup-container.sh, but nothing seems to be
> introduced by this addition.

Patches are welcome. Do we need to CI our CI ? :-)

> >  # We use Debian bookworm containers to produce ARM binaries and run unit tests
> >  # with virtme, and other Debian versions for compilation-testing on amd64 only.
> > diff --git a/gitlab-ci.yml b/gitlab-ci.yml
> > index 465931a761fc..50b81e591458 100644
> > --- a/gitlab-ci.yml
> > +++ b/gitlab-ci.yml
> > @@ -69,7 +69,7 @@ include:
> >  .libcamera-ci.debian:13:
> >    variables:
> >      FDO_DISTRIBUTION_VERSION: 'trixie'
> > -    FDO_DISTRIBUTION_TAG: '2024-05-27.0'
> > +    FDO_DISTRIBUTION_TAG: '2024-05-27.1'
> >  
> >  .container-debian:
> >    extends:
> > @@ -219,13 +219,17 @@ build-full:debian:13:
> >    needs:
> >      - job: container-debian:13
> >        artifacts: false
> > -  variables:
> > -    ARCH: amd64
> > -    CC: gcc-13
> > -    CXX: g++-13
> > -    MESON_OPTIONS: >-
> > -      ${MESON_ALL_OPTIONS}
> > -      -D cpp_std=c++20
> > +  parallel:
> > +    matrix:
> > +      - ARCH: amd64
> > +        CC: gcc-13
> > +        CXX: g++-13
> > +        MESON_OPTIONS: >-
> > +          ${MESON_ALL_OPTIONS}
> > +          -D cpp_std=c++20
> > +      - ARCH: amd64
> > +        CC: gcc-14
> > +        CXX: g++-14
> 
> I guess this is where comments describing the intent of each build
> config might be clearer, but I don't think it's necessary.
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> >  
> >  # Build each commit in the branch individually to detect compilation breakages.
> >  build-history:
Kieran Bingham May 28, 2024, 3:54 p.m. UTC | #3
Quoting Laurent Pinchart (2024-05-28 16:49:42)
> On Tue, May 28, 2024 at 03:37:32PM +0100, Kieran Bingham wrote:
> > Quoting Laurent Pinchart (2024-05-27 18:40:16)
> > > Compile with gcc 14 on Debian trixie. Compiling with C++20 would trigger
> > > the following warning, introduced in gcc 14:
> > > 
> > > ../src/libcamera/base/log.cpp: In member function ‘void libcamera::Logger::write(const libcamera::LogMessage&)’:
> > > ../src/libcamera/base/log.cpp:468:61: error: ‘std::shared_ptr<_Tp> std::atomic_load(const shared_ptr<_Tp>*) [with _Tp = libcamera::LogOutput]’ is deprecated: use 'std::atomic<std::shared_ptr<T>>' instead [-Werror=deprecated-declarations]
> > >   468 |         std::shared_ptr<LogOutput> output = std::atomic_load(&output_);
> > >       |                                             ~~~~~~~~~~~~~~~~^~~~~~~~~~
> > > In file included from /usr/include/c++/14/memory:81,
> > >                  from ../include/libcamera/base/class.h:10,
> > >                  from ../include/libcamera/base/log.h:15,
> > >                  from ../src/libcamera/base/log.cpp:8:
> > > /usr/include/c++/14/bits/shared_ptr_atomic.h:142:5: note: declared here
> > >   142 |     atomic_load(const shared_ptr<_Tp>* __p)
> > >       |     ^~~~~~~~~~~
> > > 
> > > As std::atomic<std::shared_ptr<T>> got introduced in C++20, we can't use
> > > it while remaining compatible with C++17. Disabling the
> > > -Werror=deprecated-declarations option would prevent other deprecated
> > > declarations from being noticed, so it's not a good solution either.
> > > 
> > > To work around the problem, use C++17 when compiling with gcc 14. gcc 13
> > > still gives us decent test coverage of C++20 compilation.
> > 
> > That's fine with me.
> > 
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > ---
> > >  .gitlab-ci/setup-container.sh | 12 +++++++++---
> > >  gitlab-ci.yml                 | 20 ++++++++++++--------
> > >  2 files changed, 21 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/.gitlab-ci/setup-container.sh b/.gitlab-ci/setup-container.sh
> > > index fc3c0568bf7c..93a9f9cc91e8 100755
> > > --- a/.gitlab-ci/setup-container.sh
> > > +++ b/.gitlab-ci/setup-container.sh
> > > @@ -93,10 +93,16 @@ archs=( amd64 )
> > >  
> > >  declare -A components
> > >  
> > > -# On Debian bullseye, install gcc 9 in addition to the default gcc 10.
> > > -if [[ $FDO_DISTRIBUTION_VERSION == 'bullseye' ]] ; then
> > > +# Install additional gcc versions On Debian bullseye (gcc 9) and trixie (gcc
> > > +# 14).
> > > +case $FDO_DISTRIBUTION_VERSION in
> > > +'bullseye')
> > >         PKGS_LIBCAMERA_RUNTIME+=( g++-9 )
> > > -fi
> > > +       ;;
> > > +'trixie')
> > > +       PKGS_LIBCAMERA_RUNTIME+=( g++-14 )
> > > +       ;;
> > > +esac
> > 
> > shellcheck is quite noisy on setup-container.sh, but nothing seems to be
> > introduced by this addition.
> 
> Patches are welcome. Do we need to CI our CI ? :-)

I'm surprised you didn't ;-)

--
Kieran

Patch
diff mbox series

diff --git a/.gitlab-ci/setup-container.sh b/.gitlab-ci/setup-container.sh
index fc3c0568bf7c..93a9f9cc91e8 100755
--- a/.gitlab-ci/setup-container.sh
+++ b/.gitlab-ci/setup-container.sh
@@ -93,10 +93,16 @@  archs=( amd64 )
 
 declare -A components
 
-# On Debian bullseye, install gcc 9 in addition to the default gcc 10.
-if [[ $FDO_DISTRIBUTION_VERSION == 'bullseye' ]] ; then
+# Install additional gcc versions On Debian bullseye (gcc 9) and trixie (gcc
+# 14).
+case $FDO_DISTRIBUTION_VERSION in
+'bullseye')
 	PKGS_LIBCAMERA_RUNTIME+=( g++-9 )
-fi
+	;;
+'trixie')
+	PKGS_LIBCAMERA_RUNTIME+=( g++-14 )
+	;;
+esac
 
 # We use Debian bookworm containers to produce ARM binaries and run unit tests
 # with virtme, and other Debian versions for compilation-testing on amd64 only.
diff --git a/gitlab-ci.yml b/gitlab-ci.yml
index 465931a761fc..50b81e591458 100644
--- a/gitlab-ci.yml
+++ b/gitlab-ci.yml
@@ -69,7 +69,7 @@  include:
 .libcamera-ci.debian:13:
   variables:
     FDO_DISTRIBUTION_VERSION: 'trixie'
-    FDO_DISTRIBUTION_TAG: '2024-05-27.0'
+    FDO_DISTRIBUTION_TAG: '2024-05-27.1'
 
 .container-debian:
   extends:
@@ -219,13 +219,17 @@  build-full:debian:13:
   needs:
     - job: container-debian:13
       artifacts: false
-  variables:
-    ARCH: amd64
-    CC: gcc-13
-    CXX: g++-13
-    MESON_OPTIONS: >-
-      ${MESON_ALL_OPTIONS}
-      -D cpp_std=c++20
+  parallel:
+    matrix:
+      - ARCH: amd64
+        CC: gcc-13
+        CXX: g++-13
+        MESON_OPTIONS: >-
+          ${MESON_ALL_OPTIONS}
+          -D cpp_std=c++20
+      - ARCH: amd64
+        CC: gcc-14
+        CXX: g++-14
 
 # Build each commit in the branch individually to detect compilation breakages.
 build-history: