Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue,  6 Nov 2018 22:49:57 -0800
From: Michael Forney <>
Subject: [musl-cross-make] [PATCH] litecross: Fix system header dir when building native toolchains

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 is a no-op[3], we can work around this by
clearing STMP_FIXINC, skipping fixincludes entirely.

 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
@@ -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 \

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.