On 1 Feb 2008, at 8:31 AM, Gerard Demm wrote:
../gcc-4.2.2/configure --prefix=/home/lfel/gnu-sh/ --target=sh-linux --without-headers --enable-languages="c" --disable-shared --disable-threads --disable-libssp I modified "gcc-4.2.2/gcc/config/sh/linux-unwind.h" because it includes signal.h, which isn't there (--without-headers option passed to configure, so why is it looking for signal.h?)
I believe that any --target that includes 'linux' automatically overrides --without-headers, because libgcc would be built with platform support that's so specific it requires the libc headers (which seems really dumb to me, because the kernel should not depend on libc). http://gcc.gnu.org/install/configure.html has:
--without-headersTells GCC not use any target headers from a libc when building a cross compiler. When crossing to GNU/Linux, you need the headers so GCC can build the exception handling for libgcc.
Therefore, use a target like --target=sh-elf. This annoyance can be gotten around by renaming the resulting binaries by hand, or by using --program-prefix and --program-suffix, though don't use those manglers on binutils, because they won't be found when building gcc. Ugh!
I had to disable libmudflap and libssp. Now I get the following error message when building libiberty: [....] checking for a 64-bit type... unsigned long long checking for pid_t... no checking for library containing strerror... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
Nothing can be linked, because there is no libc for the target. If you want to build a fully working cross compiler, you'll need a fully working libc and headers for the target. This can be gotten by copying the libraries and headers from the target or building them yourself with a cross compiler, as the following shows (my understanding only): (1) Configure to build a gcc --without-headers and with --target=sh=elf (2) make all-gcc install-gcc # This specifies you're only concerned # with the tools, rather than the libs. (3) Use the cross compiler you just built to build the libc for the target. Install this libc and its headers into some directory, $SYSROOT. (4) Reconfigure the gcc source using --with-sysroot to specify $SYSROOT. (5) make all install; I've never actually done this process, but that's what I understand to do off the top of my head. Sincerely, Michael Witten