From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13399 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Forney Newsgroups: gmane.linux.lib.musl.general Subject: [musl-cross-make] [PATCH] litecross: Fix system header dir when building native toolchains Date: Tue, 6 Nov 2018 22:49:57 -0800 Message-ID: <20181107064957.1137-1-mforney@mforney.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1541573312 15567 195.159.176.226 (7 Nov 2018 06:48:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 7 Nov 2018 06:48:32 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-13415-gllmg-musl=m.gmane.org@lists.openwall.com Wed Nov 07 07:48:28 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1gKHdb-0003wG-5J for gllmg-musl@m.gmane.org; Wed, 07 Nov 2018 07:48:27 +0100 Original-Received: (qmail 5504 invoked by uid 550); 7 Nov 2018 06:50:35 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 5443 invoked from network); 7 Nov 2018 06:50:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mforney-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=jJ5nAJO9iIBOkjGQHfgUZ/lYEzZ4L3HiHzeHJqaJctk=; b=ubmiq9QYXBO8MVt5OhC1QCzJ1xo5sHqB1Q+MT0+uy4v46huGsLMBmgupSIYQKOYAt8 TliWsSsz8cbxq+rrIgMWJ4PT3T5mB0e19H628xfuBdsb1+10z/a8/rZUq+i4uQ74ZY28 9h0HfcJ9SSlMzv8vVBswaYeC4bYJd3EbQvO/ZZ7ox7iouTdpIrHDOlku39j0PFT9y3Dl Apze/kMAVNudz1HVuv+/30TJbFkmGgt/jRozJPiNjxu3eOoJHdBvt/gC5laVlbeBHpe4 1mO9idpuPQaeH/6DCXOUBbj7DGY2Cx47yDWzBJ29/hXdMa3Xv1JVY7ARXlMoQqOJ/a4m lwfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=jJ5nAJO9iIBOkjGQHfgUZ/lYEzZ4L3HiHzeHJqaJctk=; b=P09WZaKyor5OKlbGbbHuuGTPlt8y98VqTjsG2ytGvKgXK6AUey78CMQ7oRPffyOBie LtmROBSnRmqmkiUXAzQmf1ldXWqTsZHbOkbrZXxW9p5peeibw121o9Tg0G5LYT7tOt+c y/apPFzRK1BtluD1yKbVD5gtEfscgLNGyK1fVOAtgN1swx2QcfylfBFwwrQKhAOAxVJM Lred/YqXjjJeLmmSxBGb1/bM+cssIM1C8GtWIAxKkDsQ2W2q9ah8PhFqCiEFtWMCPlQ2 R5y/Pcilke/ERnIBNgSP5+v+qK1DEvdQEru9Gq6P+VMIhgOBORvXp6AfmQEnNXMfPd8I jdkA== X-Gm-Message-State: AGRZ1gLPDsBfv41GoCYEWqdjFGp8eLZopnBOPP5MQSuz8ovjfyWg2OiO eAc9Enszg5jKJr7h33vdM/koi0n8Q/IGKA== X-Google-Smtp-Source: AJdET5cSiOzHNsQfLQkBf8pZL4RGq7TaBctFMRzCLDHkHZakj2DE4O/2a/jW5d3Y70oyWwIcPaDs6g== X-Received: by 2002:a63:6906:: with SMTP id e6mr629307pgc.144.1541573421803; Tue, 06 Nov 2018 22:50:21 -0800 (PST) X-Mailer: git-send-email 2.19.1 Xref: news.gmane.org gmane.linux.lib.musl.general:13399 Archived-At: By default, gcc will search in /usr/include relative to the sysroot, but musl is configured with an empty prefix, so headers get installed to /include. This causes gcc to fail to find the libc headers unless a usr -> . symlink is created manually. This is not an issue for cross toolchains because in that case, the configured sysroot is /$(TARGET) which happens to match gcc_tooldir[0], which is one of gcc's default search directories[1]. The system header directory can be configured with --with-native-system-header-dir. However, this is not quite sufficient because the stmp-fixinc target in gcc/Makefile tests for the existence of that directory relative to the configured sysroot (/)[2]. Most systems do not have /include, so this fails. Since musl's fixinc.sh is a no-op[3], we can work around this by clearing STMP_FIXINC, skipping fixincludes entirely. [0] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/configure.ac;h=b066cc609e1c2615e66307d5439f765a4f3b286b;hb=9fb89fa845c1b2e0a18d85ada0b077c84508ab78#l6319 [1] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/linux.h;h=2ea4ff92c1df9e6d6297996004360ae7eeda2075;hb=9fb89fa845c1b2e0a18d85ada0b077c84508ab78#l180 [2] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/Makefile.in;h=20bee0494b1bad4e3ec34e2eae291cf6eadc3aa1;hb=9fb89fa845c1b2e0a18d85ada0b077c84508ab78#l3078 [3] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=fixincludes/mkfixinc.sh;h=0f9648608e94f97ab13da223d8192cb04c255772;hb=9fb89fa845c1b2e0a18d85ada0b077c84508ab78#l22 --- litecross/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/litecross/Makefile b/litecross/Makefile index 2f78157..d1e52b6 100644 --- a/litecross/Makefile +++ b/litecross/Makefile @@ -55,6 +55,7 @@ MAKE += MULTILIB_OSDIRNAMES= MAKE += INFO_DEPS= infodir= MAKE += ac_cv_prog_lex_root=lex.yy.c MAKE += MAKEINFO=false +MAKE += STMP_FIXINC= FULL_BINUTILS_CONFIG = \ $(COMMON_CONFIG) $(BINUTILS_CONFIG) $(TOOLCHAIN_CONFIG) \ @@ -70,6 +71,7 @@ FULL_GCC_CONFIG = --enable-languages=c,c++ \ --target=$(TARGET) --prefix= \ --libdir=/lib --disable-multilib \ --with-sysroot=$(SYSROOT) \ + --with-native-system-header-dir=/include \ --enable-tls \ --disable-libmudflap --disable-libsanitizer \ --disable-gnu-indirect-function \ -- 2.19.1