0

To build a full libgcc with libc support, you need the libc headers, according to these guides (see also the --without-headers option in gcc configuration doc):

https://wiki.osdev.org/Hosted_GCC_Cross-Compiler https://wiki.gentoo.org/wiki/Embedded_Handbook/General/Creating_a_cross-compiler#Cross-compiler_internals

So I tried it, and I get linker errors about crti.o not found and -lc not found. Then, I found this guide https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/, that installs only the crti.o files and a fake libc. So why does building libgcc need them? As I understand it, libraries don't need the C runtime files. Also, in step 5., when building libgcc, how does make know where to find the headers and runtime libraries, since --with-sysroot was never specified in the configure step. I know I can build a degraded libgcc at first, but I'd just like to understand why I need more than the headers to build a full libgcc.

discape
  • 337
  • 1
  • 15

0 Answers0