Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 939811 - sys-apps/iproute2-6.11.0: error: redefinition of 'in6_addr' [musl]
Summary: sys-apps/iproute2-6.11.0: error: redefinition of 'in6_addr' [musl]
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PATCH, PullRequest
Depends on:
Blocks:
 
Reported: 2024-09-18 10:36 UTC by misile
Modified: 2024-09-24 06:06 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
log of iproute2 emerge (emerge-log.txt,191.13 KB, text/plain)
2024-09-18 10:36 UTC, misile
Details
emerge --info's output (emerge-info.txt,6.09 KB, text/plain)
2024-09-18 10:37 UTC, misile
Details
Fix build of 6.11 on musl (6.11-build-fixes.patch,1.02 KB, patch)
2024-09-19 09:14 UTC, Holger Hoffstätte
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description misile 2024-09-18 10:36:41 UTC
Created attachment 903250 [details]
log of iproute2 emerge

error:
```
make[1]: Entering directory '/var/tmp/portage/sys-apps/iproute2-6.11.0/work/iproute2-6.11.0/bridge'
clang -Wall -Wstrict-prototypes  -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wformat=2 -O2 -march=native -pipe  -pipe -I../include -I../include/uapi -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONF_USR_DIR=\"/usr/share/iproute2\" -DCONF_ETC_DIR=\"/etc/iproute2\" -DNETNS_RUN_DIR=\"/run/netns\" -DNETNS_ETC_DIR=\"/etc/netns\" -DARPDDIR=\"/var/lib/arpd\" -DCONF_COLOR=COLOR_OPT_AUTO -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -O2 -march=native -pipe -DHAVE_HANDLE_AT -DHAVE_HANDLE_AT -DHAVE_SETNS -DHAVE_SETNS -DHAVE_LIBMNL  -DHAVE_LIBMNL    -c -o mst.o mst.c
In file included from mst.c:10:
In file included from ../include/libnetlink.h:15:
In file included from /usr/include/arpa/inet.h:9:
/usr/include/netinet/in.h:23:8: error: redefinition of 'in6_addr'
   23 | struct in6_addr {
      |        ^
../include/uapi/linux/in6.h:33:8: note: previous definition is here
   33 | struct in6_addr {
      |        ^
In file included from mst.c:10:
In file included from ../include/libnetlink.h:15:
In file included from /usr/include/arpa/inet.h:9:
/usr/include/netinet/in.h:34:8: error: redefinition of 'sockaddr_in6'
   34 | struct sockaddr_in6 {
      |        ^
../include/uapi/linux/in6.h:50:8: note: previous definition is here
   50 | struct sockaddr_in6 {
      |        ^
In file included from mst.c:10:
In file included from ../include/libnetlink.h:15:
In file included from /usr/include/arpa/inet.h:9:
/usr/include/netinet/in.h:42:8: error: redefinition of 'ipv6_mreq'
   42 | struct ipv6_mreq {
      |        ^
../include/uapi/linux/in6.h:60:8: note: previous definition is here
   60 | struct ipv6_mreq {
      |        ^
In file included from mst.c:11:
../include/json_print.h:80:30: warning: declaration of 'struct timeval' will not be visible outside of this function [-Wvisibility]
   80 | _PRINT_FUNC(tv, const struct timeval *)
      |                              ^
../include/json_print.h:80:30: warning: declaration of 'struct timeval' will not be visible outside of this function [-Wvisibility]
../include/json_print.h:80:1: warning: incompatible pointer types passing 'const struct timeval *' to parameter of type 'const struct timeval *' [-Wincompatible-pointer-types]
   80 | _PRINT_FUNC(tv, const struct timeval *)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/json_print.h:58:13: note: expanded from macro '_PRINT_FUNC'
   58 |                                                value);                  \
      |                                                ^~~~~
../include/json_print.h:80:1: note: passing argument to parameter 'value' here
../include/json_print.h:50:14: note: expanded from macro '_PRINT_FUNC'
   50 |                                     type value);                        \
      |                                          ^
mst.c:215:13: warning: result of comparison of constant -1 with expression of type '__u8' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
  215 |                 if (state == -1) {
      |                     ~~~~~ ^  ~~
4 warnings and 3 errors generated.
make[1]: *** [../config.include:24: mst.o] Error 1
```
fastfetch
```
         -/oyddmdhs+:.                 misile@srt
     -odNMMMMMMMMNNmhy+-`              ----------
   -yNMMMMMMMMMMMNNNmmdhy+-            OS: Gentoo 2.15 x86_64
 `omMMMMMMMMMMMMNmdmmmmddhhy/`         Host: KVM/QEMU Standard PC (Q35 + ICH9, 2009) (pc-q35-9.0)
 omMMMMMMMMMMMNhhyyyohmdddhhhdo`       Kernel: Linux 6.11.0-gentoo-veritas
.ydMMMMMMMMMMdhs++so/smdddhhhhdm+`     Uptime: 2 days, 2 hours, 47 mins
 oyhdmNMMMMMMMNdyooydmddddhhhhyhNd.    Packages: 493 (emerge)
  :oyhhdNNMMMMMMMNNNmmdddhhhhhyymMh    Shell: bash 5.2.32
    .:+sydNMMMMMNNNmmmdddhhhhhhmMmy    Display (QEMU Monitor): 1280x800 @ 75 Hz in 15″
       /mMMMMMMNNNmmmdddhhhhhmMNhs:    Terminal: topgrade
    `oNMMMMMMMNNNmmmddddhhdmMNhs+`     CPU: Intel(R) Xeon(R) E5-2670 v3 (24) @ 2.29 GHz
  `sNMMMMMMMMNNNmmmdddddmNMmhs/.       GPU: RedHat Virtio 1.0 GPU
 /NMMMMMMMMNNNNmmmdddmNMNdso:`         Memory: 6.21 GiB / 47.02 GiB (13%)
