On Mon, 16 Jul 2018 at 08:38, Zoltán Kócsi wrote: > > I'm trying to build gcc 4.5.8 for cross-compilation on a relatively > modern system and it fails on at least two points. > > The system is 64-bit Linux on Intel iron with gcc-6.4.0 as its native > C/C++ compiler. Cross-binutils already installed. > > cd /tmp > tar xfj gcc-4.5.8-tar.bz2 You mean 4.8.5, right? > mkdir build > cd build > ../gcc-4.8.5/configure --target=arm-eabi --enable-languages=c,c++ > --disable-libada --disable-libssp --disable-lto --disable-tls > --without-headers > make all-gcc > > It fails compiling except.c; the compiler command and error message is > in the attached text file. As it turns out, 6.4.0 gcc barfs on > redefining an inline function with the gnu_inline attribute, while > apparently previous compiler version (at least up to 4.7.1) had no > problem with that. The difference is that GCC 6 defaults to C++14, and the old gnu_inline declarations aren't compatible with it. Or something, I can't remember the details. Use: make STAGE1_CXXFLAGS="-O2 -g -std=gnu++98" > Commenting out the offending line with the attribute redefinition in > gcc-4.8.5/gcc/cp/cfns.h helps, but that's just a kludge and not a real > solution. And even then, the compilation fails again when the texinfo > manual is processed: > > ../../gcc-4.8.5/gcc/doc/gcc.texi:88: warning: @tex should only appear > at the beginning of a line > ../../gcc-4.8.5/gcc/doc/gcc.texi:208: no matching `@end tex' > ../../gcc-4.8.5/gcc/doc/gcc.texi:208: no matching `@end multitable' > ../../gcc-4.8.5/gcc/doc/gcc.texi:208: no matching `@end titlepage' > > The texinfo version spitting the dummy is 6.3 while 4.13 processes the > file without a hitch. The simplest solution here is just to add MAKEINFO=missing to the configure arguments, which disables generation of the texinfo documentation. > I'm looking for some advice, what's the canonical way of compiling > older versions of gcc on more recent systems? There isn't one. It's a pain. > Apart from hacking > the source until the compile gets through, that is. You'll probably also need fixes to libgcc: sed -i 's/struct ucontext/ucontext_t/' gcc-4.8.5/libgcc/config/i386/linux-unwind.h and libsanitizer too.