Skip to contentSkip to conversation

python3-netifaces: Fix build with python3 and musl

PATCH New Khem Raj 1 participant 7 messages Aug 29, 2022

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/7 python3-netifaces: Fix build with python3 and musl

---
 ...-initialize-msghdr-in-a-portable-way.patch | 49 +++++++++++++++++++
 .../python/python3-netifaces_0.11.0.bb        |  6 ++-
 2 files changed, 53 insertions(+), 2 deletions(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-netifaces/0001-netifaces-initialize-msghdr-in-a-portable-way.patch
meta-python/recipes-devtools/python/python3-netifaces/0001-netifaces-initialize-msghdr-in-a-portable-way.patch new file +49 -0
new file mode 100644
index 0000000000..7ff86cc8be
@@ -0,0 +1,49 @@
+From cbcd19f38ae4b31c57c57ce3619b8d2674defb68 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sun, 28 Aug 2022 08:11:27 -0700
+Subject: [PATCH] netifaces: initialize msghdr in a portable way
+
+musl has padding bytes inside the msghdr struct which means initializing
+full structure will cause wrong assignments, doing partial assignment is
+more portable and assign the elements after that
+
+Fixes
+netifaces.c:1808:9: error: incompatible pointer to integer conversion initializing 'int' with an expression of type 'void *' [-Wint-conversion]
+        NULL,
+        ^~~~
+
+Upstream-Status: Inappropriate [Upstream Repo is read-only]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ netifaces.c | 15 ++++++---------
+ 1 file changed, 6 insertions(+), 9 deletions(-)
+
+diff --git a/netifaces.c b/netifaces.c
+index 839c42c..7da78e7 100644
+--- a/netifaces.c
++++ b/netifaces.c
+@@ -1800,15 +1800,12 @@ gateways (PyObject *self)
+     do {
+       struct sockaddr_nl sanl_from;
+       struct iovec iov = { msgbuf, bufsize };
+-      struct msghdr msghdr = {
+-        &sanl_from,
+-        sizeof(sanl_from),
+-        &iov,
+-        1,
+-        NULL,
+-        0,
+-        0
+-      };
++      struct msghdr msghdr = { 0 };
++
++      msghdr.msg_name = &sanl_from;
++      msghdr.msg_namelen = sizeof(sanl_from);
++      msghdr.msg_iov = &iov;
++      msghdr.msg_iovlen = 1;
+       int nllen;
+ 
+       ret = recvmsg (s, &msghdr, 0);
+-- 
+2.37.2
+
meta-python/recipes-devtools/python/python3-netifaces_0.11.0.bb +4 -2
index 09e54b0baa..f211c69543 100644
@@ -4,6 +4,8 @@ SECTION = "devel/python"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://PKG-INFO;beginline=8;endline=8;md5=a53cbc7cb75660694e138ba973c148df"
 
-SRC_URI[sha256sum] = "043a79146eb2907edf439899f262b3dfe41717d34124298ed281139a8b93ca32"
-
 inherit pypi setuptools3
+
+SRC_URI += "file://0001-netifaces-initialize-msghdr-in-a-portable-way.patch"
+
+SRC_URI[sha256sum] = "043a79146eb2907edf439899f262b3dfe41717d34124298ed281139a8b93ca32"
Signature · 1 line
2.37.2
author
#1 lore raw

PATCH 2/7 python3-pyephem: Fix build with python3 and musl

---
 .../0001-Don-t-set-tp_print-on-Python-3.patch | 44 +++++++++++++++++++
 .../python-pyephem/python3-pyephem_4.1.3.bb   |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 meta-python/recipes-extended/python-pyephem/python3-pyephem/0001-Don-t-set-tp_print-on-Python-3.patch
meta-python/recipes-extended/python-pyephem/python3-pyephem/0001-Don-t-set-tp_print-on-Python-3.patch new file +44 -0
new file mode 100644
index 0000000000..a84d852fb0
@@ -0,0 +1,44 @@
+From 866f7560034e8b7a604432611b3cb2c92e76def9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sun, 28 Aug 2022 11:03:39 -0700
+Subject: [PATCH] Don't set tp_print on Python 3.
+
+In 3.8 it produces a compilation warning, in earlier versions it is ignored.
+
+Upstream-Status: Submitted [https://github.com/brandon-rhodes/pyephem/pull/245]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ extensions/_libastro.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/extensions/_libastro.c b/extensions/_libastro.c
+index ce07d93..c9ef1e6 100644
+--- a/extensions/_libastro.c
++++ b/extensions/_libastro.c
+@@ -372,7 +372,11 @@ static PyTypeObject AngleType = {
+      sizeof(AngleObject),
+      0,
+      0,				/* tp_dealloc */
++#if PY_MAJOR_VERSION < 3
+      Angle_print,		/* tp_print */
++#else
++     0,				/* reserved in 3.x */
++#endif
+      0,				/* tp_getattr */
+      0,				/* tp_setattr */
+      0,				/* tp_compare */
+@@ -669,7 +673,11 @@ static PyTypeObject DateType = {
+      sizeof(PyFloatObject),
+      0,
+      0,				/* tp_dealloc */
++#if PY_MAJOR_VERSION < 3
+      Date_print,		/* tp_print */
++#else
++     0,				/* tp_print slot is reserved and unused in Python 3 */
++#endif
+      0,				/* tp_getattr */
+      0,				/* tp_setattr */
+      0,				/* tp_compare */
+-- 
+2.37.2
+
meta-python/recipes-extended/python-pyephem/python3-pyephem_4.1.3.bb +1 -0
index 29697bc251..8c4f0eb405 100644
@@ -4,6 +4,7 @@ HOMEPAGE = "http://rhodesmill.org/pyephem/"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=9c930b395b435b00bb13ec83b0c99f40"
 
+SRC_URI += "file://0001-Don-t-set-tp_print-on-Python-3.patch"
 SRC_URI[sha256sum] = "7fa18685981ba528edd504052a9d5212a09aa5bf15c11a734edc6a86e8a8b56a"
 
 PYPI_PACKAGE = "ephem"
Signature · 1 line
2.37.2
author
#2 lore raw

PATCH 3/7 samba: Fix warnings in configure tests for rpath checks

In reply to Khem Raj

Add a patch to avoid implicit-function-declaration warnings, they will soon become errors with clang 15+

set path for privatelibdir

---
 ...ith-Werror-implicit-function-declara.patch | 32 +++++++++++++++++++
 .../samba/samba_4.14.14.bb                    |  3 ++
 2 files changed, 35 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/0001-waf-Fix-errors-with-Werror-implicit-function-declara.patch
meta-networking/recipes-connectivity/samba/samba/0001-waf-Fix-errors-with-Werror-implicit-function-declara.patch new file +32 -0
new file mode 100644
index 0000000000..4a89f76782
@@ -0,0 +1,32 @@
+From 28ec4c9323e67cd114a0465015c9f3c2e64e6829 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 27 Aug 2022 13:05:26 -0700
+Subject: [PATCH] waf: Fix errors with Werror=implicit-function-declaration
+ turned on
+
+Clang-15 turns this option into errors by default, and it results in
+rpath check failures
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ buildtools/wafsamba/samba_waf18.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/buildtools/wafsamba/samba_waf18.py b/buildtools/wafsamba/samba_waf18.py
+index 7a0a08e..c0d2c3e 100644
+--- a/buildtools/wafsamba/samba_waf18.py
++++ b/buildtools/wafsamba/samba_waf18.py
+@@ -209,7 +209,7 @@ def CHECK_LIBRARY_SUPPORT(conf, rpath=False, version_script=False, msg=None):
+         lib_node.parent.mkdir()
+         lib_node.write('int lib_func(void) { return 42; }\n', 'w')
+         main_node = bld.srcnode.make_node('main.c')
+-        main_node.write('int main(void) {return !(lib_func() == 42);}', 'w')
++        main_node.write('int lib_func(void); int main(void) {return !(lib_func() == 42);}', 'w')
+         linkflags = []
+         if version_script:
+             script = bld.srcnode.make_node('ldscript')
+-- 
+2.37.2
+
meta-networking/recipes-connectivity/samba/samba_4.14.14.bb +3 -0
index 53526a26b6..f88dee6175 100644
@@ -22,6 +22,7 @@ SRC_URI = "${SAMBA_MIRROR}/stable/samba-${PV}.tar.gz \
            file://0005-samba-build-dnsserver_common-code.patch \
            file://0001-Fix-pyext_PATTERN-for-cross-compilation.patch \
            file://0001-smbtorture-skip-test-case-tfork_cmd_send.patch \
+           file://0001-waf-Fix-errors-with-Werror-implicit-function-declara.patch \
            "
 
 SRC_URI:append:libc-musl = " \
@@ -113,9 +114,11 @@ EXTRA_OECONF += "--enable-fhs \
                  --with-piddir=/run \
                  --with-sockets-dir=/run/samba \
                  --with-modulesdir=${libdir}/samba \
+                 --with-privatelibdir=${libdir}/samba \
                  --with-lockdir=${localstatedir}/lib/samba \
                  --with-cachedir=${localstatedir}/lib/samba \
                  --disable-rpath-install \
+                 --disable-rpath \
                  --with-shared-modules=${SAMBA4_MODULES} \
                  --bundled-libraries=${SAMBA4_LIBS} \
                  ${@oe.utils.conditional('TARGET_ARCH', 'x86_64', '', '--disable-glusterfs', d)} \
Signature · 1 line
2.37.2
author
#3 lore raw

PATCH 4/7 lirc: Fix build on musl

In reply to Khem Raj
---
 .../lirc/0001-mplay-Fix-build-with-musl.patch | 44 +++++++++++++++++++
 .../recipes-connectivity/lirc/lirc_0.10.1.bb  |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/0001-mplay-Fix-build-with-musl.patch
meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/0001-mplay-Fix-build-with-musl.patch new file +44 -0
new file mode 100644
index 0000000000..48cf7a355c
@@ -0,0 +1,44 @@
+From e9e9027d7a324e1ce5e0cb06d4eb51847262a09d Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sun, 28 Aug 2022 12:26:52 -0700
+Subject: [PATCH] mplay: Fix build with musl
+
+pthread_t is an opaque type, therefore typecast it to avoid warnings on
+musl
+
+Fixes
+mplay.c:200:12: error: incompatible integer to pointer conversion initializing 'pthread_t' (aka 'struct __pthread *') with an expression of type 'int' [-Wint-conversion]
+|         .tid                            = -1
+|                                           ^~
+
+Upstream-Status: Submitted [https://sourceforge.net/p/lirc/git/merge-requests/47/]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ plugins/mplay.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/plugins/mplay.c b/plugins/mplay.c
+index d6d9619..5b9eb4b 100644
+--- a/plugins/mplay.c
++++ b/plugins/mplay.c
+@@ -197,7 +197,7 @@ static struct {
+ 	.latest_button			= MPLAY_CODE_ERROR,
+ 	.fd				= -1,
+ 	.pipefd				= { -1,	     -1	  },
+-	.tid				= -1
++	.tid				= (pthread_t)-1
+ };
+ 
+ /**
+@@ -788,7 +788,7 @@ int mplayfamily_deinit(void)
+ 			return 0;
+ 		}
+ 		pthread_join(mplayfamily_local_data.tid, NULL);
+-		mplayfamily_local_data.tid = -1;
++		mplayfamily_local_data.tid = (pthread_t)-1;
+ 	}
+ 	if (mplayfamily_local_data.pipefd[0] != -1) {
+ 		close(mplayfamily_local_data.pipefd[0]);
+-- 
+2.37.2
+
meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.1.bb +1 -0
index fe9685924b..467e10b658 100644
@@ -13,6 +13,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 SRC_URI = "http://prdownloads.sourceforge.net/lirc/lirc-${PV}.tar.bz2 \
     file://0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch \
     file://fix_build_errors.patch \
+    file://0001-mplay-Fix-build-with-musl.patch \
     file://lircd.service \
     file://lircd.init \
     file://lircexec.init \
Signature · 1 line
2.37.2
author
#4 lore raw

PATCH 5/7 mongodb: Fix boost build with clang-15

In reply to Khem Raj
---
 ...y-binary_function-base-classes-are-d.patch | 40 +++++++++++++++++++
 .../recipes-dbs/mongodb/mongodb_git.bb        |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-The-std-lib-unary-binary_function-base-classes-are-d.patch
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-The-std-lib-unary-binary_function-base-classes-are-d.patch new file +40 -0
new file mode 100644
index 0000000000..4594bec81a
@@ -0,0 +1,40 @@
+From f9b55f5a1fab85bf73c95e6372779d6f50f75e84 Mon Sep 17 00:00:00 2001
+From: jzmaddock <[email protected]>
+Date: Mon, 11 Jul 2022 18:26:07 +0100
+Subject: [PATCH] The std lib unary/binary_function base classes are
+ deprecated/removed from libcpp15. Fixes
+ https://github.com/boostorg/container_hash/issues/24.
+
+Upstream-Status: Backport [https://github.com/boostorg/config/pull/440/commits/f0af4a9184457939b89110795ae2d293582c5f66]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/third_party/boost-1.70.0/boost/config/stdlib/libcpp.hpp | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+--- a/src/third_party/boost-1.70.0/boost/config/stdlib/libcpp.hpp
++++ b/src/third_party/boost-1.70.0/boost/config/stdlib/libcpp.hpp
+@@ -140,4 +140,13 @@
+ #  define BOOST_NO_CXX14_HDR_SHARED_MUTEX
+ #endif
+ 
++#if _LIBCPP_VERSION >= 15000
++//
++// Unary function is now deprecated in C++11 and later:
++//
++#if __cplusplus >= 201103L
++#define BOOST_NO_CXX98_FUNCTION_BASE
++#endif
++#endif
++
+ //  --- end ---
+--- a/src/third_party/boost-1.70.0/boost/container_hash/hash.hpp
++++ b/src/third_party/boost-1.70.0/boost/container_hash/hash.hpp
+@@ -118,7 +118,7 @@ namespace boost
+ {
+     namespace hash_detail
+     {
+-#if defined(_HAS_AUTO_PTR_ETC) && !_HAS_AUTO_PTR_ETC
++#if defined(BOOST_NO_CXX98_FUNCTION_BASE)
+         template <typename T>
+         struct hash_base
+         {
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +1 -0
index ff4a16e9f2..d040ab160b 100644
@@ -32,6 +32,7 @@ SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4;protocol=https \
            file://PTHREAD_STACK_MIN.patch \
            file://0001-add-explict-static_cast-size_t-to-maxMemoryUsageByte.patch \
            file://0001-server-Adjust-the-cache-alignment-assumptions.patch \
+           file://0001-The-std-lib-unary-binary_function-base-classes-are-d.patch \
            "
 SRC_URI:append:libc-musl ="\
            file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
Signature · 1 line
2.37.2
author
#5 lore raw

PATCH 6/7 crda: Fix build with clang-15

In reply to Khem Raj
---
 .../0001-reglib-Remove-unused-variables.patch | 59 +++++++++++++++++++
 .../recipes-connectivity/crda/crda_3.18.bb    |  1 +
 2 files changed, 60 insertions(+)
 create mode 100644 meta-networking/dynamic-layers/meta-python/recipes-connectivity/crda/crda/0001-reglib-Remove-unused-variables.patch
meta-networking/dynamic-layers/meta-python/recipes-connectivity/crda/crda/0001-reglib-Remove-unused-variables.patch new file +59 -0
new file mode 100644
index 0000000000..c6c3c53f19
@@ -0,0 +1,59 @@
+From 1bd6ff9d10c83afbc9954fc38b953e9167e6d4a9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sun, 28 Aug 2022 14:01:55 -0700
+Subject: [PATCH] reglib: Remove unused variables
+
+These counters are not used anywhere therefore delete them
+Fixes
+reglib.c:1015:15: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
+        unsigned int i = 0;
+                     ^
+reglib.c:1062:15: error: variable 'lines' set but not used [-Werror,-Wunused-but-set-variable]
+        unsigned int lines = 0;
+                     ^
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ reglib.c | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/reglib.c b/reglib.c
+index 8565a0b..6c62c2c 100644
+--- a/reglib.c
++++ b/reglib.c
+@@ -1012,7 +1012,6 @@ static int reglib_find_next_country_stream(FILE *fp)
+ {
+ 	fpos_t prev_pos;
+ 	int r;
+-	unsigned int i = 0;
+ 
+ 	while(1) {
+ 		char line[1024];
+@@ -1030,7 +1029,6 @@ static int reglib_find_next_country_stream(FILE *fp)
+ 		line_p = fgets(line, sizeof(line), fp);
+ 		if (line_p == line) {
+ 			if (strspn(line, "\n") == strlen(line)) {
+-				i++;
+ 				continue;
+ 			}
+ 			if (strncmp(line, "country", 7) != 0)
+@@ -1059,7 +1057,6 @@ struct ieee80211_regdomain *reglib_parse_country(FILE *fp)
+ 
+ FILE *reglib_create_parse_stream(FILE *f)
+ {
+-	unsigned int lines = 0;
+ 	FILE *fp;
+ 
+ 	fp = tmpfile();
+@@ -1076,7 +1073,6 @@ FILE *reglib_create_parse_stream(FILE *f)
+ 		if (line_p == line) {
+ 			if (strchr(line, '#') == NULL) {
+ 				fputs(line, fp);
+-				lines++;
+ 			}
+ 			continue;
+ 		} else
+-- 
+2.37.2
+
meta-networking/dynamic-layers/meta-python/recipes-connectivity/crda/crda_3.18.bb +1 -0
index a616557e7c..2f4d4dac99 100644
@@ -16,6 +16,7 @@ SRC_URI = "https://www.kernel.org/pub/software/network/${BPN}/${BP}.tar.xz \
            file://fix-issues-when-USE_OPENSSL-1.patch \
            file://crda-4.14-python-3.patch \
            file://0001-Make-alpha2-to-be-3-characters-long.patch \
+           file://0001-reglib-Remove-unused-variables.patch \
 "
 SRC_URI[md5sum] = "0431fef3067bf503dfb464069f06163a"
 SRC_URI[sha256sum] = "43fcb9679f8b75ed87ad10944a506292def13e4afb194afa7aa921b01e8ecdbf"
Signature · 1 line
2.37.2
author
#6 lore raw

PATCH 7/7 monkey: Fix build with musl

In reply to Khem Raj
---
 ...alue-instead-of-address-of-sin6_port.patch | 30 +++++++++++++++++++
 .../recipes-httpd/monkey/monkey_1.6.9.bb      |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 meta-webserver/recipes-httpd/monkey/files/0001-fastcgi-Use-value-instead-of-address-of-sin6_port.patch
meta-webserver/recipes-httpd/monkey/files/0001-fastcgi-Use-value-instead-of-address-of-sin6_port.patch new file +30 -0
new file mode 100644
index 0000000000..f4bab49aa7
@@ -0,0 +1,30 @@
+From 7f724bbafbb1e170401dd5de201273ab8c8bc75f Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sun, 28 Aug 2022 14:24:02 -0700
+Subject: [PATCH] fastcgi: Use value instead of address of sin6_port
+
+This seems to be wrongly assigned where ipv4 sin_port is
+equated to address of sin6_port and not value of sin6_port
+
+Upstream-Status: Submitted [https://github.com/monkey/monkey/pull/375]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ plugins/fastcgi/fcgi_handler.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/plugins/fastcgi/fcgi_handler.c b/plugins/fastcgi/fcgi_handler.c
+index 9e095e3c..e8e1eec1 100644
+--- a/plugins/fastcgi/fcgi_handler.c
++++ b/plugins/fastcgi/fcgi_handler.c
+@@ -245,7 +245,7 @@ static inline int fcgi_add_param_net(struct fcgi_handler *handler)
+             struct sockaddr_in *s4 = (struct sockaddr_in *)&addr4;   
+             memset(&addr4, 0, sizeof(addr4));
+             addr4.sin_family = AF_INET;
+-            addr4.sin_port = &s->sin6_port;
++            addr4.sin_port = s->sin6_port;
+             memcpy(&addr4.sin_addr.s_addr, 
+                    s->sin6_addr.s6_addr + 12, 
+                    sizeof(addr4.sin_addr.s_addr));
+-- 
+2.37.2
+
meta-webserver/recipes-httpd/monkey/monkey_1.6.9.bb +1 -0
index fff406a3f2..5b7e32733c 100644
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=2ee41112a44fe7014dce33e26468ba93"
 SECTION = "net"
 
 SRC_URI = "http://monkey-project.com/releases/1.6/monkey-${PV}.tar.gz \
+           file://0001-fastcgi-Use-value-instead-of-address-of-sin6_port.patch \
            file://monkey.service \
            file://monkey.init"
 
Signature · 1 line
2.37.2