Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 546734 - net-misc/dhcpcd-6.8.1[ipv6] invalid application of 'sizeof' to incomplete type 'struct in6_pktinfo'
Summary: net-misc/dhcpcd-6.8.1[ipv6] invalid application of 'sizeof' to incomplete typ...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
: 546860 547678 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-04-16 07:57 UTC by Yannick Schaeffer
Modified: 2020-04-22 17:32 UTC (History)
15 users (show)

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


Attachments
build log (build.log,5.24 KB, text/plain)
2015-04-16 08:01 UTC, Yannick Schaeffer
Details
output of emerge --info '=net-misc/dhcpcd-6.8.1::gentoo' (emerge-info.log,17.87 KB, text/plain)
2015-04-16 08:05 UTC, Yannick Schaeffer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yannick Schaeffer 2015-04-16 07:57:16 UTC
net-misc/dhcpcd-6.8.1 does not compile with the ipv6 useflag set on my system (~amd64) it ends with the following error :
x86_64-pc-linux-gnu-gcc  -O2 -march=native -mtune=native -fomit-frame-pointer -pipe -std=c99 -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_DEFAULT_SOURCE -DINET -DINET6 -DPLUGIN_DEV -I./crypt -c dhcpcd.c -o dhcpcd.o
In file included from /usr/include/sys/socket.h:38:0,
                 from dhcpcd.c:33:
ipv6.h:211:41: error: invalid application of 'sizeof' to incomplete type 'struct in6_pktinfo'
  unsigned char sndbuf[CMSG_SPACE(sizeof(struct in6_pktinfo))];
                                         ^
ipv6.h:195:38: error: invalid application of 'sizeof' to incomplete type 'struct in6_pktinfo'
 #define IP6BUFLEN (CMSG_SPACE(sizeof(struct in6_pktinfo)) + \
                                      ^
ipv6.h:214:23: note: in expansion of macro 'IP6BUFLEN'
  unsigned char rcvbuf[IP6BUFLEN];
                       ^
Makefile:81: recipe for target 'dhcpcd.o' failed

Reproducible: Always

Steps to Reproduce:
1. emerge -uDN world
2.
3.
Actual Results:  
emerge failed

