[libcamera-devel] [PATCH v2 1/3] apps: qcam: Port to Qt 6
Kieran Bingham
kieran.bingham at ideasonboard.com
Wed Jul 24 12:38:07 CEST 2024
Quoting Laurent Pinchart (2024-07-23 19:53:52)
> On Tue, Jul 23, 2024 at 06:11:19PM +0100, Kieran Bingham wrote:
> > Quoting Laurent Pinchart (2024-07-22 16:13:57)
> > > On Mon, Jul 22, 2024 at 04:01:23PM +0100, Kieran Bingham wrote:
> > > > Quoting Kieran Bingham (2024-07-22 15:13:57)
> > > > > Quoting Kieran Bingham (2024-04-16 19:14:35)
> > > > > > Quoting Neal Gompa via libcamera-devel (2024-01-21 22:39:53)
> > > > > > > Open source Qt 5 has been effectively end of life since the release
> > > > > > > of Qt 6, and Qt 6 has current LTS releases now.
> > > > > > >
> > > > > > > This change ports qcam to Qt 6.2 and drops some of the baggage related
> > > > > > > to Qt 5 that is no longer applicable.
> > > > > > >
> > > > > >
> > > > > > With Ubuntu 24.04 release 'imminent' (as well as the next libcamera-0.3
> > > > > > after I can merge the softISP) I believe it's time to merge this patch.
> > > > > >
> > > > > > However ...
> > > > > >
> > > > > >
> > > > > >
> > > > > > > Signed-off-by: Neal Gompa <neal at gompa.dev>
> > > > > > > ---
> > > > > > > README.rst | 2 +-
> > > > > > > meson.build | 2 +-
> > > > > > > src/apps/qcam/meson.build | 45 +++++++++++----------------------------
> > > > > > > 3 files changed, 15 insertions(+), 34 deletions(-)
> > > > > > >
> > > > > > > diff --git a/README.rst b/README.rst
> > > > > > > index 315738ee..6f1c9302 100644
> > > > > > > --- a/README.rst
> > > > > > > +++ b/README.rst
> > > > > > > @@ -88,7 +88,7 @@ for cam: [optional]
> > > > > > > - libsdl2-dev: Enables the SDL sink
> > > > > > >
> > > > > > > for qcam: [optional]
> > > > > > > - libtiff-dev qtbase5-dev qttools5-dev-tools
> > > > > > > + libtiff-dev qt6-base-dev qt6-tools-dev-tools
> > > >
> > > > On debian bullseye there's no qt6-tools-dev-tools package ...
> > > >
> > > > Trying to identify either the correct package or when it gets added...
> > > >
> > > >
> > > > Hrm. ... it looks like it's only available in bullseye-backports:
> > > >
> > > > https://packages.debian.org/bullseye-backports/amd64/qt6-tools-dev-tools
> > > >
> > > > Now ... how do we handle this on the CI ...
> > >
> > > See commit 239de776df95044aa8efa7d19064a9d5c679f4ca in the CI, which
> > > removed handling of backports :-)
> >
> > This must be the hardest patch I've ever tried to land.
> >
> > So ... The CI builders now have QT6 packages, provided through backports
> > in the case of debian-bullseye.
> >
> > We have:
> >
> > - Debian 11 : Bullsye : QT 6.4.2
> > - Debian 12 : Bookworm : QT 6.4.2
> > - Debian 13 : Trixie : QT 6.6.2
> >
> >
> > But this QT6 qcam patch now has a set of failures:
> >
> > - https://gitlab.freedesktop.org/camera/libcamera/-/pipelines/1230127/
> >
> > Debian 11 : gcc 9 : https://gitlab.freedesktop.org/camera/libcamera/-/jobs/61356458
> > - [358/622] Compiling C++ object src/ipa/rpi/controller/librpi_ipa_controller.a.p/rpi_awb.cpp.o
> >
> > In file included from ../src/ipa/libipa/pwl.h:18,
> > from ../src/ipa/rpi/controller/rpi/awb.h:19,
> > from ../src/ipa/rpi/controller/rpi/awb.cpp:16:
> > ../src/ipa/libipa/vector.h: In instantiation of ‘constexpr libcamera::ipa::Vector<T, Rows> libcamera::ipa::Vector<T, Rows, <anonymous> >::operator-(const libcamera::ipa::Vector<T, Rows>&) const [with T = double; unsigned int Rows = 2; std::enable_if_t<is_arithmetic_v<T> >* <anonymous> = 0; std::enable_if_t<is_arithmetic_v<T> > = void]’:
> > ../src/ipa/rpi/controller/rpi/awb.cpp:506:27: required from here
> >
> > (This makes no sense to me at all)
>
> That's a note, not an error. I don't think it's related or new.
Argh! I hadn't realised that. I thought we had a 'clean' build with no
warnings. I didn't see it was a 'note' (it really looks like a warning)
... so I put more into this than it deserved.
Ignored ...
>
> > Debian 11 : gcc 10 :
> >
> > In file included from src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:10:
> > src/apps/qcam/qcam.p/../../../../../src/apps/qcam/viewfinder_gl.h:15:10: fatal error: QOpenGLBuffer: No such file or directory
> > 15 | #include <QOpenGLBuffer>
> > | ^~~~~~~~~~~~~~~
> > compilation terminated.
> >
> > (At least this looks related)
> >
> > Debian 12 : clang ... in fact all the Debian 12's have this error:
> >
> > In file included from src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:10:
> > src/apps/qcam/qcam.p/../../../../../src/apps/qcam/viewfinder_gl.h:15:10: fatal error: 'QOpenGLBuffer' file not found
> > #include <QOpenGLBuffer>
> > ^~~~~~~~~~~~~~~
> >
> >
> > And Buildhistory job also fails as it's based on Debian 12.
> >
> >
> > So ... there's a crazy-how-can-it-be-related-but-consistently-repeatable
> > failure on Debian 11 : gcc 9, and a missing QOpenGLBuffer on all the
> > other failures.
> >
> >
> > Does anyone know if QOpenGLBuffer is just missing from QT 6.4.2 or is
> > this just some spurious build configuration corner case failure we're
> > hitting?
>
> Aren't you just missing the libqt6opengl6-dev package ?
Ok - so yes - that bit was that simple. I've added libqt6opengl6-dev to
the CI explicitly.
I think that means the README needs to be updated again to reference
libqt6opengl6-dev in this patch too.
On to the next (final please?) failure:
https://gitlab.freedesktop.org/camera/libcamera/-/jobs/61434092
[424/606] Linking target src/apps/qcam/qcam
FAILED: src/apps/qcam/qcam
clang++ -o src/apps/qcam/qcam src/apps/qcam/qcam.p/meson-generated_.._qt6-feathericons_qrc.cpp.o src/apps/qcam/qcam.p/meson-generated_.._qt6-shaders_qrc.cpp.o src/apps/qcam/qcam.p/meson-generated_moc_cam_select_dialog.cpp.o src/apps/qcam/qcam.p/meson-generated_moc_main_window.cpp.o src/apps/qcam/qcam.p/meson-generated_moc_viewfinder_gl.cpp.o src/apps/qcam/qcam.p/meson-generated_moc_viewfinder_qt.cpp.o src/apps/qcam/qcam.p/cam_select_dialog.cpp.o src/apps/qcam/qcam.p/format_converter.cpp.o src/apps/qcam/qcam.p/main.cpp.o src/apps/qcam/qcam.p/main_window.cpp.o src/apps/qcam/qcam.p/message_handler.cpp.o src/apps/qcam/qcam.p/viewfinder_gl.cpp.o src/apps/qcam/qcam.p/viewfinder_qt.cpp.o -Wl,--as-needed -Wl,--no-undefined -stdlib=libc++ -Wextra-semi -Wthread-safety -Wmissing-declarations -Wshadow -include /builds/camera/libcamera/build/config.h -Wno-c99-designator '-Wl,-rpath,$ORIGIN/../../libcamera:$ORIGIN/../../libcamera/base' -Wl,-rpath-link,/builds/camera/libcamera/build/src/libcamera -Wl,-rpath-link,/builds/camera/libcamera/build/src/libcamera/base -Wl,--start-group src/apps/common/libapps.a src/libcamera/libcamera.so.0.3.0 src/libcamera/base/libcamera-base.so.0.3.0 -latomic /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libQt6Core.so /usr/lib/x86_64-linux-gnu/libQt6Gui.so /usr/lib/x86_64-linux-gnu/libQt6OpenGL.so /usr/lib/x86_64-linux-gnu/libQt6OpenGLWidgets.so /usr/lib/x86_64-linux-gnu/libQt6Widgets.so -Wl,--end-group
/usr/bin/ld: src/apps/qcam/qcam.p/cam_select_dialog.cpp.o: in function `QString::toStdString() const':
/usr/include/x86_64-linux-gnu/qt6/QtCore/qstring.h:1477: undefined reference to `QByteArray::toStdString() const'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
on the clang builds of debian-12 though gcc-12 builds fine there!
digging ...
--
Kieran
>
> > > > > > Having installed these packages - I still can't enable qcam. So we must
> > > > > > be missing some more dependencies that need to be listed here.
> > > > >
> > > > > So following this back to the list:
> > > > >
> > > > >
> > > > > The issue above impacts Ubuntu-22.04 LTS, but has been reported to
> > > > > Launchpad at:
> > > > >
> > > > > Link: https://bugs.launchpad.net/ubuntu/+source/qt6-base/+bug/2067202
> > > > >
> > > > > And should be resolved in a timeframe based on Ubuntu's priorities.
> > > > >
> > > > > I don't think we should withhold our development on that time frame -
> > > > > and I think this Qt6 enablement patch should be merged.
> > > > >
> > > > > Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> > > > >
> > > > >
> > > > > The 'negative' impacts of merging this patch are:
> > > > > - Developers (not users) using Ubuntu 22.04 will have to manually
> > > > > install a newer version of meson
> > > > > * This is I expect more than likely easy or already done by any
> > > > > actual developers of libcamera
> > > > >
> > > > > - Developers using Ubuntu 22.04 may lose qcam by default.
> > > > > - This will not break the build - but qcam may stop being enabled by
> > > > > default if QT6 can not be found while the bug link referenced above
> > > > > is not resolved.
> > > > > - I would hope this would give more pressure for Canonical to fix the
> > > > > issue - but I expect that the number of libcamera developers who
> > > > > are using libcamera, ubuntu-22.04 *and* need qcam are quite
> > > > > limited. (perhaps just me?) - and solutions can be provided to
> > > > > support them as required - while I think there are more build
> > > > > systems that are now using a qt6 build instead of an EOL qt5 so
> > > > > it's time to move on.
> > > > >
> > > > > > > for tracing with lttng: [optional]
> > > > > > > liblttng-ust-dev python3-jinja2 lttng-tools
> > > > > > > diff --git a/meson.build b/meson.build
> > > > > > > index cb6b666a..4c315e2a 100644
> > > > > > > --- a/meson.build
> > > > > > > +++ b/meson.build
> > > > > > > @@ -1,7 +1,7 @@
> > > > > > > # SPDX-License-Identifier: CC0-1.0
> > > > > > >
> > > > > > > project('libcamera', 'c', 'cpp',
> > > > > > > - meson_version : '>= 0.60',
> > > > > > > + meson_version : '>= 0.63',
> > > > > > > version : '0.2.0',
> > > > > > > default_options : [
> > > > > > > 'werror=true',
> > > > > > > diff --git a/src/apps/qcam/meson.build b/src/apps/qcam/meson.build
> > > > > > > index 6cf4c171..c7fcfbeb 100644
> > > > > > > --- a/src/apps/qcam/meson.build
> > > > > > > +++ b/src/apps/qcam/meson.build
> > > > > > > @@ -1,13 +1,13 @@
> > > > > > > # SPDX-License-Identifier: CC0-1.0
> > > > > > >
> > > > > > > -qt5 = import('qt5')
> > > > > > > -qt5_dep = dependency('qt5',
> > > > > > > +qt6 = import('qt6')
> > > > > > > +qt6_dep = dependency('qt6',
> > > > > > > method : 'pkg-config',
> > > > > > > - modules : ['Core', 'Gui', 'Widgets'],
> > > > > > > + modules : ['Core', 'Gui', 'OpenGL', 'OpenGLWidgets', 'Widgets'],
> > > > > > > required : get_option('qcam'),
> > > > > > > - version : '>=5.4')
> > > > > > > + version : '>=6.2')
> > > > > > >
> > > > > > > -if not qt5_dep.found()
> > > > > > > +if not qt6_dep.found()
> > > > > > > qcam_enabled = false
> > > > > > > subdir_done()
> > > > > > > endif
> > > > > > > @@ -20,46 +20,27 @@ qcam_sources = files([
> > > > > > > 'main.cpp',
> > > > > > > 'main_window.cpp',
> > > > > > > 'message_handler.cpp',
> > > > > > > + 'viewfinder_gl.cpp',
> > > > > > > 'viewfinder_qt.cpp',
> > > > > > > ])
> > > > > > >
> > > > > > > qcam_moc_headers = files([
> > > > > > > 'cam_select_dialog.h',
> > > > > > > 'main_window.h',
> > > > > > > + 'viewfinder_gl.h',
> > > > > > > 'viewfinder_qt.h',
> > > > > > > ])
> > > > > > >
> > > > > > > qcam_resources = files([
> > > > > > > 'assets/feathericons/feathericons.qrc',
> > > > > > > + 'assets/shader/shaders.qrc',
> > > > > > > ])
> > > > > > >
> > > > > > > -qt5_cpp_args = [apps_cpp_args, '-DQT_NO_KEYWORDS']
> > > > > > > +qt6_cpp_args = [apps_cpp_args, '-DQT_NO_KEYWORDS']
> > > > > > >
> > > > > > > -if cxx.has_header_symbol('QOpenGLWidget', 'QOpenGLWidget',
> > > > > > > - dependencies : qt5_dep, args : '-fPIC')
> > > > > > > - qcam_sources += files([
> > > > > > > - 'viewfinder_gl.cpp',
> > > > > > > - ])
> > > > > > > - qcam_moc_headers += files([
> > > > > > > - 'viewfinder_gl.h',
> > > > > > > - ])
> > > > > > > - qcam_resources += files([
> > > > > > > - 'assets/shader/shaders.qrc'
> > > > > > > - ])
> > > > > > > -endif
> > > > > > > -
> > > > > > > -# gcc 9 introduced a deprecated-copy warning that is triggered by Qt until
> > > > > > > -# Qt 5.13. clang 10 introduced the same warning, but detects more issues
> > > > > > > -# that are not fixed in Qt yet. Disable the warning manually in both cases.
> > > > > > > -if ((cc.get_id() == 'gcc' and cc.version().version_compare('>=9.0') and
> > > > > > > - qt5_dep.version().version_compare('<5.13')) or
> > > > > > > - (cc.get_id() == 'clang' and cc.version().version_compare('>=10.0')))
> > > > > > > - qt5_cpp_args += ['-Wno-deprecated-copy']
> > > > > > > -endif
> > > > > > > -
> > > > > > > -resources = qt5.preprocess(moc_headers : qcam_moc_headers,
> > > > > > > +resources = qt6.preprocess(moc_headers : qcam_moc_headers,
> > > > > > > qresources : qcam_resources,
> > > > > > > - dependencies : qt5_dep)
> > > > > > > + dependencies : qt6_dep)
> > > > > > >
> > > > > > > qcam = executable('qcam', qcam_sources, resources,
> > > > > > > install : true,
> > > > > > > @@ -69,6 +50,6 @@ qcam = executable('qcam', qcam_sources, resources,
> > > > > > > libatomic,
> > > > > > > libcamera_public,
> > > > > > > libtiff,
> > > > > > > - qt5_dep,
> > > > > > > + qt6_dep,
> > > > > > > ],
> > > > > > > - cpp_args : qt5_cpp_args)
> > > > > > > + cpp_args : qt6_cpp_args)
>
> --
> Regards,
>
> Laurent Pinchart
More information about the libcamera-devel
mailing list