Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 466932 - net-misc/dhcpcd-5.6.7 - Fails to build due to defining _unused on ppc.
Summary: net-misc/dhcpcd-5.6.7 - Fails to build due to defining _unused on ppc.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC64 Linux
: Normal normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-23 21:49 UTC by marty rosenberg
Modified: 2014-01-06 16:22 UTC (History)
2 users (show)

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


Attachments
fulll output of make -k (buildlog.txt,7.33 KB, text/plain)
2013-05-21 15:09 UTC, marty rosenberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description marty rosenberg 2013-04-23 21:49:12 UTC
dhcpcd has the following defines in common.h:
#if __GNUC__ > 2 || defined(__INTEL_COMPILER)
# define _noreturn __attribute__((__noreturn__))
# define _packed   __attribute__((__packed__))
# define _unused   __attribute__((__unused__))
#else        
# define _noreturn
# define _packed
# define _unused
#endif

this is a problem because on ppc, sigcontext is declared as: (with linux-headers-3.7)
struct sigcontext {
        unsigned long   _unused[4];
        int             signal;
#ifdef __powerpc64__
        int             _pad0;
#endif
        unsigned long   handler;
        unsigned long   oldmask;
        struct pt_regs  *regs;
#ifdef __powerpc64__
        elf_gregset_t   gp_regs;
        elf_fpregset_t  fp_regs;
...
which leads to the rather silly expansion:
struct sigcontext {
 unsigned long __attribute__((__unused__))[4];
 int signal;
...
which doesn't compile, dying with:
powerpc64-unknown-linux-gnu-gcc -O2 -pipe -mcpu=970 -mtune=970 -maltivec -mabi=altivec -floop-block -floop-interchange -floop-strip-mine -ggdb -D_BSD_SOURCE -D_XOPEN_SOURCE=600 -c dhcp.c -o dhcp.o
In file included from /usr/include/bits/sigcontext.h:27:0,
                 from /usr/include/signal.h:340,
                 from /usr/include/sys/param.h:28,
                 from net.h:32,
                 from dhcp.h:174,
                 from dhcp.c:38:
/usr/include/asm/sigcontext.h:17:23: error: expected identifier or '(' before '[' token
Comment 1 William Hubbs gentoo-dev 2013-04-23 22:35:03 UTC
Roy,

Do you have any ideas on this? I checked the code for 5.6.8 and it looks
like it has the same issue.

Thanks,

William
Comment 2 Roy Marples 2013-04-24 09:39:35 UTC
Fixed upstream here:
http://roy.marples.name/cgi-bin/gitweb.cgi?p=dhcpcd.git;a=commit;h=603a701d1f31da614bdb377c0131bd889f42cb4a

Let me know if it fixed the ppc issue!
Comment 3 marty rosenberg 2013-04-24 16:10:53 UTC
you are in a maze of twisty #defines, all alike

mjrosenb@euclid ~/oss_projects/dhcpcd $ make
gcc -O2 -std=c99 -ggdb -Wall -Wextra -Wimplicit -Wshadow -Wformat=2 -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls  -Wnested-externs -Winline -Wwrite-strings -Wcast-align -Wcast-qual -Wpointer-arith -Wstrict-overflow -Wdeclaration-after-statement -Wsequence-point -fno-common -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -DINET -DINET6 -c common.c -o common.o
gcc -O2 -std=c99 -ggdb -Wall -Wextra -Wimplicit -Wshadow -Wformat=2 -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls  -Wnested-externs -Winline -Wwrite-strings -Wcast-align -Wcast-qual -Wpointer-arith -Wstrict-overflow -Wdeclaration-after-statement -Wsequence-point -fno-common -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -DINET -DINET6 -c control.c -o control.o
In file included from /usr/include/signal.h:360:0,
                 from /usr/include/sys/param.h:28,
                 from net.h:32,
                 from dhcp.h:226,
                 from dhcpcd.h:38,
                 from control.c:40:
/usr/include/sys/ucontext.h:100:24: error: expected identifier or ‘(’ before ‘[’ token
make: *** [control.o] Error 1
mjrosenb@euclid ~/oss_projects/dhcpcd $ sed -n 99,107p /usr/include/sys/ucontext.h 
typedef struct {
        unsigned long   __unused[4];
        int             signal;
        int             __pad0;
        unsigned long   handler;
        unsigned long   oldmask;
        struct pt_regs  *regs;
        gregset_t       gp_regs;
        fpregset_t      fp_regs;

would it be plausible to change the order that the headers are included so all system headers are defined before anything gets #defined? this means we won't have access to some struct fields like _unused, but they are unused.
Comment 4 Roy Marples 2013-04-25 05:47:39 UTC
I find it highly unfair that the kernel claims both _unused and __unused, especially as __unused is defined on most BSD platforms as defined in dhcpcd.

Changing the order of includes isn't that feasible on dhcpcd-5.6, but we should be able to move the structs out of dhcp.h and into dhcp.c in dhcpcd-6 which should also solve the problem.

Is this issue only occuring on PPC? I take it linux-headers-3.7 works fine compiling dhcpcd on other archs?
Comment 5 Roy Marples 2013-04-25 06:13:18 UTC
http://roy.marples.name/cgi-bin/gitweb.cgi?p=dhcpcd.git;a=commit;h=805878326a3bd2175b7049ba99f69cd9c5dc8820

May work around it. let me know and I'll apply it to 5.6
Comment 6 marty rosenberg 2013-05-02 18:25:29 UTC
Sorry for the slow turnaround time on this.

mjrosenb@euclid ~/oss_projects/dhcpcd $ make
gcc -O2 -std=c99 -ggdb -Wall -Wextra -Wimplicit -Wshadow -Wformat=2 -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls  -Wnested-externs -Winline -Wwrite-strings -Wcast-align -Wcast-qual -Wpointer-arith -Wstrict-overflow -Wdeclaration-after-statement -Wsequence-point -fno-common -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -DINET -DINET6 -c control.c -o control.o
In file included from /usr/include/signal.h:360:0,
                 from /usr/include/sys/param.h:28,
                 from net.h:32,
                 from dhcp.h:237,
                 from dhcpcd.h:38,
                 from control.c:40:
/usr/include/sys/ucontext.h:100:24: error: expected identifier or ‘(’ before ‘[’ token

looks like it was included elsewhere.
Comment 8 marty rosenberg 2013-05-08 11:07:37 UTC
mjrosenb@euclid ~/oss_projects/dhcpcd $ make
gcc -O2 -std=c99 -ggdb -Wall -Wextra -Wimplicit -Wshadow -Wformat=2 -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls  -Wnested-externs -Winline -Wwrite-strings -Wcast-align -Wcast-qual -Wpointer-arith -Wstrict-overflow -Wdeclaration-after-statement -Wsequence-point -fno-common -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -DINET -DINET6 -c control.c -o control.o
In file included from /usr/include/signal.h:360:0,
                 from eloop.h:31,
                 from control.c:42:
/usr/include/sys/ucontext.h:100:24: error: expected identifier or ‘(’ before ‘[’ token

not quite.  It looks like there are many paths that this file gets included on.
Comment 9 Roy Marples 2013-05-21 13:26:28 UTC
Another fix:
http://roy.marples.name/projects/dhcpcd/changeset/12ae0608bc4fd2ba0257ed59421d3c397fe381d1

Does it compile now?
Comment 10 marty rosenberg 2013-05-21 15:09:30 UTC
Created attachment 348834 [details]
fulll output of make -k

Don't know why it didn't occur to me to run make -k before just now.
Anyhow, if you want more immediate feedback, I'm usually on IRC, and can be coaxed online at basically any hour. (nick is mjrosenb)
Comment 11 marty rosenberg 2013-05-21 17:13:01 UTC
looks like this is fixed in the latest git tip.
Comment 12 William Hubbs gentoo-dev 2013-06-04 01:42:06 UTC
I can't close this bug based on whether it builds with the current git
tip, but can you test with dhcpcd-5.99.6 and let me know if it builds
successfully?

Thanks,

William
Comment 13 Roy Marples 2013-06-04 08:12:59 UTC
(In reply to William Hubbs from comment #12)
> I can't close this bug based on whether it builds with the current git
> tip, but can you test with dhcpcd-5.99.6 and let me know if it builds
> successfully?

It won't build :)
However, I'm very close to releasing .7 - just need to waiting on a few testing results about other issues.
Comment 14 Roy Marples 2013-06-04 10:47:27 UTC
dhcpcd-5.99.7 released which fixes this.
Comment 15 William Hubbs gentoo-dev 2013-06-04 19:41:16 UTC
This release is now in the tree. Thanks Roy. :-)