Expected Results:  
compile it
Comment 1 Yannick Schaeffer 2015-04-16 08:01:08 UTC
Created attachment 401316 [details]
build log
Comment 2 Yannick Schaeffer 2015-04-16 08:05:38 UTC
Created attachment 401318 [details]
output of emerge --info '=net-misc/dhcpcd-6.8.1::gentoo'
Comment 3 Roy Marples 2015-04-16 16:12:40 UTC
Do earlier versions compile on the same system with ipv4 set?
Comment 4 Rémi Cardona (RETIRED) gentoo-dev 2015-04-16 20:21:09 UTC
Got it too. Looks like the struct decl is hidden behind __USE_GNU which is activated by _GNU_SOURCE.
Comment 5 Roy Marples 2015-04-17 08:29:18 UTC
I can't add __GNU_SOURCE because that would conflict with __BSD_SOURCE for UDP headers. Is there another workaround? What kernel headers and glibc are you using?
Comment 6 Mike Gilbert gentoo-dev 2015-04-17 19:47:32 UTC
*** Bug 546860 has been marked as a duplicate of this bug. ***
Comment 7 Mike Gilbert gentoo-dev 2015-04-17 20:07:14 UTC
(In reply to Roy Marples from comment #5)
> I can't add __GNU_SOURCE because that would conflict with __BSD_SOURCE for
> UDP headers.

I think you are already hacking around this by defining __FAVOR_BSD in dhcp.c?

In any case, it looks like __FAVOR_BSD does nothing in netinet/udp.h since glibc-2.19.

https://sourceware.org/git/?p=glibc.git;a=commit;h=7011c2622fe3e10a29dbe74f06aaebd07710127d
Comment 8 Mike Gilbert gentoo-dev 2015-04-17 20:22:53 UTC
(In reply to Roy Marples from comment #5)
> Is there another workaround? What kernel headers and glibc are
> you using?

I'm running into this with linux-headers-4.0 and glibc-2.20-r2.

I was able to build this version of dhcpcd in the past, so it would seem that something else on my system has changed.
Comment 9 Mike Gilbert gentoo-dev 2015-04-17 20:25:14 UTC
Downgrading to linux-headers-3.19 makes dhcpcd build again.
Comment 10 Mike Gilbert gentoo-dev 2015-04-17 20:36:09 UTC
Here's the relevant commit in the kernel.

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/libc-compat.h?id=3b50d9029809b60a5081d90c282aa04d438d3ea1

Before this, linux/ipv6.h would define struct in6_pktinfo unconditionally.
Comment 12 Roy Marples 2015-04-20 08:12:53 UTC
(In reply to Mike Gilbert from comment #7)
> (In reply to Roy Marples from comment #5)
> > I can't add __GNU_SOURCE because that would conflict with __BSD_SOURCE for
> > UDP headers.
> 
> I think you are already hacking around this by defining __FAVOR_BSD in
> dhcp.c?
> 
> In any case, it looks like __FAVOR_BSD does nothing in netinet/udp.h since
> glibc-2.19.
> 
> https://sourceware.org/git/?p=glibc.git;a=commit;
> h=7011c2622fe3e10a29dbe74f06aaebd07710127d

I still get bug reports about dhcpcd not compiling on old OS's like RedHat-5, so my current hackery is going no-where.
Comment 13 Roy Marples 2015-04-20 09:11:32 UTC
I could not find a better fix - I just hope older Linux machines still work with using _GNU_SOURCE.
http://roy.marples.name/projects/dhcpcd/ci/c32714545158ca83?sbs=0
Comment 14 John Bowler 2015-04-23 15:12:22 UTC
(In reply to Roy Marples from comment #13)
> I could not find a better fix - I just hope older Linux machines still work
> with using _GNU_SOURCE.
> http://roy.marples.name/projects/dhcpcd/ci/c32714545158ca83?sbs=0

As a temporary work round on Gentoo Linux (armv7a) I added CPPFLAGS=-D_GNU_SOURCE using package.env and the build succeeded.  I.e. everything compiled with both _BSD_SOURCE and _GNU_SOURCE.  This is with the linux-4.0 headers of course.

I haven't been able to see whether the result seems to work yet, but at least my "emerge -e" is able to make progress.
Comment 15 Hank Leininger 2015-05-01 02:44:27 UTC
Note, bug #547678 appears to duplicate this one, but that one has a WORKSFORME patch attached; I suggest followers of this bug go check that one out.
Comment 16 Hank Leininger 2015-05-01 02:47:17 UTC
And now I realize this has gone full circle - the upstream maintainer, Roy Marples, is/was participating in this bug's thread, and it is his upstream patch that someone else based the fix attached to #547678 on :-P
Comment 17 Roy Marples 2015-05-01 07:25:14 UTC
(In reply to Hank Leininger from comment #16)
> the upstream maintainer, Roy Marples, is/was participating in this bug's 
> thread

Definitely is :)
A new dhcpcd release is taking a little longer than anticipated unfortunately.
Comment 18 Mike Gilbert gentoo-dev 2015-05-01 13:43:09 UTC
*** Bug 547678 has been marked as a duplicate of this bug. ***
Comment 19 Roy Marples 2015-05-03 15:39:58 UTC
Fixed in dhcpcd-6.8.2
Comment 20 SpanKY gentoo-dev 2015-05-04 02:42:33 UTC
(In reply to Roy Marples from comment #5)

assuming those are typos as there is no __GNU_SOURCE/__BSD_SOURCE defines -- they both have a single _ prefix.  hopefully you aren't using __USE_XXX defines as those are internal only.
Comment 21 Roy Marples 2015-05-04 08:05:46 UTC
(In reply to SpanKY from comment #20)
> (In reply to Roy Marples from comment #5)
> 
> assuming those are typos as there is no __GNU_SOURCE/__BSD_SOURCE defines --
> they both have a single _ prefix.

They are typo's.

>  hopefully you aren't using __USE_XXX
> defines as those are internal only.

I do abuse the internal __FAVOR_BSD macro still as I can't find a way of doing this otherwise. See below.

#define __FAVOR_BSD /* Nasty glibc hack so we can use BSD semantics for UDP */
#include <netinet/udp.h>
#undef __FAVOR_BSD
Comment 22 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2020-04-22 17:32:59 UTC
dhcpcd-6 is long gone.