mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] libgpiod: select HOST_SYSTEM_PYTHON3_DEV for Python bindings
@ 2025-05-20 12:21 Markus Heidelberg via ptxdist
  2025-05-25 13:50 ` Michael Olbrich
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Heidelberg via ptxdist @ 2025-05-20 12:21 UTC (permalink / raw)
  To: ptxdist; +Cc: Markus Heidelberg

python3-config has to exist, available in python3-dev Debian package.

Fixes the following error in libgpiod prepare stage:

  checking for python3-config... false
  configure: error: python3-config not found - needed for python bindings

Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de>
---
 rules/libgpiod.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/rules/libgpiod.in b/rules/libgpiod.in
index 94bff5164..012223ff1 100644
--- a/rules/libgpiod.in
+++ b/rules/libgpiod.in
@@ -6,6 +6,7 @@ menuconfig LIBGPIOD
 	select HOST_SYSTEM_PYTHON3
 	select GCCLIBS_CXX	if LIBGPIOD_CXX
 	select PYTHON3		if LIBGPIOD_PYTHON3
+	select HOST_SYSTEM_PYTHON3_DEV	if LIBGPIOD_PYTHON3
 	help
 	  libgpiod is a library accompanied by a set of tools for
 	  interacting with the Linux GPIO character device.
-- 
2.43.0




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] libgpiod: select HOST_SYSTEM_PYTHON3_DEV for Python bindings
  2025-05-20 12:21 [ptxdist] [PATCH] libgpiod: select HOST_SYSTEM_PYTHON3_DEV for Python bindings Markus Heidelberg via ptxdist
@ 2025-05-25 13:50 ` Michael Olbrich
  2025-05-27 11:28   ` Markus Heidelberg via ptxdist
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Olbrich @ 2025-05-25 13:50 UTC (permalink / raw)
  To: Markus Heidelberg via ptxdist; +Cc: Markus Heidelberg

On Tue, May 20, 2025 at 02:21:51PM +0200, Markus Heidelberg via ptxdist wrote:
> python3-config has to exist, available in python3-dev Debian package.
> 
> Fixes the following error in libgpiod prepare stage:
> 
>   checking for python3-config... false
>   configure: error: python3-config not found - needed for python bindings
> 
> Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de>
> ---
>  rules/libgpiod.in | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/rules/libgpiod.in b/rules/libgpiod.in
> index 94bff5164..012223ff1 100644
> --- a/rules/libgpiod.in
> +++ b/rules/libgpiod.in
> @@ -6,6 +6,7 @@ menuconfig LIBGPIOD
>  	select HOST_SYSTEM_PYTHON3
>  	select GCCLIBS_CXX	if LIBGPIOD_CXX
>  	select PYTHON3		if LIBGPIOD_PYTHON3
> +	select HOST_SYSTEM_PYTHON3_DEV	if LIBGPIOD_PYTHON3

No, this is wrong. The python3-config should come from the Python we use to
build stuff for the target, so host-python/python.

We do some hacky stuff to combine the host-python binary with target python
stuff to get a cross python to build stuff. Maybe that needs to be extended
so that libgpiod will find python3-config?

Michael

>  	help
>  	  libgpiod is a library accompanied by a set of tools for
>  	  interacting with the Linux GPIO character device.
> -- 
> 2.43.0
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] libgpiod: select HOST_SYSTEM_PYTHON3_DEV for Python bindings
  2025-05-25 13:50 ` Michael Olbrich
@ 2025-05-27 11:28   ` Markus Heidelberg via ptxdist
  2025-05-27 12:06     ` Michael Olbrich
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Heidelberg via ptxdist @ 2025-05-27 11:28 UTC (permalink / raw)
  To: Michael Olbrich; +Cc: Markus Heidelberg, Markus Heidelberg via ptxdist

On Sun, May 25, 2025 at 03:50:17PM +0200, Michael Olbrich wrote:
> On Tue, May 20, 2025 at 02:21:51PM +0200, Markus Heidelberg via ptxdist wrote:
> > python3-config has to exist, available in python3-dev Debian package.
> > 
> > Fixes the following error in libgpiod prepare stage:
> > 
> >   checking for python3-config... false
> >   configure: error: python3-config not found - needed for python bindings
> > 
> > Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de>
> > ---
> >  rules/libgpiod.in | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/rules/libgpiod.in b/rules/libgpiod.in
> > index 94bff5164..012223ff1 100644
> > --- a/rules/libgpiod.in
> > +++ b/rules/libgpiod.in
> > @@ -6,6 +6,7 @@ menuconfig LIBGPIOD
> >  	select HOST_SYSTEM_PYTHON3
> >  	select GCCLIBS_CXX	if LIBGPIOD_CXX
> >  	select PYTHON3		if LIBGPIOD_PYTHON3
> > +	select HOST_SYSTEM_PYTHON3_DEV	if LIBGPIOD_PYTHON3
> 
> No, this is wrong. The python3-config should come from the Python we use to
> build stuff for the target, so host-python/python.
> 
> We do some hacky stuff to combine the host-python binary with target python
> stuff to get a cross python to build stuff. Maybe that needs to be extended
> so that libgpiod will find python3-config?

