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: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: musl-porting
  Show dependency tree
 
Reported: 2015-05-20 13:36 UTC by Robert Sebastian Gerus
Modified: 2022-06-29 14:51 UTC (History)
7 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.
Comment 9 Ben Kohler gentoo-dev 2021-12-03 18:40:34 UTC
This seems to be compiling fine for me in a musl chroot now, has something been fixed?

$ emerge --info ppp
Portage 3.0.28 (python 3.9.8-final-0, default/linux/amd64/17.0/musl, gcc-11.2.0, musl-1.2.2-r4, 5.14.14-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.14.14-gentoo-x86_64-Intel-R-_Core-TM-_i5-3470_CPU_@_3.20GHz-with-libc
KiB Mem:    16078640 total,   6885736 free
KiB Swap:    2097148 total,   2096124 free
Timestamp of repository gentoo: Thu, 02 Dec 2021 11:15:01 +0000
Head commit of repository gentoo: ed8ad310da2bf2e0f6e04a9ce040d5989bb91e60
sh bash 5.1_p8
ld GNU ld (Gentoo 2.37_p1 p0) 2.37
app-shells/bash:          5.1_p8::gentoo
dev-lang/perl:            5.34.0-r3::gentoo
dev-lang/python:          3.9.8::gentoo
sys-apps/baselayout:      2.7-r3::gentoo
sys-apps/openrc:          0.44.8::gentoo
sys-apps/sandbox:         2.25::gentoo
sys-devel/autoconf:       2.71-r1::gentoo
sys-devel/automake:       1.16.4::gentoo
sys-devel/binutils:       2.37_p1::gentoo
sys-devel/gcc:            11.2.0::musl
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.10-r1::musl (virtual/os-headers)
sys-libs/musl:            1.2.2-r4::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts:

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-gentoo-linux-musl"
CFLAGS="-O2 -pipe"
CHOST="x86_64-gentoo-linux-musl"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="charset.alias /usr/share/locale/locale.alias"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl amd64 bzip2 cli crypt dri fortran iconv ipv6 libglvnd libtirpc ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl unicode xattr zlib" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26 ruby27" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS

=================================================================
                        Package Settings
=================================================================

net-dialup/ppp-2.4.9-r4::gentoo was built with the following:
USE="eap-tls ipv6 pam -activefilter -atm -dhcp -gtk -radius"