<div dir="ltr">Hi both,<div><br></div><div>Thanks for your comments - I hadn't considered cross compilation, but from looking into it I can see that this change would cause the problems you've mentioned. Would it be an acceptable solution to wrap these changes within "if meson.is_cross_build() else ..." so that cross compilation uses the previous code still, but native compilation uses the meson python module? If so, I'll submit a v2 with those changes.</div><div><br></div><div>Thanks,</div><div><br></div><div>William</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 26 Oct 2023 at 06:39, Tomi Valkeinen <<a href="mailto:tomi.valkeinen@ideasonboard.com">tomi.valkeinen@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 25/10/2023 14:04, Laurent Pinchart wrote:<br>
> Hi William,<br>
> <br>
> (CC'ing Tomi)<br>
> <br>
> Thank you for the patch.<br>
> <br>
> On Wed, Oct 25, 2023 at 10:36:49AM +0100, William Vinnicombe via libcamera-devel wrote:<br>
>> The existing meson.build file installs the bindings to an architecture<br>
>> specific libdir (eg /usr/local/lib/aarch64-linux-gnu/), which is not<br>
>> picked up by default python which only looks in the non architecture<br>
>> specific libdir (eg /usr/local/lib/python3.11/). It also will always<br>
>> build using the system python, rather than building using the same<br>
>> python as meson is using. This prevents a user being able to build the<br>
>> bindings for a different version of python, without changing their<br>
>> system python to that version.<br>
>><br>
>> Modify the build process to use the meson Python module to build the<br>
>> python bindings targets, so it installs them to the correct directories<br>
>> for python, and builds them for the version of python that meson is<br>
>> running with.<br>
>><br>
>> Signed-off-by: William Vinnicombe <<a href="mailto:william.vinnicombe@raspberrypi.com" target="_blank">william.vinnicombe@raspberrypi.com</a>><br>
>> ---<br>
>> src/py/libcamera/meson.build | 23 ++++++++++++-----------<br>
>> 1 file changed, 12 insertions(+), 11 deletions(-)<br>
>><br>
>> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build<br>
>> index f58c7198..e9e3f915 100644<br>
>> --- a/src/py/libcamera/meson.build<br>
>> +++ b/src/py/libcamera/meson.build<br>
>> @@ -1,6 +1,8 @@<br>
>> # SPDX-License-Identifier: CC0-1.0<br>
>> <br>
>> -py3_dep = dependency('python3', required : get_option('pycamera'))<br>
>> +<br>
>> +py = import('python').find_installation('python3', required : get_option('pycamera'))<br>
>> +py3_dep = py.dependency(required : get_option('pycamera'))<br>
> <br>
> Does this still work when cross-compiling ? I recall we tried the meson<br>
> python module, and it had problems with cross-compilation. Tomi may know<br>
> more.<br>
<br>
Right. When cross-compiling, you don't want that "[the build process] <br>
builds them for the version of python that meson is running with", as <br>
meson is running (for me) in x86 environment, but the target is arm.<br>
<br>
I'm not sure if there's been any work on fixing all that in the meson <br>
side, but the last time I talked to them they didn't have any clear <br>
ideas how to fix it.<br>
<br>
Perhaps this can be solved by manually dealing with all the python <br>
details in the meson.build file, and adding a meson option so that the <br>
user can tell which python to use.<br>
<br>
Tomi<br>
<br>
</blockquote></div>