>> Indeed, this (without -O) works. The key is the HOST_CFLAGS >> variable; I was thinking of just CFLAGS at first. > > I have had some luck with compiling old systems with -V > HOST_CFLAGS=-fcommon. > > That only goes so far into the past, however. I thought the > next step would be to try building even older systems with the > compiler from oldest successful build. So, I tried setting > HOST_CC and HOST_CXX to point to an oldish, but successfully > built toolset that also successfully compiled its own kernel. > That is, I run build.sh with -V > HOST_CC=/path/to/oldish/tooldir/bin/armv7--netbsdelf-eabihf-gcc > (and similarly for HOST_CXX), where those compilers are not the > native systems compilers but ones used in a successful kernel > build for a checkout somewhat after the target checkout. > > That has led to errors like the following: > > /path/to/oldish/tooldir/bin/ld: cannot find crt0.o: No such file or > directory > > I'm guessing this means that some other environment variables > are not set so the compiler is looking in the wrong place, but > BUILDING is not helping me think of what that would be. All > paths are absolute, except they do include ".." In them. > > What should I be configuring to make sure that a tooldir > compiler is usable?
What I think I would do would be to use HOST_CFLAGS=-fcommon to do a "./build.sh ... tools" build. This should, at least in theory, result in a self-consistent and hopefully working toolchain of the same vintage as the kernel you are trying to build. Try this especially if it's somewhat uncertain where the /path/to/oldish/tooldir was built from. Best regards, - HÃ¥vard