diff mbox series

package/iproute2: fix musl compile errors

Message ID Zrz+JUwTsNaKI8sK@waldemar-brodkorb.de
State Accepted
Headers show
Series package/iproute2: fix musl compile errors | expand

Commit Message

Waldemar Brodkorb Aug. 14, 2024, 6:57 p.m. UTC
Add two patches to fix musl compile errors.

Fixes:
 - http://autobuild.buildroot.net/results/8d7/8d713bd911f8d6b97272a7bb5dc2c188aeb99b05
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 ...laration-of-function-htobe64-in-gcc-.patch | 43 +++++++++++++++++++
 ...laration-of-function-basename-in-gcc.patch | 30 +++++++++++++
 2 files changed, 73 insertions(+)
 create mode 100644 package/iproute2/0001-Fix-implicit-declaration-of-function-htobe64-in-gcc-.patch
 create mode 100644 package/iproute2/0002-Fix-implicit-declaration-of-function-basename-in-gcc.patch

Comments

Thomas Petazzoni Aug. 14, 2024, 8:19 p.m. UTC | #1
Hello Waldemar,

I've applied to master, but I have a couple of nitpicks, and one real
request.

On Wed, 14 Aug 2024 20:57:41 +0200
Waldemar Brodkorb <wbx@openadk.org> wrote:

> Add two patches to fix musl compile errors.
> 
> Fixes:
>  - http://autobuild.buildroot.net/results/8d7/8d713bd911f8d6b97272a7bb5dc2c188aeb99b05
                                            ^^^^ you can drop this part of the URL

Also, there should be an empty line *before* the Signed-off-by line.

> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> ---
>  ...laration-of-function-htobe64-in-gcc-.patch | 43 +++++++++++++++++++
>  ...laration-of-function-basename-in-gcc.patch | 30 +++++++++++++
>  2 files changed, 73 insertions(+)
>  create mode 100644 package/iproute2/0001-Fix-implicit-declaration-of-function-htobe64-in-gcc-.patch
>  create mode 100644 package/iproute2/0002-Fix-implicit-declaration-of-function-basename-in-gcc.patch
> +From Alpine Linux.
> +
> +Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> +Upstream: https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/iproute2/basename.patch?ref_type=heads

This really isn't an "Upstream:" URL, it's really a "downstream" thing.
Indeed, what we want to see is patches submitted to the upstream
project, so that at some point in the future, we can drop them from
Buildroot.

So could you submit this patch to the upstream iproute2 project, and
then updated the link in this patch?

"man 3 basename" says <libgen.h> should be included for get the
prototype for basename(), so it shouldn't be too difficult to convince
upstream that it's the right thing to do, and not just a musl-related
fix.

Thanks a lot!

Thomas
Waldemar Brodkorb Aug. 15, 2024, 7:22 a.m. UTC | #2
Hi Thomas,
Thomas Petazzoni wrote,

> Hello Waldemar,
> 
> I've applied to master, but I have a couple of nitpicks, and one real
> request.
> 
> On Wed, 14 Aug 2024 20:57:41 +0200
> Waldemar Brodkorb <wbx@openadk.org> wrote:
> 
> > Add two patches to fix musl compile errors.
> > 
> > Fixes:
> >  - http://autobuild.buildroot.net/results/8d7/8d713bd911f8d6b97272a7bb5dc2c188aeb99b05
>                                             ^^^^ you can drop this part of the URL
> 
> Also, there should be an empty line *before* the Signed-off-by line.
> 
> > Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> > ---
> >  ...laration-of-function-htobe64-in-gcc-.patch | 43 +++++++++++++++++++
> >  ...laration-of-function-basename-in-gcc.patch | 30 +++++++++++++
> >  2 files changed, 73 insertions(+)
> >  create mode 100644 package/iproute2/0001-Fix-implicit-declaration-of-function-htobe64-in-gcc-.patch
> >  create mode 100644 package/iproute2/0002-Fix-implicit-declaration-of-function-basename-in-gcc.patch
> > +From Alpine Linux.
> > +
> > +Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> > +Upstream: https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/iproute2/basename.patch?ref_type=heads
> 
> This really isn't an "Upstream:" URL, it's really a "downstream" thing.
> Indeed, what we want to see is patches submitted to the upstream
> project, so that at some point in the future, we can drop them from
> Buildroot.
> 
> So could you submit this patch to the upstream iproute2 project, and
> then updated the link in this patch?
> 
> "man 3 basename" says <libgen.h> should be included for get the
> prototype for basename(), so it shouldn't be too difficult to convince
> upstream that it's the right thing to do, and not just a musl-related
> fix.
> 
> Thanks a lot!

