Kai, Since you seem to know what you are talking about, would you mind documenting this somewhere in the GCC wiki? It is short of amazing that it is 2014 and there is still no simple recipe/script to build a cross-compiler. However, even if there is not official documentation, I see the same answers over and over again in gcc-help. This is a waste of time for the people asking and for the people answering. Moreover, the answers don't get better over time. If instead of answering anew each time, there was a document in the wiki that is progressively updated with new information, it will save time for all and the answers will get better over time. This is the principle I follow when updating http://gcc.gnu.org/wiki/FAQ But in this case, I don't have any clue about cross-compiling, so I will appreciate if someone else took the lead. It doesn't have to be perfect, just rephrase your answer so if in the future somebody asked a similar question you could just point to the wiki. (I am so happy I never had to cross-compile GCC and I will probably never have to.) Cheers, Manuel. On 8 May 2014 20:30, Kai Ruottu <kai.ruottu@xxxxxxxxxxx> wrote: > 8.5.2014 20:10, Christoph K. kirjoitti: >> >> Hi, >> >> I still have the same problem, can anyone help, please?! >> >> I want to compile gcc 4.9.0 as a cross compiler for the msp430 >> architecture. >> >> >> About the prerequisites >> ----------------------- >> Binutils 2.24 sources have been downloaded, a symbolic link >> "binutils" has been created in the gcc source dir. > > > Normally binutils will be built separately, not in the same time with GCC, > during the > "bootstrap" (first time ever) build for the toolchain. And be updated > separately, be > used with many GCC versions for the same target etc. > > >> Then ... >> cd /usr/local/src/gcc-4.9.0 >> ./contrib/download_prerequisites > > > This was made for building native GCCs and forgets which extra prerequisite > a cross > GCC has :( > > >> mkdir /usr/local/src/gcc-4.9.0-build-msp430-elf >> cd /usr/local/src/gcc-4.9.0-build-msp430-elf >> ../gcc-4.9.0/configure --target=msp430-elf \ >> --prefix=/usr/local/msp430-elf --enable-languages=c,c++ > > > The extra prerequisite for a cross GCC of course is having the target C > library preinstalled! > A native target system has it in '/lib', '/usr/include' and '/usr/lib' in an > old Linux/32-bit > case. The exception is an embedded target which uses 'newlib' as its C > library and usually > has only the newlib sources during the "bootstrap" phase. Later one of > course has the > earlier built newlib binaries and headers for the target. So when > bootstraping one needs > to tell that newlib will be used as the target C library via '--with-newlib' > in the GCC configure. > > >> The error >> --------- >> make of gcc fails with the following error: >> ... >> checking for msp430-elf-gcc... \ >> /usr/local/src/gcc-4.9.0-build-msp430-elf/./gcc/xgcc \ >> -B/usr/local/src/gcc-4.9.0-build-msp430-elf/./gcc/ \ >> -B/msp430-elf/bin/ -B/msp430-elf/lib/ \ >> -isystem /msp430-elf/include -isystem /msp430-elf/sys-include >> checking for suffix of object files... configure: error: \ >> in `/usr/local/src/gcc-4.9.0-build-msp430-elf/msp430-elf/libgcc': >> configure: error: cannot compute suffix of object files: cannot compile >> See `config.log' for more details. >> make[1]: *** [configure-target-libgcc] Fehler 1 >> make[1]: Leaving directory `/usr/local/src/gcc-4.9.0-build-msp430-elf' >> make: *** [all] Fehler 2 > > > Probably building libgcc needs some headers from the target C library > headers. If it was > told being newlib, then the configury system would have known where they are > : In the provided > newlib sources, 'newlib' and 'libgloss' subdirs from them being symlinked > into the GCC > sources... > > So please try the normal build phases for a newlib-based (assuming > 'msp430-elf' uses it) > cross GCC : > > 1. configure, build and install GNU binutils for the target > > 2. symlink the 'newlib' and 'libgloss' subdirs from the newlib-x.y.z sources > into the main > GCC source directory just like the 'gmp', 'mpfr' and 'mpc' sources... > > 3. configure, build and install GCC for the target, use '--with-newlib' in > configure. And use > exactly the same '--prefix=$prefix' and '--target=$target' switches as > with the binutils > configure! >