Skip to contentSkip to conversation

add support for libcamera's qcam

PATCH In review Quentin Schulz 2 participants 5 messages Apr 15, 2025 – May 19, 2025 Kbuild

lore
Share & tools
lore
#0 lore raw

v2 cover add support for libcamera's qcam

This adds support for qcam example GUI from libcamera. It is based on Qt6 and uses openGL.

Sadly, the qt module from meson is currently broken[1]. The v1 of this series patched host-meson but the v2 now patches BR_PATH to contain /libexec from the Buildroot host dir. This was done as suggested by Peter in the review of v1 to avoid carrying the meson patch that the meson community isn't too happy about. The downside with the BR_PATH patch is that /libexec technically shouldn't be used to store binaries the user (or shell scripts) should execute, and Buildroot is mostly that. Additionally, meson qt module will say it's looking for runtime dependencies when looking for the uic, moc, rcc, ... binaries in /libexec, while they are used at build time, so this is kinda wrong. But it works. Both approaches make meson find the qt tools, and they are not exclusive (we can have both).

qcam requires a font to be installed (e.g. cantarell or dejavu) otherwise characters are renders as square characters.

This is based on top of
https://lore.kernel.org/buildroot/[email protected]/T/#t

[1] https://github.com/mesonbuild/meson/pull/14381

---
Changes in v2:
- removed host-meson patch in favor of BR_PATH patch in Makefile for
meson qt6 module to find the qt tools,
- added dependency on QT6BASE_FONTCONFIG which seems to be required,
- added comment that a font needs to be installed,
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Quentin Schulz (2):
Makefile: add libexec to BR_PATH
package/libcamera: add Qt6 qcam support

 Makefile                       | 2 +-
 package/libcamera/libcamera.mk | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

---
base-commit: 43abcd4c7dd8ad65d2f2012f3d4292362550a3ed
change-id: 20250404-libcamera-qcam-e8269c47e2f9
prerequisite-change-id: 20250404-libcamera-0-5-0-b9ecf899ddb4:v1
prerequisite-patch-id: 854e58d76fc57aa774ca0d315ecae56b67c00c8a
prerequisite-patch-id: 4873ac99203f0d789d64aec048249d9ba6a15a82
prerequisite-patch-id: c4d504c6563a911ba550be263063cfd7bf04bcbe
prerequisite-patch-id: 4a74788db759d3b67650f1456ee4d64f9394f50a
prerequisite-patch-id: 73a4b5a3204b1a901da74a3ffe1672055404dd2f
prerequisite-patch-id: 90b567b9a37abb58747d965ea2e0fef41358844b
prerequisite-patch-id: 946aac34b70f001c24fc6fe86caab759a4591359
prerequisite-patch-id: cee428a4219c83704347f6f194694f21093034da
prerequisite-patch-id: 6bbbdc80dc639a1b2918d79ae101e1030f3312bd

Best regards,

Signature · 6 lines
Quentin Schulz <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v2 1/2 Makefile: add libexec to BR_PATH

From: Quentin Schulz <[email protected]>

Meson qt6 module is looking for uic, moc and other host tools that are now installed in /libexec since Qt 6.1.[1]

Since the libexec directory can contain executables, it seemingly makes sense to add that path to the BR_PATH environment variable so that Qt6 applications built with meson can find uic, moc, rcc, etc... in the Buildroot host tools.

Another attempt[2] was made to make Meson look into the Buildroot host directory but maybe it does make more sense to have libexec part of BR_PATH anyway. Both solutions to the issue aren't exclusive though.

[1] https://github.com/mesonbuild/meson/issues/9791
[2] https://github.com/mesonbuild/meson/pull/14381

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 5bf5abfe3badbd460392582425bbb49ab1a4e7b1..8787a9065fcaae126ed46c434f7ed7988d99bb16 100644
@@ -468,7 +468,7 @@ $(STAGING_DIR_SYMLINK): | $(BASE_DIR)
 	ln -snf $(STAGING_DIR) $(STAGING_DIR_SYMLINK)
 
 # Quotes are needed for spaces and all in the original PATH content.
-BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(PATH)"
+BR_PATH = "$(HOST_DIR)/libexec:$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(PATH)"
 
 # Location of a file giving a big fat warning that output/target
 # should not be used as the root filesystem.
Signature · 6 lines
2.49.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH v2 1/2] Makefile: add libexec to BR_PATH

Hi Quentin,

Quoted 6 lines · Quentin Schulz

From: Quentin Schulz <[email protected]>

Meson qt6 module is looking for uic, moc and other host tools that are now installed in /libexec since Qt 6.1.[1]

Since the libexec directory can contain executables,

libexec is meant for executables that are called from other places and that a
user should never call directly. Sometimes, they have the same name as a related executable in bin or sbin.

Quoted 2 lines

it seemingly makes
sense to add that path to the BR_PATH environment variable

So no, it does not make sense to do that.

Quoted 2 lines

so that Qt6
applications built with meson can find uic, moc, rcc, etc...

I don't understand why Qt did this... It implies that these tools are no
longer meant to be called directly, but only through qmake? There is documentation for calling moc from the Makefile[1], but that won't work if they install in libexec...

Quoted 8 lines

in the
Buildroot host tools.

Another attempt[2] was made to make Meson look into the Buildroot host directory but maybe it does make more sense to have libexec part of BR_PATH anyway. Both solutions to the issue aren't exclusive though.

[1] https://github.com/mesonbuild/meson/issues/9791

It seems it has been fixed in meson now [2][3] so I think we should take those
patches (or update meson to 1.8.0) instead.

Quoted 1 line

[2] https://github.com/mesonbuild/meson/pull/14381

There's an interesting comment there [4] which says that we call meson
incorrectly. That's useful to investigate as well.

Regards,
Arnout

[1] https://doc.qt.io/qt-6/moc.html#writing-make-rules-for-invoking-moc
[2] https://github.com/mesonbuild/meson/pull/9988
[3] https://github.com/mesonbuild/meson/pull/10259
[4] https://github.com/mesonbuild/meson/pull/14381#discussion_r2033625986

Quoted 13 lines
---
  Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 5bf5abfe3badbd460392582425bbb49ab1a4e7b1..8787a9065fcaae126ed46c434f7ed7988d99bb16 100644

Makefile $(STAGING_DIR_SYMLINK): | $(BASE_DIR) · line 474

Quoted 8 lines
Makefile +1 -1
@@ -468,7 +468,7 @@ $(STAGING_DIR_SYMLINK): | $(BASE_DIR)
  	ln -snf $(STAGING_DIR) $(STAGING_DIR_SYMLINK)
 
  # Quotes are needed for spaces and all in the original PATH content.
-BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(PATH)"
+BR_PATH = "$(HOST_DIR)/libexec:$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(PATH)"
 
  # Location of a file giving a big fat warning that output/target
  # should not be used as the root filesystem.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Re: [Buildroot] [PATCH v2 1/2] Makefile: add libexec to BR_PATH

Hi Arnout,

Quoted 38 lines · Arnout Vandecappelle

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

 Hi Quentin,

Quoted 6 lines · Quentin Schulz

From: Quentin Schulz <[email protected]>

Meson qt6 module is looking for uic, moc and other host tools that are now installed in /libexec since Qt 6.1.[1]

Since the libexec directory can contain executables,

 libexec is meant for executables that are called from other places and
that a
user should never call directly. Sometimes, they have the same name as a related executable in bin or sbin.

Quoted 2 lines

it seemingly makes
sense to add that path to the BR_PATH environment variable

 So no, it does not make sense to do that.

Quoted 2 lines

so that Qt6
applications built with meson can find uic, moc, rcc, etc...

 I don't understand why Qt did this... It implies that these tools are no
longer meant to be called directly, but only through qmake? There is documentation for calling moc from the Makefile[1], but that won't work if they install in libexec...

Quoted 7 lines

in the
Buildroot host tools.

