I want to build Rockbox from source for MIPS targets. According their the wiki I need a tool chain with binutils v2.17 and GCC v4.1.2 for the
mipsel-elf target with
CFLAGS="-U_FORTIFY_SOURCE -fgnu89-inline". Here's the configure line for both:
CFLAGS='-U_FORTIFY_SOURCE -fgnu89-inline' ./configure --target=mipsel-elf --enable-languages=c --disable-libssp --disable-docs
I was able to build and install binutils but GCC fails with both the “automatic build” and the manual method because (also see the full make log):
make: Entering directory `/home/malte/Software/devel/linux-dev/ubuntu/gcc/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc' /home/malte/Software/devel/linux-dev/ubuntu/gcc/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/home/malte/Software/devel/linux-dev/ubuntu/gcc/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/ -B/usr/local/mipsel-elf/bin/ -B/usr/local/mipsel-elf/lib/ -isystem /usr/local/mipsel-elf/include -isystem /usr/local/mipsel-elf/sys-include -O2 -O2 -U_FORTIFY_SOURCE -fgnu89-inline -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -I. -I. -I../.././gcc -I../.././gcc/. -I../.././gcc/../include -I../.././gcc/../libcpp/include -g0 -finhibit-size-directive -fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss -fno-unit-at-a-time -Dinhibit_libc -G 0 \ -c ../.././gcc/crtstuff.c -DCRT_BEGIN \ -o crtbegin.o cc1: error: unrecognized command line option "-fgnu89-inline" make: *** [crtbegin.o] Error 1
As far as I can tell the issue is that
CFLAGS meant for the host compiler are passed to the “minimal”
xgcc that's doesn't know or require this flag. Building without
-fgnu89-inline fails because GCC 4.1.2 relies on C89 function inline semantics.
Question: How can I configure the build so that
-fgnu89-inline is passed to the host compiler but not the minimal compiler during the 2nd phase?
I noticed that the build succeeds if I replace
-std=gnu89 but I don't feel that's right. Cross-compilation for embedded devices is tricky enough and I'd rather not introduce another possible source for errors.
- OS: Ubuntu 14.04 (x86_64)
- Host binutils: 2.26.1-1ubuntu1~16.04.3
- Host gcc: 6.2.0-3ubuntu11~14.04
- GNU Make: 3.81
- Autoconf: 2.13
Bonus: If I add
--with-arch=<ANYTHING> to the build configuration I get the a similar error as above:
cc1: error: unrecognized command line option "-march=native" cc1: error: unrecognized command line option "-fgnu89-inline"