Problem (and solution?) building m68k-elf cross compiler

William A. Gatliff
Wed Nov 21 12:30:00 GMT 2001


I have built an m68k-elf c++ compiler (host=build=Red Hat Linux 7.1),
but I'm not sure if I like how I did it.  Any suggestions on the
proper way to do this would be most appreciated, and would go into my
build script and FAQ at

Here is the procedure I followed, which comes from my FAQ and script:

# cd build-binutils
# ../binutils-2.11.2/configure --target=m68k-elf; make all install

# cd ../build-gcc
# ../gcc-2.95.3/configure --target=m68k-elf --without-headers \
  --with-newlib --enable-languages=c,c++ --with-gnu-as --with-gnu-ld
# make all-gcc install-gcc

# cd ../build-newlib
# ../newlib-1.9.0/configure --target=m68k-elf; make all install

# cd ../build-gcc && rm -rf *
# ../gcc-2.95.3/configure --target=m68k-elf --enable-languages=c,c++ \
  --with-gnu-as --with-gnu-ld
# make all install

The last step blows up:

make[2]: Entering directory `/home/bgat/build-m68k-elf/build-gcc/m68k-elf/libiberty'
make[2]: *** No targets specified and no makefile found.  Stop.
make[2]: Leaving directory `/home/bgat/build-m68k-elf/build-gcc/m68k-elf/libiberty'
make[1]: *** [../libiberty/libiberty.a] Error 2
make[1]: Leaving directory `/home/bgat/build-m68k-elf/build-gcc/m68k-elf/libstdc++'
make: *** [all-target-libstdc++] Error 2

I've attached the tail end of my
/home/bgat/build-m68k-elf/build-gcc/m68k-elf/libiberty/config.log at
the bottom of this email.  The config.log in
/home/bgat/build-m68k-elf/build-gcc/gcc/libiberty/config.log looks
much better (?).

This seems like a common FAQ, but I didn't have much on it.  Searches
in google and in ml/crossgcc and ml/gcc-help weren't much help either.
Then I found this:

I'm no guru, but what this seems to be doing is providing a default
build target (bcc) and cleaning up some unresolved symbols in
libgcc1-test.c so that the test in libiberty passes.


What, in brief, is this hack all about?  This doesn't seem like the
right way to fix this problem, which makes me think I don't even
understand the problem!  Could someone enlighten me?  Is this similar
to the CFLAGS stuff you have to do for the powerpc-eabi target?

What is the *right* way to build a m68k-elf cross compiler from scratch?

Thanks a bunch!

Bill Gatliff


configure:1765: /home/bgat/build-m68k-elf/build-gcc/gcc/xgcc -B/home/bgat/build-m68k-elf/build-gcc/gcc/ -B/home/bgat/H-i686-pc-linux-gnu/m68k-elf/bin/ -o conftest -g -O2   conftest.c  1>&5
/home/bgat/H-i686-pc-linux-gnu/m68k-elf/bin/ld: warning: cannot find entry symbol _start; defaulting to 80000074
/home/bgat/H-i686-pc-linux-gnu/m68k-elf/lib/crt0.o: In function `start':
/home/bgat/H-i686-pc-linux-gnu/m68k-elf/lib/crt0.o(.text+0x2): undefined reference to `__stack'
/home/bgat/H-i686-pc-linux-gnu/m68k-elf/lib/crt0.o(.text+0x58): undefined reference to `__FINI_SECTION__'
/home/bgat/H-i686-pc-linux-gnu/m68k-elf/lib/crt0.o(.text+0x38): undefined reference to `hardware_init_hook'
/home/bgat/H-i686-pc-linux-gnu/m68k-elf/lib/crt0.o(.text+0x48): undefined reference to `software_init_hook'
/home/bgat/H-i686-pc-linux-gnu/m68k-elf/lib/crt0.o(.text+0x5e): undefined reference to `atexit'
/home/bgat/H-i686-pc-linux-gnu/m68k-elf/lib/crt0.o(.text+0x64): undefined reference to `__INIT_SECTION__'
/home/bgat/H-i686-pc-linux-gnu/m68k-elf/lib/crt0.o(.text+0x84): undefined reference to `exit'
/home/bgat/build-m68k-elf/build-gcc/gcc/libgcc.a(__main.o): In function `__do_global_ctors':
/home/bgat/build-m68k-elf/build-gcc/gcc/../../gcc-2.95.3/gcc/libgcc2.c(.text+0x3a): undefined reference to `atexit'
collect2: ld returned 1 exit status
configure: failed program was:
#line 1760 "configure"
#include "confdefs.h"

[end of config.log]

More information about the Gcc-help mailing list