All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gwenhael Goavec-Merou <gwenj@trabucayre.com>
To: Arnout Vandecappelle <arnout@mind.be>
Cc: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v2 2/2] package/gnuradio: fix gnuradio python libraries for cross-compile
Date: Fri, 7 Jul 2023 10:58:51 +0200	[thread overview]
Message-ID: <20230707105851.0a3f3244@x230> (raw)
In-Reply-To: <503759ef-8263-e971-cfdb-5d2d2c395c27@mind.be>

Arnout, all

On Tue, 4 Jul 2023 22:51:57 +0200
Arnout Vandecappelle <arnout@mind.be> wrote:

> On 26/06/2023 09:05, Gwenhael Goavec-Merou wrote:
> > From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
> > 
> > By default, module libraries have a suffix based on cpython version + host
> > architecture: this is fine for a native compile when these libraries are
> > used on  
> 
>   I think that this is solved in the python infrastructure by setting
> 
> _PYTHON_HOST_PLATFORM="$(PKG_PYTHON_HOST_PLATFORM)"
> 
> Or it may be some other environment variable that is set. For sure though,
> the same problem would exist in normal python packages, and it is resolved
> there. So ideally we should use the same solution for gnuradio.
> 
In fact I see I have missed to explain in my message this issue is related to
pybind.
If PYTHON_MODULE_EXTENSION is unset, .cmake uses a python script containing
sysconfig.get_config_var('EXT_SUFFIX')
This one return .cpython-311-x86_64-linux-gnu.so, because host-python is used.
>   Regards,
>   Arnout
> 
Regards,
Gwenhael

> > the same computer (or similar computers). But when target architecture is
> > not the same python is unable to find libraries due to the wrong suffix and
> > produces unclear errors messages:
> > 
> > # python3
> > Python 3.11.3 (main, Jun 19 2023, 14:15:44) [GCC 11.4.0] on linux
> > Type "help", "copyright", "credits" or "license" for more information.  
> >>>> from gnuradio import blocks  
> > Traceback (most recent call last):
> >    File
> > "/home/xxx/buildroot/output/build/gnuradio-3.10.4.0/gr-blocks/python/blocks/__init__.py",
> > line 18, in <module> ModuleNotFoundError: No module named
> > 'gnuradio.blocks.blocks_python'
> > 
> > During handling of the above exception, another exception occurred:
> > 
> > Traceback (most recent call last):
> >    File "<stdin>", line 1, in <module>
> >    File
> > "/home/xxx/buildroot/output/build/gnuradio-3.10.4.0/gr-blocks/python/blocks/__init__.py",
> > line 22, in <module> ModuleNotFoundError: No module named
> > 'gnuradio.blocks.blocks_python'  
> >>>>  
> > 
> > By adding -DPYTHON_MODULE_EXTENSION=".so" at configure time, pybind11 will
> > use this option instead of using host-python to forge suffix.
> > 
> > Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
> > ---
> > Changes v1 -> v2:
> > - replaces patch by PYTHON_MODULE_EXTENSION option (result is the same
> >    but less "noisy")
> > ---
> >   package/gnuradio/gnuradio.mk | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/package/gnuradio/gnuradio.mk b/package/gnuradio/gnuradio.mk
> > index 1453b78493..d7b3b86c31 100644
> > --- a/package/gnuradio/gnuradio.mk
> > +++ b/package/gnuradio/gnuradio.mk
> > @@ -119,6 +119,8 @@ GNURADIO_CONF_OPTS += -DENABLE_PYTHON=ON
> >   # mandatory to avoid pybind11 to overwrite variables provided
> >   # by gnuradio and buildroot
> >   GNURADIO_CONF_OPTS += -DPYBIND11_PYTHONLIBS_OVERWRITE=OFF
> > +# force libraries suffix (avoid to have libxxx.PYTHONVER-HOST_ARCH.so)
> > +GNURADIO_CONF_OPTS += -DPYTHON_MODULE_EXTENSION=".so"
> >   # mandatory to install python modules in site-packages and to use
> >   # correct path for python libraries
> >   GNURADIO_CONF_OPTS += -DGR_PYTHON_RELATIVE=ON \  
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2023-07-07  8:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26  7:05 [Buildroot] [PATCH v2 1/2] package/gnuradio: fix build with python-pybind > 2.10.0 Gwenhael Goavec-Merou
2023-06-26  7:05 ` [Buildroot] [PATCH v2 2/2] package/gnuradio: fix gnuradio python libraries for cross-compile Gwenhael Goavec-Merou
2023-07-04 20:51   ` Arnout Vandecappelle via buildroot
2023-07-07  8:58     ` Gwenhael Goavec-Merou [this message]
2023-07-07  9:44       ` Arnout Vandecappelle via buildroot
2023-07-10 18:25         ` Thomas Petazzoni via buildroot
2023-07-17 15:17           ` Gwenhael Goavec-Merou
2023-07-04 20:47 ` [Buildroot] [PATCH v2 1/2] package/gnuradio: fix build with python-pybind > 2.10.0 Arnout Vandecappelle via buildroot
2023-07-07  8:40   ` Gwenhael Goavec-Merou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230707105851.0a3f3244@x230 \
    --to=gwenj@trabucayre.com \
    --cc=arnout@mind.be \
    --cc=buildroot@buildroot.org \
    --cc=gwenhael.goavec-merou@trabucayre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.