+MMMMMMMNNNNNmmmmdmNMNdso/-            Swap: 0 B / 16.00 GiB (0%)
yMMNNNNNNNmmmmmNNMmhs+/-`              Disk (/): 30.19 GiB / 83.00 GiB (36%) - btrfs
/hMMNNNNNNNNMNdhs++/-`                 Local IP (enp6s18): 192.168.0.150/24
`/ohdmmddhys+++/:.`                    Locale: C.UTF-8
  `-//////:--.
```
Comment 1 misile 2024-09-18 10:37:17 UTC
Created attachment 903251 [details]
emerge --info's output
Comment 2 Holger Hoffstätte 2024-09-19 08:44:06 UTC
This should all be reported to upstream.

In bridge/mst.c there is:

--
#include <stdio.h>
#include <linux/if_bridge.h>
#include <net/if.h>

#include "libnetlink.h"
#include "json_print.h"
#include "utils.h"

#include "br_common.h"
--

and moving the two <linux/if_bridge.h> & <net/if.h> includes *after* the libnetlink.h include fixes the duplicate in6_addr problem.

The error about print_color_tv "expected 'const struct timeval *' but argument is of type 'const struct timeval *'" (groan) is clearly a bug in their _PRINT_FUNC macro declaration.
Comment 3 Holger Hoffstätte 2024-09-19 08:54:25 UTC
The _PRINT_FUNC thing can be avoided by declaring the struct up front.

In include/json_print.h add a

const struct timeval;

before

_PRINT_FUNC(tv, const struct timeval *)

and it will build.
Comment 4 Holger Hoffstätte 2024-09-19 09:14:49 UTC
Created attachment 903332 [details, diff]
Fix build of 6.11 on musl

Patch to make 6.11 build on both musl and glibc.
Comment 5 immolo 2024-09-21 04:07:40 UTC
Confirmed this resolves the issue, thanks!

Would you mind upstreaming please?

Also, do we want to cherry pick this in the meantime as releng are going to get failed musl builds on all stages that use ~arch?
Comment 6 Holger Hoffstätte 2024-09-22 15:25:39 UTC
Just for the record: the "const" qualifier for the timeval declaration should be dropped, otherwise it just generates lots of "empty declaration with type qualifier does not redeclare tag" warnings.
Comment 7 Holger Hoffstätte 2024-09-22 15:45:21 UTC
And of course just one minute before I post to netdev someone already sent their patches (which are even slightly better):
https://lore.kernel.org/netdev/20240922145011.2104040-1-dario.binacchi@amarulasolutions.com/
Comment 8 Larry the Git Cow gentoo-dev 2024-09-24 06:06:09 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c30544fbe5db966812c5309dd083b5367006475d

commit c30544fbe5db966812c5309dd083b5367006475d
Author:     Ian Jordan <immoloism@gmail.com>
AuthorDate: 2024-09-21 04:51:19 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-09-24 06:04:46 +0000

    sys-apps/iproute2: musl fixes
    
    Cherry picking Holger's patch to prevent releng from having musl stage fails
    until this is upstreamed on any arch that is ~ARCH only.
    
    Closes: https://bugs.gentoo.org/939811
    Co-authored-by: Holger Hoffstätte <holger@applied-asynchrony.com>
    Signed-off-by: Ian Jordan <immoloism@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 .../files/iproute2-6.11.0-musl-fixes.patch         |  35 ++++
 sys-apps/iproute2/iproute2-6.11.0-r1.ebuild        | 215 +++++++++++++++++++++
 2 files changed, 250 insertions(+)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0d19b4dc3d32cbd8631068b7721c3bee92bacdb

commit d0d19b4dc3d32cbd8631068b7721c3bee92bacdb
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-09-24 06:05:09 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-09-24 06:05:09 +0000

    sys-apps/iproute2: drop unnecessary const from forward typedecl in musl patch
    
    See Holger's comment at https://github.com/gentoo/gentoo/pull/38710#issuecomment-2366830999.
    
    Bug: https://bugs.gentoo.org/939811
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/iproute2/files/iproute2-6.11.0-musl-fixes.patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)