It seems the Gentoo People already reported it upstream:
https://marc.info/?l=linux-netdev&w=2&r=1&s=musl&q=b

Would you like to update to this link or wait until the commits are
upstream in git?

best regards
 Waldemar
Thomas Petazzoni Aug. 15, 2024, 8:07 a.m. UTC | #3
Hello Waldemar,

On Thu, 15 Aug 2024 09:22:59 +0200
Waldemar Brodkorb <wbx@openadk.org> wrote:

> It seems the Gentoo People already reported it upstream:
> https://marc.info/?l=linux-netdev&w=2&r=1&s=musl&q=b
> 
> Would you like to update to this link or wait until the commits are
> upstream in git?

The link above is not very relevant, as it's a list of many e-mails.
The relevant link is:

  https://marc.info/?l=linux-netdev&m=172278781323421&w=2

It is totally fine to use this link indeed for the Upstream: tag.
Basically, for the Upstream: tag we use what's available at the time we
add the patch in Buildroot: a link to the upstream commit if it's
already upstream, or a link to the mailing list, PR or issue ticket if
it's still pending upstream.

Thanks!

Thomas
diff mbox series

Patch

diff --git a/package/iproute2/0001-Fix-implicit-declaration-of-function-htobe64-in-gcc-.patch b/package/iproute2/0001-Fix-implicit-declaration-of-function-htobe64-in-gcc-.patch
new file mode 100644
index 0000000000..318701e725
--- /dev/null
+++ b/package/iproute2/0001-Fix-implicit-declaration-of-function-htobe64-in-gcc-.patch
@@ -0,0 +1,43 @@ 
+From ea78477cba25b50e7f63f02635e6870d72dcf68e Mon Sep 17 00:00:00 2001
+From: Waldemar Brodkorb <wbx@openadk.org>
+Date: Wed, 14 Aug 2024 19:10:09 +0200
+Subject: [PATCH] Fix implicit declaration of function 'htobe64' in gcc 14 on
+ musl systems
+
+On musl systems with GCC 14 and above, the htobe64 function cannot be
+found by default. From the man page[0], the function is from endian.h
+header file. If the file is not included in, then we get the following
+error message. The issue however cannot be reproduced on glibc systems.
+
+In file included from ../include/libgenl.h:5,
+                 from libgenl.c:12:
+../include/libnetlink.h: In function 'rta_getattr_be64':
+../include/libnetlink.h:281:16: error: implicit declaration of function 'htobe64' [-Wimplicit-function-declaration]
+  281 |         return htobe64(rta_getattr_u64(rta));
+      |                ^~~~~~~
+make[1]: *** [../config.include:24: libgenl.o] Error 1
+
+[0]: https://linux.die.net/man/3/htobe64
+
+Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+Upstream: https://lore.kernel.org/netdev/20240514084335.19f5b280@hermes.local/T/
+---
+ include/libnetlink.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/libnetlink.h b/include/libnetlink.h
+index 30f0c2d2..77e81815 100644
+--- a/include/libnetlink.h
++++ b/include/libnetlink.h
+@@ -12,6 +12,7 @@
+ #include <linux/neighbour.h>
+ #include <linux/netconf.h>
+ #include <arpa/inet.h>
++#include <endian.h>
+ 
+ struct rtnl_handle {
+ 	int			fd;
+-- 
+2.39.2
+
diff --git a/package/iproute2/0002-Fix-implicit-declaration-of-function-basename-in-gcc.patch b/package/iproute2/0002-Fix-implicit-declaration-of-function-basename-in-gcc.patch
new file mode 100644
index 0000000000..e898ee3a79
--- /dev/null
+++ b/package/iproute2/0002-Fix-implicit-declaration-of-function-basename-in-gcc.patch
@@ -0,0 +1,30 @@ 
+From 482b7362dedc57d0c9783bd83084919ccaa79e77 Mon Sep 17 00:00:00 2001
+From: Waldemar Brodkorb <wbx@openadk.org>
+Date: Wed, 14 Aug 2024 19:43:44 +0200
+Subject: [PATCH] Fix implicit declaration of function basename in gcc-14.x
+
+From Alpine Linux.
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+Upstream: https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/iproute2/basename.patch?ref_type=heads
+---
+ rdma/rdma.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/rdma/rdma.c b/rdma/rdma.c
+index 131c6b2a..1e7db382 100644
+--- a/rdma/rdma.c
++++ b/rdma/rdma.c
+@@ -8,6 +8,9 @@
+ #include "version.h"
+ #include "color.h"
+ 
++/* For basename(3) prototype */
++#include <libgen.h>
++
+ /* Global utils flags */
+ int json;
+ 
+-- 
+2.39.2
+