Cross g++ for 68332

Aug 02, 2004 4 Replies

We want to evaluate g++ as an alternative to our current compiler. We do need a full C++ compiler.



Following links I found in this group some time ago, I found

formatting link



First I tried the precompiled kit at that site, but it seems incomplete. Taking the sources from gnu.org plus patches and script from the site above is a little bit better, but still libstdc++ is not built.



Google did not find the clue. Logically libstdc++ should be built _after_ the cross compiler is built and installed, but the instructions in the GCC kit are scarce when it comes to _cross_ compilers.



A hint would be welcome.


Mogens Dybæk Christensen e-mail mdc at mail dot tele dot dk

Wish granted ;-)

formatting link

Michael N. Moran (h) 770 516 7918 5009 Old Field Ct. (c) 678 521 5460 Kennesaw, GA, USA 30144 http://mnmoran.org "... abstractions save us time working, but they don't save us time learning." Joel Spolsky, The Law of Leaky Abstractions The Beatles were wrong: 1 & 1 & 1 is 1

Thanks, good link! About GCC for embedded Linux, and good links.

But this is for a system running an RTOS without file system or TCP/IP, so an m68k-elf-compiler with newlib fits better.

I have mailed with Avi Stuart, who made the kit I first tried

formatting link
He says it should be possible to build C++ applications with his kit.

Will post an update if we find a solution, but you have to wait till I am back from vacation. :-)

Mogens Dybæk Christensen e-mail mdc at mail dot tele dot dk

I currently am using:

Binutils: 2.13.2.1

newlib-1.11.0

gcc-3.3

GCC configured as follows: Configured with: ../gcc-3.3/configure --target=m68k-elf

--prefix=/tools/gnu/gcc/3.3/m68k-elf --with-newlib

--enable-languages=c c++

From ftp://ftp.gnu.org/gnu (or mirror):

  1. Download binutils
  2. Download GCC (all relavant C/C++ parts)
  3. Download newlib

Here's my m68k-elf build script for binutils. I assume you've unpacked the binutils sources, created a build directory "binutils-build" next to the unpacked sources. Then:

$ cd binutils-build $ ../m68k-elf-binutils.build

========= m68k-elf-binutils.build ========== #!/bin/bash

../binutils-2.13.2.1/configure \ --target=m68k-elf \ --prefix=/tools/gnu/gcc/3.3/m68k-elf

make CFLAGS="-O2 -fomit-frame-pointer" make install

===================================

Here's my m68k-elf build script for GCC. I assume you've unpacked the GCC sources and newlib sources, created a build directory "build" in the same directory. Then:

$ cd build $ export PATH=$PATH:/tools/gnu/gcc/3.3/m68k-elf/bin $ ../m68k-elf-gcc.build

============= m68k-elf-gcc.build ================ #!/bin/bash

# Note: need to set PATH to point at binutils m68k-elf/bin

rm -f ../gcc-3.3/newlib

ln -s ../../../newlib/1.11.0/newlib-1.11.0/newlib ../gcc-3.3/newlib

BINUTILS_PATH=/tools/gnu/gcc/3.3/m68k-elf/bin

export PATH=$PATH:$BINUTILS_PATH

../gcc-3.3/configure \ --target=m68k-elf \ --prefix=/tools/gnu/gcc/3.3/m68k-elf \ --with-newlib \ --enable-languages="c c++"

make CFLAGS="-O2 -fomit-frame-pointer" > make.temp 2>&1

make install ===================================================

Of course, you have to have permission to write the install directory (--prefix) in both installations.

Michael N. Moran (h) 770 516 7918 5009 Old Field Ct. (c) 678 521 5460 Kennesaw, GA, USA 30144 http://mnmoran.org "... abstractions save us time working, but they don't save us time learning." Joel Spolsky, The Law of Leaky Abstractions The Beatles were wrong: 1 & 1 & 1 is 1

Thanks a lot! I have just returned to work, and will try your scripts soon.

Mogens Dybæk Christensen e-mail mdc at mail dot tele dot dk

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required