mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl-cross-make] [PATCH] litecross: Fix system header dir when building native toolchains
@ 2018-11-07  6:49 Michael Forney
  2020-03-23  4:34 ` [musl] [musl-cross-make] [PATCH v2] " Michael Forney
  0 siblings, 1 reply; 15+ messages in thread
From: Michael Forney @ 2018-11-07  6:49 UTC (permalink / raw)
  To: musl

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



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-08-19 21:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07  6:49 [musl-cross-make] [PATCH] litecross: Fix system header dir when building native toolchains Michael Forney
2020-03-23  4:34 ` [musl] [musl-cross-make] [PATCH v2] " Michael Forney
2020-05-09  0:27   ` [musl] " Michael Forney
2020-05-10 16:35     ` Rich Felker
2020-05-10 20:35       ` Michael Forney
2020-05-10 21:52         ` Rich Felker
2020-05-13  8:18           ` Michael Forney
2020-05-13 14:37             ` Rich Felker
2020-05-13 18:48               ` Michael Forney
2020-05-13 18:55                 ` Rich Felker
2020-05-13 19:34                   ` Michael Forney
2020-05-13 20:04                     ` Laurent Bercot
2020-05-13 21:51                       ` Rich Felker
2020-05-14  8:40                         ` Laurent Bercot
2020-08-19 21:00       ` Michael Forney

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).