1

When building the first pass of GCC in Linux From Scratch, it says to pass the --with-newlib flag because

"Since a working C library is not yet available, this ensures that the inhibit_libc constant is defined when building libgcc. This prevents the compiling of any code that requires libc support."

Why is this? Why is either LFS or GCC broken? According to the actual gcc instructions, --with-newlib doesn't do anything like that, only telling GCC you're using newlib

"Specifies that ‘newlib’ is being used as the target C library. This causes __eprintf to be omitted from libgcc.a on the assumption that it will be provided by ‘newlib’."

Whats going on? Is LFS fundmentally broken and doing it wrong(Besides the fact that it uses a sub-directory in the gcc source for building, which is explicitly unsupported by GCC..), or is GCC fundamentally broken and unable to be bootstrapped by actually doing something silly like following it's documentation?

If LFS is doing it wrong, whats the correct way to build a native GCC/binutils toolchain isolated from the host system

If GCC is wrong, well i guess i'm(and everyone else) is just out of luck for building it by doing something ridiculous like "following the directions", which kinda sucks.

  • I don't know what LFS is, but --use-newlib may be a trick since inhibit_libc is only defined when a) newlib is used or b) building a cross-compiler (host != target). But what if you want to build something like a cross-compiler, but for an identical target to the one you run on? – mosvy Jul 17 '19 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.