Configuring newlib for cross-compilation with clang
Vlad Ivanov
vlad@ivanov.email
Tue Nov 3 11:08:02 GMT 2020
Hello,
I'm trying to build newlib for a PowerPC embedded target to assemble a complete
toolchain with clang. I need to use clang as a cross compiler; clang and llvm
are the only tools available. The resulting toolchain targets bare metal
environment.
Here's the command I'm using:
../newlib-cygwin/configure \
--prefix=/opt/newlib-powerpc/install \
--disable-libstdcxx \
--disable-shared \
--enable-static \
--disable-multilib \
--target=powerpc-none-eabi \
--disable-newlib-supplied-syscalls \
--enable-newlib-nano-malloc \
--enable-target-optspace \
--disable-newlib-multithread \
--disable-newlib-io-float \
--enable-lite-exit \
CC='/usr/bin/clang'
CFLAGS='--target=powerpc-none-eabi'
I see an error early during configuration:
checking for C compiler default output file name...
configure: error: in `/opt/newlib-powerpc/build':
configure: error: C compiler cannot create executables
See `config.log' for more details.
Now, this error occurs because the configure script tries to compile an
executable and it's expecting to see something like a.out. But for an
embedded target, to link an executable, one needs a linker scripts to define
the memory layout, since there's no OS loading the binary. So any tests
that create executables will fail.
Is it possible to tell newlib to not compile any executables? Or should I
use something like a dummy linker script?
Best Regards,
Vlad
More information about the Newlib
mailing list