From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8615 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: musl and kernel headers [was Re: system-images 1.4.2: od is broken; bzip2 is missing] Date: Mon, 5 Oct 2015 21:44:26 -0400 Message-ID: <20151006014426.GL8645@brightrain.aerifal.cx> References: <5612925A.4070402@landley.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1444095893 13042 80.91.229.3 (6 Oct 2015 01:44:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 6 Oct 2015 01:44:53 +0000 (UTC) Cc: Denys Vlasenko , Aboriginal Linux , musl@lists.openwall.com To: Rob Landley Original-X-From: musl-return-8627-gllmg-musl=m.gmane.org@lists.openwall.com Tue Oct 06 03:44:52 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZjHJD-0004Ov-3z for gllmg-musl@m.gmane.org; Tue, 06 Oct 2015 03:44:51 +0200 Original-Received: (qmail 15846 invoked by uid 550); 6 Oct 2015 01:44:48 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 15790 invoked from network); 6 Oct 2015 01:44:43 -0000 Content-Disposition: inline In-Reply-To: <5612925A.4070402@landley.net> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:8615 Archived-At: On Mon, Oct 05, 2015 at 10:08:10AM -0500, Rob Landley wrote: > > Re musl: two cases of breakage: > > > > #include > > #include > > results in: > > In file included from /usr/include/linux/if_bridge.h:18, > > from networking/brctl.c:67: > > /usr/include/linux/in6.h:32: error: redefinition of 'struct in6_addr' > > /usr/include/linux/in6.h:49: error: redefinition of 'struct sockaddr_in6' > > /usr/include/linux/in6.h:59: error: redefinition of 'struct ipv6_mreq' > > > > and > > > > #include > > #include > > results in: > > In file included from /usr/include/net/ethernet.h:10, > > from networking/ifplugd.c:41: > > /usr/include/netinet/if_ether.h:96: error: redefinition of 'struct ethhdr' > > > > That I leave to Rich. :) Including kernel headers is just really problematic. These days they try to make it work on glibc with a complex dance between glibc's headers and the kernel headers. You're likely to have the best luck by including the libc headers first. I think Sabotage and possibly some other musl-based dists are patching the kernel headers to make them behave better; see: https://github.com/sabotage-linux/sabotage/blob/master/pkg/kernel-headers But it might be possible that we can just #define whatever macro the kernel headers expect to suppress redefinitions, if it's in a reserved namespace. This would only fix the case where the kernel headers are included _after_ the libc/userspace ones, but it's not too ugly. I probably won't get around to it myself but if anyone wants to check what macros we'd need to define (and where), let's discuss it (cc'ing musl list). The cleaner approach is just avoiding including both the kernel headers and libc/userspace headers for the same things in the same file. In theory this may be hard in some cases, but I find that I can almost always fix these sorts of errors during a build by commenting out one or two #include lines. Rich