Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 549966 - net-dialup/ppp with sys-libs/musl - In file included from plugin.c:29:0: pppoe.h:43:23: fatal error: sys/cdefs.h: No such file or directory
Summary: net-dialup/ppp with sys-libs/musl - In file included from plugin.c:29:0: pp...
Status: IN_PROGRESS
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Lars Wendler (Polynomial-C)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: musl-porting
  Show dependency tree
 
Reported: 2015-05-20 13:36 UTC by Robert Sebastian Gerus
Modified: 2018-01-20 18:13 UTC (History)
5 users (show)

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


Attachments
ppp-2.4.7-musl.diff (ppp-2.4.7-musl.diff,5.22 KB, patch)
2015-05-20 13:37 UTC, Robert Sebastian Gerus
Details | Diff
ppp-2.4.7-dhcp-musl.diff (ppp-2.4.7-dhcp-musl.diff,1.90 KB, patch)
2015-05-20 13:38 UTC, Robert Sebastian Gerus
Details | Diff
ppp-2.4.7-r1.ebuild.patch (ppp-2.4.7-r1.ebuild.patch,540 bytes, patch)
2015-05-20 13:43 UTC, Robert Sebastian Gerus
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Sebastian Gerus 2015-05-20 13:36:50 UTC
net-dialup/ppp does not compile on musl systems.
I have two conditional patches, partially based on work done in voidlinux[0] that fix it for musl but - if applied unconditionally would probably kill cute kittens on glibc based systems.

Reproducible: Always

Steps to Reproduce:
1. USE="dhcp eap-tls ipv6" emerge -v ppp
Actual Results:  
x86_64-gentoo-linux-musl-gcc -Os -pipe -fomit-frame-pointer -mtune=generic -D_GNU_SOURCE -I../../../include '-DRP_VERSION="3.8p"' -c -o debug.o debug.c
In file included from plugin.c:29:0:  
pppoe.h:43:23: fatal error: sys/cdefs.h: No such file or directory
 #include <sys/cdefs.h>  
                       ^
compilation terminated.  
Makefile:53: recipe for target 'plugin.o' failed
make[2]: *** [plugin.o] Error 1  
make[2]: *** Waiting for unfinished jobs....
In file included from if.c:20:0:
pppoe.h:43:23: fatal error: sys/cdefs.h: No such file or directory
 #include <sys/cdefs.h>
                       ^
compilation terminated.
In file included from discovery.c:15:0:
pppoe.h:43:23: fatal error: sys/cdefs.h: No such file or directory
 #include <sys/cdefs.h>
                       ^
compilation terminated.
In file included from common.c:20:0:
pppoe.h:43:23: fatal error: sys/cdefs.h: No such file or directory
 #include <sys/cdefs.h>
                       ^
compilation terminated.
Makefile:56: recipe for target 'discovery.o' failed
make[2]: *** [discovery.o] Error 1
Makefile:59: recipe for target 'if.o' failed
make[2]: *** [if.o] Error 1
Makefile:62: recipe for target 'common.o' failed
make[2]: *** [common.o] Error 1
In file included from debug.c:19:0:
pppoe.h:43:23: fatal error: sys/cdefs.h: No such file or directory
 #include <sys/cdefs.h>
                       ^
compilation terminated.
In file included from pppoe-discovery.c:19:0:
pppoe.h:43:23: fatal error: sys/cdefs.h: No such file or directory
 #include <sys/cdefs.h>
                       ^
compilation terminated.
Makefile:38: recipe for target 'debug.o' failed
make[2]: *** [debug.o] Error 1
Makefile:35: recipe for target 'pppoe-discovery.o' failed
make[2]: *** [pppoe-discovery.o] Error 1
make[2]: Leaving directory '/var/tmp/portage/net-dialup/ppp-2.4.7-r1/work/ppp-2.4.7/pppd/plugins/rp-pppoe'
/bin/sh: line 0: exit: minconn.so: numeric argument required
Makefile:37: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/var/tmp/portage/net-dialup/ppp-2.4.7-r1/work/ppp-2.4.7/pppd/plugins'
Makefile:13: recipe for target 'all' failed
make: *** [all] Error 2


Expected Results:  
>>> net-dialup/ppp-2.4.7-r1 merged.

This package (upstream) is a mess. Isn't there any alternative with, for a start, a proper build system?
Comment 1 Robert Sebastian Gerus 2015-05-20 13:37:58 UTC
Created attachment 403676 [details, diff]
ppp-2.4.7-musl.diff

Fix for the general case, i.e. USE="-dhcp"
Comment 2 Robert Sebastian Gerus 2015-05-20 13:38:48 UTC
Created attachment 403678 [details, diff]
ppp-2.4.7-dhcp-musl.diff

Additional fix for USE="dhcp" case.
Comment 3 Robert Sebastian Gerus 2015-05-20 13:43:38 UTC
Created attachment 403680 [details, diff]
ppp-2.4.7-r1.ebuild.patch

