[libcamera-devel] [PATCH 5/5] py: Move to mainline pybind11 version

Tomi Valkeinen tomi.valkeinen at ideasonboard.com
Tue May 30 14:02:56 CEST 2023

On 30/05/2023 14:29, Laurent Pinchart wrote:
> Hi Tomi,
> On Tue, May 30, 2023 at 02:16:23PM +0300, Tomi Valkeinen wrote:
>> On 30/05/2023 13:12, Laurent Pinchart wrote:
>>> On Tue, May 30, 2023 at 12:20:16PM +0300, Tomi Valkeinen wrote:
>>>> We are using pybind11 'smart_holder' branch to solve the Camera
>>>> destructor issue (see the comment in this patch, or the commit
>>>> that originally added Python bindings support).
>>>> As it would be very nice to use the mainline pybind11 (which is packaged
>>>> in distributions), this patch adds a workaround allowing us to move to
>>>> the mainline pybind11 version.
>>>> The workaround is simply creating a custom holder class, used only for
>>>> the Camera, which wraps around the shared_ptr. This makes the compiler
>>>> happy.
>>>> Moving to mainline pybdin11 is achieved with:
>>> s/pybdin11/pybind11/
>>>> - Change the pybind11 wrap to point to the mainline pybdind11 version
>>>> - Change the meson.build file to use a system-installed pybind11 if
>>>>     available, and use the pybind11 subproject as a fallback. The fallback
>>>>     is there as a convenience, as pybind11 may not be available in
>>>>     pre-packaged form in all environments.
>>> Given that Python bindings isn't a core feature of libcamera, do we
>>> really need a subproject, or could we disable the Python bindings when
>>> pybind11 isn't found ? We have subprojects for libyaml and libyuv, as
>>> they're required by the libcamera core and the Android camera HAL and
>>> not available on AOSP, but for optional features, I would prefer relying
>>> on the build environment to provide the necessary dependencies,
>>> especially given that both Debian and Fedora have a pybind11 package.
>> Well... It's for my convenience, at least =). Buildroot doesn't/didn't
>> have a properly working pybind11.
> I think the package is called python-pybind in buildroot.
>> Maybe we can drop it, but I'd rather do it later so that we don't mess
>> up too many things at the same time.
>> Or I can just add a patch to my local tree which adds the subproject, if
>> the consensus is to drop it from libcamera.
> Could you test with the buildroot python-pybind package ? If that works,
> is there any blocker to dropping the subproject ?

Buildroot seemed to work fine for me with a quick test, so let's drop 
the subproject. If this turns out to be a problem, it's easy to add it back.


More information about the libcamera-devel mailing list