L4Re, BUILD_ARCH, cross-building for ARM on MIPS

Paul Boddie paul at boddie.org.uk
Mon Jun 10 16:50:57 CEST 2019


In attempting to investigate building L4Re/Fiasco.OC for the Raspberry Pi 
Zero, I encountered an unusual problem: unusual because, I suppose, most 
people do not try and cross-build on architectures other than x86(-64).

When performing the initial L4Re build directory initialisation step...

make B=mybuild

...BUILD_ARCH seems to be set to x86 even on other architectures. This then 
causes CCXX_FLAGS to be populated with x86-dependent settings such as -m32, 
and the gcc host compilers for MIPS raise errors upon encountering these 
unrecognised arguments.

Here is the offending command in the top-level Makefile (line 376 in my 
version, r83 in Subversion):

GENDEP_OUTPUT=$$X.out $(CC) $(CCXX_FLAGS) -c $$X -o $$X.o

Although it seemed like the config step could be performed after ignoring 
these errors, I did wonder if there might be some undesirable consequences. In 
the end, I found that the following invocation was needed:

make B=mybuild CC=gcc CXX=g++ LD=ld BUILD_ARCH=mips CPU=32r2 CPU_ABI=32

After that, things seem to work as expected. I imagine that there is a 
"chicken and egg" situation here: the appropriate settings would be obtained 
from the configuration, but the command being run sets up the configuration.

Has anyone else seen this problem before?


More information about the l4-hackers mailing list