Patch for the ebuild - basically conditionally applying the previous patches at the end of src_compile. Which is a bad thing, but i didn't succeed in making it properly.
Comment 4 Felix Janda 2015-05-20 16:59:17 UTC
For the second patch it would be better to define _GNU_SOURCE before
the <netinet/udp.h> include so that the non-standard linux names for
the members of udphdr get defined. With this the patch can be made
to not break glibc.
Comment 5 Robert Sebastian Gerus 2015-05-20 17:35:36 UTC
Actually, I just checked on a regular (~amd64 and gcc-5.1 notwithstanding) gentoo box that the second (-dhcp-musl) patch doesn't break it as-is.
Comment 6 Felix Janda 2015-05-20 18:07:03 UTC
I didn't know that in recent glibc this works fine. glibc-2.19 is
needed. The relevant glibc commit is 7011c2622fe3e10a29dbe74f06aaebd07710127d

However for upstream this is likely too recent...


The source code has very barrock __P() decorations to make K&R C compilers
happy... However the files in the plugins directory seem to require an ANSI
C compiler. This could be used as an argument for upstream to remove these
macros. Anyway, the patching needed to build with musl despite of this is
pretty small.


I've tried building current git and needed much less commenting out of
headers. What is the problem with <net/ethernet.h>?
Comment 7 Robert Sebastian Gerus 2015-05-20 23:10:36 UTC
Leaving it included causes redefinitions like these:
/usr/include/netinet/if_ether.h:96:8: error: redefinition of 'struct ethhdr'

Here are more details (basically, the same error):

Leaving #include <net/ethernet.h> in ppp-2.4.7/pppd/plugins/rp-pppoe/if.c causes:
x86_64-gentoo-linux-musl-gcc -Os -pipe -fomit-frame-pointer -mtune=generic -D_GNU_SOURCE -I../../../include '-DRP_VERSION="3.8p"' -c -o debug.o debug.c
In file included from /usr/include/net/ethernet.h:10:0,
                 from if.c:33:
/usr/include/netinet/if_ether.h:96:8: error: redefinition of 'struct ethhdr'
 struct ethhdr {
        ^
In file included from pppoe.h:80:0,
                 from if.c:20:
/usr/include/linux/if_ether.h:136:8: note: originally defined here
 struct ethhdr {
        ^
Makefile:59: recipe for target 'if.o' failed
make[2]: *** [if.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/var/tmp/portage/net-dialup/ppp-2.4.7-r1/work/ppp-2.4.7/pppd/plugins/rp-pppoe'
/bin/sh: line 0: exit: minconn.so: numeric argument required
Makefile:37: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/var/tmp/portage/net-dialup/ppp-2.4.7-r1/work/ppp-2.4.7/pppd/plugins'
Makefile:13: recipe for target 'all' failed
make: *** [all] Error 2



Leaving it in pppd/plugins/rp-pppoe/plugin.c causes:
x86_64-gentoo-linux-musl-gcc -Wl,-O1 -Wl,--as-needed -Os -pipe -fomit-frame-pointer -mtune=generic -D_GNU_SOURCE -I../../../include '-DRP_VERSION="3.8p"' -o pppoe-discovery pppoe-discovery.o debug.o
In file included from /usr/include/net/ethernet.h:10:0,
                 from plugin.c:49:
/usr/include/netinet/if_ether.h:96:8: error: redefinition of 'struct ethhdr'
 struct ethhdr {
        ^
In file included from pppoe.h:80:0,
                 from plugin.c:29:
/usr/include/linux/if_ether.h:136:8: note: originally defined here
 struct ethhdr {
        ^
Makefile:53: recipe for target 'plugin.o' failed
make[2]: *** [plugin.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/var/tmp/portage/net-dialup/ppp-2.4.7-r1/work/ppp-2.4.7/pppd/plugins/rp-pppoe'
/bin/sh: line 0: exit: minconn.so: numeric argument required
Makefile:37: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/var/tmp/portage/net-dialup/ppp-2.4.7-r1/work/ppp-2.4.7/pppd/plugins'
Makefile:13: recipe for target 'all' failed
make: *** [all] Error 2



Leaving it in pppd/plugins/rp-pppoe/pppoe-discovery.c:
x86_64-gentoo-linux-musl-gcc -Os -pipe -fomit-frame-pointer -mtune=generic -D_GNU_SOURCE -I../../../include '-DRP_VERSION="3.8p"' -c -o pppoe-discovery.o pppoe-discovery.c
In file included from /usr/include/net/ethernet.h:10:0,
                 from pppoe-discovery.c:31:
/usr/include/netinet/if_ether.h:96:8: error: redefinition of 'struct ethhdr'
 struct ethhdr {
        ^
In file included from pppoe.h:80:0,
                 from pppoe-discovery.c:19:
/usr/include/linux/if_ether.h:136:8: note: originally defined here
 struct ethhdr {
        ^
Makefile:35: recipe for target 'pppoe-discovery.o' failed
make[2]: *** [pppoe-discovery.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/var/tmp/portage/net-dialup/ppp-2.4.7-r1/work/ppp-2.4.7/pppd/plugins/rp-pppoe'
/bin/sh: line 0: exit: minconn.so: numeric argument required
Makefile:37: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/var/tmp/portage/net-dialup/ppp-2.4.7-r1/work/ppp-2.4.7/pppd/plugins'
Makefile:13: recipe for target 'all' failed
make: *** [all] Error 2
Comment 8 Anthony Basile gentoo-dev 2015-05-22 11:11:01 UTC
Okay I put this on the hardened-dev::musl overlay.  I don't doubt this package is a mess and I don't blame you for the conditional patches, but it will make it difficult to push upstream.