I guess python3-config from sysroot-cross should be used, but there is
only python3.13-config. So I wonder whether

A) there is a symlink (or copy) missing:
   sysroot-cross/usr/bin/python3-config -> python3.13-config

B) libgpiod's configure.ac has to be patched:
   -python3-config
   +python3.13-config

Markus


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] libgpiod: select HOST_SYSTEM_PYTHON3_DEV for Python bindings
  2025-05-27 11:28   ` Markus Heidelberg via ptxdist
@ 2025-05-27 12:06     ` Michael Olbrich
  2025-05-28 14:49       ` Markus Heidelberg via ptxdist
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Olbrich @ 2025-05-27 12:06 UTC (permalink / raw)
  To: Markus Heidelberg; +Cc: Markus Heidelberg via ptxdist

On Tue, May 27, 2025 at 11:28:23AM +0000, Markus Heidelberg wrote:
> On Sun, May 25, 2025 at 03:50:17PM +0200, Michael Olbrich wrote:
> > On Tue, May 20, 2025 at 02:21:51PM +0200, Markus Heidelberg via ptxdist wrote:
> > > python3-config has to exist, available in python3-dev Debian package.
> > > 
> > > Fixes the following error in libgpiod prepare stage:
> > > 
> > >   checking for python3-config... false
> > >   configure: error: python3-config not found - needed for python bindings
> > > 
> > > Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de>
> > > ---
> > >  rules/libgpiod.in | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/rules/libgpiod.in b/rules/libgpiod.in
> > > index 94bff5164..012223ff1 100644
> > > --- a/rules/libgpiod.in
> > > +++ b/rules/libgpiod.in
> > > @@ -6,6 +6,7 @@ menuconfig LIBGPIOD
> > >  	select HOST_SYSTEM_PYTHON3
> > >  	select GCCLIBS_CXX	if LIBGPIOD_CXX
> > >  	select PYTHON3		if LIBGPIOD_PYTHON3
> > > +	select HOST_SYSTEM_PYTHON3_DEV	if LIBGPIOD_PYTHON3
> > 
> > No, this is wrong. The python3-config should come from the Python we use to
> > build stuff for the target, so host-python/python.
> > 
> > We do some hacky stuff to combine the host-python binary with target python
> > stuff to get a cross python to build stuff. Maybe that needs to be extended
> > so that libgpiod will find python3-config?
> 
> I guess python3-config from sysroot-cross should be used, but there is
> only python3.13-config. So I wonder whether
> 
> A) there is a symlink (or copy) missing:
>    sysroot-cross/usr/bin/python3-config -> python3.13-config
> 
> B) libgpiod's configure.ac has to be patched:
>    -python3-config
>    +python3.13-config

Try adding ac_cv_prog_has_python_config=python3.13-config to
LIBGPIOD_CONF_ENV. Does that help?

Michael

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] libgpiod: select HOST_SYSTEM_PYTHON3_DEV for Python bindings
  2025-05-27 12:06     ` Michael Olbrich
@ 2025-05-28 14:49       ` Markus Heidelberg via ptxdist
  2025-05-30 13:25         ` [ptxdist] [PATCH v2] libgpiod: override location of python3-config Markus Heidelberg via ptxdist
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Heidelberg via ptxdist @ 2025-05-28 14:49 UTC (permalink / raw)
  To: Michael Olbrich, ptxdist; +Cc: Markus Heidelberg