Another attempt[2] was made to make Meson look into the Buildroot host directory but maybe it does make more sense to have libexec part of BR_PATH anyway. Both solutions to the issue aren't exclusive though.

Quoted 6 lines
Quoted 1 line

[1] https://eur02.safelinks.protection.outlook.com/? url=https%3A%2F%2Fgithub.com%2Fmesonbuild%2Fmeson%2Fissues%2F9791&data=05%7C02%7Cquentin.schulz%40cherry.de%7C26d93a863502443e0ace08dd94a36cd2%7C5e0e1b5221b54e7b83bb514ec460677e%7C0%7C0%7C638830151828362237%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=NfN6EF1eV7LUadeFOBeWSZAlYMMChJM%2ByobSc2SGdxw%3D&reserved=0

 It seems it has been fixed in meson now [2][3] so I think we should
take those
patches (or update meson to 1.8.0) instead.

Those are already available since 0.63.0 it seems, so that clearly isn't enough for us (or we're missing something else).

Quoted 5 lines
Quoted 1 line

[2] https://eur02.safelinks.protection.outlook.com/? url=https%3A%2F%2Fgithub.com%2Fmesonbuild%2Fmeson%2Fpull%2F14381&data=05%7C02%7Cquentin.schulz%40cherry.de%7C26d93a863502443e0ace08dd94a36cd2%7C5e0e1b5221b54e7b83bb514ec460677e%7C0%7C0%7C638830151828389220%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=wXIaFvMqP18H6BSuZt9UA%2BNUXW0QclNKZnOPX3uFm4E%3D&reserved=0

 There's an interesting comment there [4] which says that we call meson
incorrectly. That's useful to investigate as well.

Looking through the git history of the qt module a bit more, it seems like there's a pkgconf libexecdir variable available since qt6.3, c.f. 49ccf8124aaeda435ec8cd31167418370e36441d. This also reflects what Laurent said in the Merge Request for meson.

Meson actually uses it... but from the wrong file. It takes the target one and not the build pkgconfig. If I add the patch from https://github.com/mesonbuild/meson/pull/14381, then it looks up the proper one, when needed.

I also did what Batchyx said in their comment, rebuilt libcamera only, no change in behavior.

Not sure how to go forward with this, we're still in the same situation. I don't understand what either Laurent or Eli wanted to convey as potential issues.

Cheers,
Quentin
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

PATCH v2 2/2 package/libcamera: add Qt6 qcam support

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

This enables support for Qt6 qcam example application from libcamera.

A font needs to be installed, e.g. cantarell or dejavu will do, otherwise characters are rendered as square characters.

It seems to depend on UTF-8 as well (via BR2_GENERATE_LOCALE) otherwise the following messages can be observed:

"""
Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8. Qt depends on a UTF-8 locale, but has failed to switch to one.
If this causes problems, reconfigure your locale. See the locale(1) manual for more information.
"""

---
 package/libcamera/libcamera.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/libcamera/libcamera.mk +6 -0
index 6877662bdf02df1c7f8ff37039b3096e96e52481..c69ff1b9f8f96b59698f1388162c9ae347a179d6 100644
@@ -85,6 +85,12 @@ LIBCAMERA_CONF_OPTS += -Dcam=enabled
 LIBCAMERA_DEPENDENCIES += libevent
 endif
 
+ifeq ($(BR2_PACKAGE_QT6BASE_WIDGETS)$(BR2_PACKAGE_QT6BASE_OPENGL)$(BR2_PACKAGE_QT6BASE_FONTCONFIG),yyy)
+LIBCAMERA_CONF_OPTS += -Dqcam=enabled
+# qcam also needs a font, don't forget to add one to your image (e.g. dejavu).
+LIBCAMERA_DEPENDENCIES += qt6base
+endif
+
 ifeq ($(BR2_PACKAGE_ELFUTILS),y)
 # Optional dependency on libdw
 LIBCAMERA_DEPENDENCIES += elfutils
Signature · 6 lines
2.49.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot