From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3764 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Fixing gcc paths for musl Date: Sat, 27 Jul 2013 20:48:46 -0400 Message-ID: <20130728004846.GA25530@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="+HP7ph2BbKc20aGI" X-Trace: ger.gmane.org 1374973435 5004 80.91.229.3 (28 Jul 2013 01:03:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Jul 2013 01:03:55 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-3768-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jul 28 03:03:58 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1V3FAS-0005fq-LM for gllmg-musl@plane.gmane.org; Sun, 28 Jul 2013 02:49:00 +0200 Original-Received: (qmail 28125 invoked by uid 550); 28 Jul 2013 00:48:59 -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 28117 invoked from network); 28 Jul 2013 00:48:59 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:3764 Archived-At: --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline A longstanding issue with using gcc with musl has been that the gcc installs its own versions of a number of ISO C headers (basically, the ones for a freestanding implementation) in its own include directory and puts that ahead of /usr/include in the search path order. Some people have been solving this by patching those headers not to conflict with musl so badly, while others (myself included) have been just deleting the offending headers after installing, but the real fix is to make gcc aware that it should have a different search order for musl that searches the libc headers before its own versions. This allows use of the useful gcc headers (e.g. the ones for intrinsics) while letting the libc headers override for libc things. The attached patch (against gcc 4.6.3 but the idea is the same for other versions) attempts to do this the same was it's done in gcc/config/openbsd.h and gcc/config/netbsd.h. It's untested and just to get an idea of what I'd like to do. My hope is that this can be merged into Gregor's musl-cross gcc patch to make a universal gcc patch that covers all the issues needed for using gcc with musl, so that you can just apply it and install. For reference, musl-cross repo is here: https://bitbucket.org/GregorR/musl-cross/ Rich --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gcc-path.diff" --- gcc-4.6.3/gcc/config/linux.h.bak +++ gcc-4.6.3/gcc/config/linux.h @@ -102,3 +102,18 @@ /* Whether we have sincos that follows the GNU extension. */ #define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC) + +#if DEFAULT_LIBC == LIBC_MUSL +#undef INCLUDE_DEFAULTS +#define INCLUDE_DEFAULTS \ + { \ + { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \ + { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0, 1 }, \ + { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \ + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, \ + { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 }, \ + { STANDARD_INCLUDE_DIR, 0, 0, 1, 1, 0 }, \ + { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0 } \ + } +#endif --+HP7ph2BbKc20aGI--