Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 548886

Summary: net-misc/openvpn fails to build on hardened/musl
Product: Gentoo Linux Reporter: Robert Sebastian Gerus <ar>
Component: Current packagesAssignee: Dirkjan Ochtman <djc>
Status: RESOLVED FIXED    
Severity: normal CC: ar, gentoo, musl
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 556874    
Bug Blocks: 430702    
Attachments: openvpn-2.3.6-musl-compat.diff
Remove dependency on <netinet/if_ether.h>

Description Robert Sebastian Gerus 2015-05-08 07:28:00 UTC
net-misc/openvpn fails to compile on gentoo/hardened/musl.

Reproducible: Always

Steps to Reproduce:
1. emerge -v net-misc/openvpn
Actual Results:  
x86_64-gentoo-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../src/compat        -O2 -pipe -fomit-frame-pointer -mtune=generic -c -o base64.o base64.c
In file included from syshead.h:178:0,
                 from base64.c:40:
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
 #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
  ^
In file included from /usr/include/linux/if_tun.h:20:0,
                 from syshead.h:222,
                 from base64.c:40:
/usr/include/linux/if_ether.h:136:8: error: redefinition of ‘struct ethhdr’
 struct ethhdr {
        ^
In file included from syshead.h:218:0,
                 from base64.c:40:
/usr/include/netinet/if_ether.h:96:8: note: originally defined here
 struct ethhdr {
        ^
Makefile:640: recipe for target 'base64.o' failed
make[3]: *** [base64.o] Error 1
make[3]: Leaving directory '/var/tmp/portage/net-misc/openvpn-2.3.6-r2/work/openvpn-2.3.6/src/openvpn'
Makefile:410: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/var/tmp/portage/net-misc/openvpn-2.3.6-r2/work/openvpn-2.3.6/src'
Makefile:592: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/net-misc/openvpn-2.3.6-r2/work/openvpn-2.3.6'
Makefile:480: recipe for target 'all' failed
make: *** [all] Error 2


Expected Results:  
>>> net-misc/openvpn-2.3.6-r2 merged.


Attached patch fixes build on musl and doesn't break it on regular (glibc) gentoo.
Comment 1 Robert Sebastian Gerus 2015-05-08 07:28:45 UTC
Created attachment 402850 [details, diff]
openvpn-2.3.6-musl-compat.diff
Comment 2 Felix Janda 2015-05-09 13:55:26 UTC
Created attachment 402896 [details, diff]
Remove dependency on <netinet/if_ether.h>

The patch in Comment 1 works fine because <linux/if_tun.h> includes
<linux/if_ether.h>, which declares the constants ETH_P_IP and
ETH_P_IPV6 which are used in src/openvpn/tun.c. However I don't think
one should rely on this fact.

On the other hand, openvpn has already equivalent OPENVPN_ETH_P_*
constants which can be used here instead so that the <netinet/if_ether.h>
header becomes completely unnecessary.

Maybe this is even upstreamable...
Comment 3 Dirkjan Ochtman gentoo-dev 2015-05-14 22:50:47 UTC
Yeah, can someone please propose these upstream? That would be nice.
Comment 5 Felix Janda 2015-05-17 07:22:55 UTC
Fixed in current git HEAD. Should land in openvpn-2.3.7.
Comment 6 Anthony Basile gentoo-dev 2015-05-22 11:40:46 UTC
(In reply to Felix Janda from comment #5)
> Fixed in current git HEAD. Should land in openvpn-2.3.7.

Excellent!  I've put this on the hardened-dev::musl overlay in the mean time.  Ping back when 2.3.7 is in the gentoo tree.
Comment 7 Felix Janda 2015-12-16 17:45:11 UTC
openvpn-2.3.8 is in the tree, stable and compiles fine with musl. So I
think the ebuild can be removed from the musl overlay and this bug be closed.
Comment 8 Anthony Basile gentoo-dev 2015-12-16 21:56:43 UTC
(In reply to Felix Janda from comment #7)
> openvpn-2.3.8 is in the tree, stable and compiles fine with musl. So I
> think the ebuild can be removed from the musl overlay and this bug be closed.

thanks Felix.