This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Can't build m68k-elf target with gcc-3.3.2 or gcc-3.4-20031224tree


>> I have been trying various things for almost a week trying to get 
>> gcc-3.3.2 & gcc-3.4-20031224 to build properly for a target of
>> 'm68k-elf'.
>
>
> I've always been building the m68k-elf target successfully with
> both 3.3.2 and 3.4.
>
>>  I have found several GCC-FAQs that provided several useful hints
>> but I have yet to make it all the way through the build.
>>
>> I am running configure as follows:
>>
>>    ---configure-complete---
>>    ${SHELL}  ${SRCDIR}/configure                                 \
>>            --prefix=$LOCAL                                         \
>>            --target=m68k-elf                                       \
>>            --program-prefix=m68k-elf-                              \
>>            --with-gnu-as                                           \
>>            --with-gnu-ld                                           \
>>            --enable-languages="c,c++,objc"                         \
>>            --disable-nls                                           \
>>            --verbose                                               \
>>            #
>
>
> You can't enable c++ on m68k-elf because it's an embedded target
> and libstdc++ requires an underlying C library to work.
>
> Either do --enable-languages='c' or add --with-newlib and build
> newlib along with (or before) GCC.

I go the newlib route, and its a three step processes(after you've
build binutils for your target and have installed them in ${LOCAL}/bin:

1) configure gcc to build a bootstrap compiler(and making sure that
   configure sees the binutils you already installed):

   cd ${BOOTSTRAP_BUILDDIR}
   export PATH=${LOCAL}/bin:$PATH
   ${GCC_SOURCE_PATH}/configure --target=m68k-elf prefix=${LOCAL} \
     --enable-languages=c --with-local-prefix=${LOCAL}/m68k-elf \
     --without-headers --with-newlib --disable-shared \
     --disable-threads
   make all-gcc
   make install-gcc

2) build newlib using the bootstrap compiler(make sure configure finds
   the bootstrap compiler!):

   cd ${NEWLIB_BUILDDIR}
   export PATH=${LOCAL}/bin:$PATH
   ${NEWLIB_SOURCE_PATH}/configure --target=m68k-elf --prefix=${LOCAL}
   make all
   make install

2a) Since gcc-3.x wants to fixinc the system stdlib.h even though newlib already
    supplies a perfectly good stdlib.h, fake out gcc-3.x (See
    http://gcc.gnu.org/ml/gcc/2003-05/msg01998.html for more info):

    cd ${PREFIX}/${TARGET}/sys-include
    ln -sf ../include/stdlib.h stdlib.h
    ln -sf ../include/unistd.h unistd.h
    ln -sf ../include/string.h string.h
    ln -sf ../include/limits.h limits.h

3) build full-up c/c+ compiler(with the path as above):

   export PATH=${LOCAL}/bin:$PATH
   cd ${GCC_BUILDDIR}
   ${GCC_SOURCE_PATH}/configure --target=m68k-elf \
     --prefix=${LOCAL} --with-newlib \
     --enable-languages=c,c++ \
     --with-local-prefix=${LOCAL}/m68k-elf
   make all
   make install

Hope this helps.  I use this method to build up m68k-elf all the time
as part of my ColdFire work. See http://gcc.gnu.org/ml/gcc/2003-03/msg00764.html
for instruction on how to get my toolchain which includes a Makefile
which builds the full toolchain from scratch...

-- 
Peter Barada
peter@the-baradas.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]