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
Created attachment 401316 [details] build log
Created attachment 401318 [details] output of emerge --info '=net-misc/dhcpcd-6.8.1::gentoo'
Do earlier versions compile on the same system with ipv4 set?
Got it too. Looks like the struct decl is hidden behind __USE_GNU which is activated by _GNU_SOURCE.
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?
*** Bug 546860 has been marked as a duplicate of this bug. ***
(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
(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.
Downgrading to linux-headers-3.19 makes dhcpcd build again.
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.
Sorry, here's a better link. http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=3b50d9029809b60a5081d90c282aa04d438d3ea1
(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.
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
(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.
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.
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
(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.
*** Bug 547678 has been marked as a duplicate of this bug. ***
Fixed in dhcpcd-6.8.2
(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.
(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
dhcpcd-6 is long gone.