Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/libdnet: fix python build
@ 2022-12-28 22:00 Fabrice Fontaine
  2022-12-29  8:59 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2022-12-28 22:00 UTC (permalink / raw)
  To: buildroot; +Cc: Fabrice Fontaine

Fix the following build failure raised with python >= 3.11 by
backporting a patch and adding libbsd dependency as suggested by
upstream in https://github.com/ofalk/libdnet/issues/74:

./dnet.c: In function '__Pyx_AddTraceback':
./dnet.c:456:62: error: invalid use of incomplete typedef 'PyFrameObject' {aka 'struct _frame'}
  456 |   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
      |                                                              ^~
./dnet.c:25190:5: note: in expansion of macro '__Pyx_PyFrame_SetLineNumber'
25190 |     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/78dff4b514fb7c510f5a745ee6cbbc049ceb2794

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...02-Correct-path-to-string-h-from-bsd.patch | 26 +++++++++++++++++++
 package/libdnet/Config.in                     | 11 ++++++++
 package/libdnet/libdnet.mk                    |  2 +-
 3 files changed, 38 insertions(+), 1 deletion(-)
 create mode 100644 package/libdnet/0002-Correct-path-to-string-h-from-bsd.patch

diff --git a/package/libdnet/0002-Correct-path-to-string-h-from-bsd.patch b/package/libdnet/0002-Correct-path-to-string-h-from-bsd.patch
new file mode 100644
index 0000000000..2aa4f4516b
--- /dev/null
+++ b/package/libdnet/0002-Correct-path-to-string-h-from-bsd.patch
@@ -0,0 +1,26 @@
+From 347c23da1ec6f19b0b0143d53edcc209e522bbf2 Mon Sep 17 00:00:00 2001
+From: Oliver Falk <oliver@linux-kernel.at>
+Date: Wed, 29 Jun 2022 13:27:45 +0200
+Subject: [PATCH] Correct path to string.h (from bsd); Fixes #74
+
+[Retrieved (and backported) from:
+https://github.com/ofalk/libdnet/commit/347c23da1ec6f19b0b0143d53edcc209e522bbf2]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ python/dnet.c   | 64 +++++++++++++++++++++++--------------------------
+ python/dnet.pyx |  2 +-
+ 2 files changed, 31 insertions(+), 35 deletions(-)
+
+diff --git a/python/dnet.pyx b/python/dnet.pyx
+index d9cbc90..af65a11 100644
+--- a/python/dnet.pyx
++++ b/python/dnet.pyx
+@@ -40,7 +40,7 @@ cdef extern from *:
+     unsigned long htonl(unsigned long n)
+     unsigned long ntohl(unsigned long n)
+ 
+-cdef extern from "string.h":
++cdef extern from "bsd/string.h":
+     int     strlcpy(char *dst, char *src, int size)
+ 
+ cdef __memcpy(char *dst, object src, int n):
diff --git a/package/libdnet/Config.in b/package/libdnet/Config.in
index f853e4e12d..473e8aea22 100644
--- a/package/libdnet/Config.in
+++ b/package/libdnet/Config.in
@@ -10,11 +10,22 @@ if BR2_PACKAGE_LIBDNET
 
 config BR2_PACKAGE_LIBDNET_PYTHON
 	bool "libdnet python module"
+	depends on BR2_PACKAGE_LIBBSD_ARCH_SUPPORTS
 	depends on BR2_PACKAGE_PYTHON3
+	depends on !BR2_STATIC_LIBS # libbsd
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libbsd
+	depends on BR2_USE_WCHAR # libbsd
+	select BR2_PACKAGE_LIBBSD
 	help
 	  dnet module for python
 
 comment "dnet module for python requires python3 package"
+	depends on BR2_PACKAGE_LIBBSD_ARCH_SUPPORTS
 	depends on !BR2_PACKAGE_PYTHON3
 
+comment "dnet module for python needs a toolchain w/ dynamic library, threads, wchar"
+	depends on BR2_PACKAGE_LIBBSD_ARCH_SUPPORTS
+	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_USE_WCHAR
+
 endif
diff --git a/package/libdnet/libdnet.mk b/package/libdnet/libdnet.mk
index dc56b892b4..14af07e6d5 100644
--- a/package/libdnet/libdnet.mk
+++ b/package/libdnet/libdnet.mk
@@ -17,7 +17,7 @@ LIBDNET_CONFIG_SCRIPTS = dnet-config
 LIBDNET_DEPENDENCIES = host-pkgconf
 
 ifeq ($(BR2_PACKAGE_LIBDNET_PYTHON),y)
-LIBDNET_DEPENDENCIES += host-python-cython python3
+LIBDNET_DEPENDENCIES += libbsd host-python-cython python3
 LIBDNET_CONF_OPTS += --with-python=$(HOST_DIR)/bin
 LIBDNET_MAKE_ENV += $(PKG_PYTHON_DISTUTILS_ENV)
 LIBDNET_INSTALL_TARGET_OPTS = $(LIBDNET_MAKE_OPTS) DESTDIR=$(TARGET_DIR) INSTALL_STRIP_FLAG=-s install-exec
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/libdnet: fix python build
  2022-12-28 22:00 [Buildroot] [PATCH 1/1] package/libdnet: fix python build Fabrice Fontaine
@ 2022-12-29  8:59 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-12-29  8:59 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: buildroot

On Wed, 28 Dec 2022 23:00:44 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Fix the following build failure raised with python >= 3.11 by
> backporting a patch and adding libbsd dependency as suggested by
> upstream in https://github.com/ofalk/libdnet/issues/74:
> 
> ./dnet.c: In function '__Pyx_AddTraceback':
> ./dnet.c:456:62: error: invalid use of incomplete typedef 'PyFrameObject' {aka 'struct _frame'}
>   456 |   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
>       |                                                              ^~
> ./dnet.c:25190:5: note: in expansion of macro '__Pyx_PyFrame_SetLineNumber'
> 25190 |     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
>       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/78dff4b514fb7c510f5a745ee6cbbc049ceb2794
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  ...02-Correct-path-to-string-h-from-bsd.patch | 26 +++++++++++++++++++
>  package/libdnet/Config.in                     | 11 ++++++++
>  package/libdnet/libdnet.mk                    |  2 +-
>  3 files changed, 38 insertions(+), 1 deletion(-)
>  create mode 100644 package/libdnet/0002-Correct-path-to-string-h-from-bsd.patch

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-12-29  8:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-28 22:00 [Buildroot] [PATCH 1/1] package/libdnet: fix python build Fabrice Fontaine
2022-12-29  8:59 ` Thomas Petazzoni via buildroot

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