> On Tue, May 27, 2025 at 11:28:23AM +0000, Markus Heidelberg wrote:
> > On Sun, May 25, 2025 at 03:50:17PM +0200, Michael Olbrich wrote:
> > > On Tue, May 20, 2025 at 02:21:51PM +0200, Markus Heidelberg via ptxdist wrote:
> > > > python3-config has to exist, available in python3-dev Debian package.
> > > > 
> > > > Fixes the following error in libgpiod prepare stage:
> > > > 
> > > >   checking for python3-config... false
> > > >   configure: error: python3-config not found - needed for python bindings
> > > > 
> > > > Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de>
> > > > ---
> > > >  rules/libgpiod.in | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > > 
> > > > diff --git a/rules/libgpiod.in b/rules/libgpiod.in
> > > > index 94bff5164..012223ff1 100644
> > > > --- a/rules/libgpiod.in
> > > > +++ b/rules/libgpiod.in
> > > > @@ -6,6 +6,7 @@ menuconfig LIBGPIOD
> > > >  	select HOST_SYSTEM_PYTHON3
> > > >  	select GCCLIBS_CXX	if LIBGPIOD_CXX
> > > >  	select PYTHON3		if LIBGPIOD_PYTHON3
> > > > +	select HOST_SYSTEM_PYTHON3_DEV	if LIBGPIOD_PYTHON3
> > > 
> > > No, this is wrong. The python3-config should come from the Python we use to
> > > build stuff for the target, so host-python/python.
> > > 
> > > We do some hacky stuff to combine the host-python binary with target python
> > > stuff to get a cross python to build stuff. Maybe that needs to be extended
> > > so that libgpiod will find python3-config?
> > 
> > I guess python3-config from sysroot-cross should be used, but there is
> > only python3.13-config. So I wonder whether
> > 
> > A) there is a symlink (or copy) missing:
> >    sysroot-cross/usr/bin/python3-config -> python3.13-config
> > 
> > B) libgpiod's configure.ac has to be patched:
> >    -python3-config
> >    +python3.13-config
> 
> Try adding ac_cv_prog_has_python_config=python3.13-config to
> LIBGPIOD_CONF_ENV. Does that help?

Yes, that helps, libgpiod builds successfully then.

However, finally I had a look into the libgpiod sources and noticed that
python3-config is not used at all. Autotools aren't used anymore to
build the Python bindings since v2:
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/commit/bindings/python/Makefile.am?id=b7ba732e6a93313d4609c4d3ffb426996bf68d02

Later some Python leftover had been removed from configure.ac, but not
the python3-config check:
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/commit/?id=8aab09cb23b19799c058f3375afde5f07de03eef

So it would probably be better to just remove the python3-config check.
I'll submit a patch upstream and when accepted submit it to PTXdist.

Markus


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ptxdist] [PATCH v2] libgpiod: override location of python3-config
  2025-05-28 14:49       ` Markus Heidelberg via ptxdist
@ 2025-05-30 13:25         ` Markus Heidelberg via ptxdist
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Heidelberg via ptxdist @ 2025-05-30 13:25 UTC (permalink / raw)
  To: ptxdist; +Cc: Markus Heidelberg

It exists as python3.13-config (or whatever the minor version currently
is) in sysroot-cross directory.

Fixes the following error in libgpiod prepare stage:

  checking for python3-config... false
  configure: error: python3-config not found - needed for python bindings

However, python3-config isn't used at all to build the Python bindings
and ac_cv_prog_has_python_config could be set to any value except
"false" to fix the error.

Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de>
---

> So it would probably be better to just remove the python3-config check.
> I'll submit a patch upstream and when accepted submit it to PTXdist.

I submitted a patch upstream, but decided for the
ac_cv_prog_has_python_config solution for PTXdist.
It is less intrusive (no recreation of configure script necessary) and
avoids a new dependency HOST_AUTOTOOLS_AUTOCONF_ARCHIVE because of this
in configure.ac:

    # This needs autoconf-archive
    AX_CXX_COMPILE_STDCXX_17([ext], [mandatory])

 rules/libgpiod.make | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/rules/libgpiod.make b/rules/libgpiod.make
index a77acf146..6272333b5 100644
--- a/rules/libgpiod.make
+++ b/rules/libgpiod.make
@@ -51,7 +51,9 @@ LIBGPIOD_CONF_OPT	:= \
 
 LIBGPIOD_CONF_ENV := \
 	$(CROSS_ENV) \
-	$(if $(PTXCONF_LIBGPIOD_PYTHON3), ac_cv_path_PYTHON=$(CROSS_PYTHON3))
+	$(if $(PTXCONF_LIBGPIOD_PYTHON3), \
+		ac_cv_path_PYTHON=$(CROSS_PYTHON3) \
+		ac_cv_prog_has_python_config=python$(PYTHON3_MAJORMINOR)-config)
 
 LIBGPIOD_LDFLAGS:= -Wl,-rpath-link,$(LIBGPIOD_DIR)/lib/.libs
 
-- 
2.43.0




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-05-30 13:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-20 12:21 [ptxdist] [PATCH] libgpiod: select HOST_SYSTEM_PYTHON3_DEV for Python bindings Markus Heidelberg via ptxdist
2025-05-25 13:50 ` Michael Olbrich
2025-05-27 11:28   ` Markus Heidelberg via ptxdist
2025-05-27 12:06     ` Michael Olbrich
2025-05-28 14:49       ` Markus Heidelberg via ptxdist
2025-05-30 13:25         ` [ptxdist] [PATCH v2] libgpiod: override location of python3-config Markus Heidelberg via ptxdist

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox