Search code examples
clinkerstatic-librariesautoconf

Building libc (newlib) results in "cannot find -lc"


I built a cross-compiler for sh3eb-elf targets. Now I need a libc implementation. However, when I want to build newlib, configure fails.

Running configure:

../newlib-cygwin/configure --host=sh3eb-elf

It fails. A quick look into config.log:

configure:4435: sh3eb-elf-gcc    conftest.c  >&5
[...]/sh3eb-elf/sh3eb-elf/lib/gcc/sh3eb-elf/8.1.0/../../../../sh3eb-elf/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
configure:4439: $? = 1

Obviously the linker does not find libc which is what I am trying to build here in the first place. I am confused... Are the parameters of configure wrong?


Solution

  • I'm not sure why, but as Chrono Kitsune pointed out, using --target=sh3eb-elf does the trick.