public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Cross compile build problems
@ 2004-09-26  1:26 Brian Rose
  2004-09-26 13:17 ` Ian Lance Taylor
  2004-09-30 22:08 ` Yew-Koon Tan
  0 siblings, 2 replies; 7+ messages in thread
From: Brian Rose @ 2004-09-26  1:26 UTC (permalink / raw)
  To: GCC

I am trying to put together some GNU tools for embedded development. We are
working on a Motorola coldfire 5206e (among others) and I'd like to use
non-commercial tools for development. The target is a microcontroller
without an OS.

I am on a WindowsXP system with the Cygwin library installed. I am using
the following process to build the tools. All of this is done in my
/cygwin/home/brose directory

1) Download the source tarballs into coldfire/archive
2) Extract the sources into coldfire/src
3) Build and install binutils (works fine) like this
     cd $HOME/coldfire
     mkdir builds
     mkdir builds/binutils
     mkdir bins
     mkdir bins/binutils
     cd builds/binutils
     ../../src/binutils-2.15/configure --target=m68k-elf
--prefix=$HOME/coldfire/bins/binutils/ -v
     make all install

4) Attempt to build and install gcc like this
     cd $HOME/coldfire
     mkdir builds/gcc
     mkdir bins/gcc
     cd builds/gcc
     ../../src/gcc-3.4.2/configure --target=m68k-elf
--prefix=$HOME/coldfire/bins/gcc/ -v
     make all install

And I get this...

--snip--
/home/brose/coldfire/tools/build/gcc/gcc/xgcc
-B/home/brose/coldfire/tools/build/gcc/gcc/
-B/home/brose/coldfire/tools/bins/gcc//m68k-elf/bin/
-B/home/brose/coldfire/tools/bins/gcc//m68k-elf/lib/ -isystem
/home/brose/coldfire/tools/bins/gcc//m68k-elf/include -isystem
/home/brose/coldfire/tools/bins/gcc//m68k-elf/sys-include -O2 -DIN_GCC
-DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I.
-I../../../src/gcc-3.4.2/gcc -I../../../src/gcc-3.4.2/gcc/.
-I../../../src/gcc-3.4.2/gcc/../include   -g0 -finhibit-size-directive
-fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss
-fno-unit-at-a-time  \
   -Dinhibit_libc -c ../../../src/gcc-3.4.2/gcc/crtstuff.c -DCRT_BEGIN \
   -o crtbegin.o
as: unrecognized option `-mc68020'
make[1]: *** [crtbegin.o] Error 1
make[1]: Leaving directory `/home/brose/coldfire/tools/build/gcc/gcc'
make: *** [all-gcc] Error 2


I've tried the --with-as=$HOME/coldfire/tools/bins/bintuils/bin/m68k-elf-as 
with no luck.

Has anyone built the current compiler on/for Windows with a m68k target in 
mind? Pray tell, what was the procedure?

Thanks in advance,

--

Brian Rose





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross compile build problems
  2004-09-26  1:26 Cross compile build problems Brian Rose
@ 2004-09-26 13:17 ` Ian Lance Taylor
  2004-09-28 15:35   ` Brian Rose
  2004-09-30 22:08 ` Yew-Koon Tan
  1 sibling, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2004-09-26 13:17 UTC (permalink / raw)
  To: Brian Rose; +Cc: GCC

Brian Rose <lists@brianrose.net> writes:

>      ../../src/binutils-2.15/configure --target=m68k-elf
> --prefix=$HOME/coldfire/bins/binutils/ -v

>      ../../src/gcc-3.4.2/configure --target=m68k-elf
> --prefix=$HOME/coldfire/bins/gcc/ -v

Use the same --prefix for the binutils and gcc.

You may want to look at http://kegel.com/crosstool/

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross compile build problems
  2004-09-26 13:17 ` Ian Lance Taylor
@ 2004-09-28 15:35   ` Brian Rose
  2004-09-28 16:57     ` Ian Lance Taylor
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Rose @ 2004-09-28 15:35 UTC (permalink / raw)
  To: GCC

Ian Lance Taylor wrote:

> Brian Rose <lists@brianrose.net> writes:
> 
> 
>>     ../../src/binutils-2.15/configure --target=m68k-elf
>>--prefix=$HOME/coldfire/bins/binutils/ -v
> 
> 
>>     ../../src/gcc-3.4.2/configure --target=m68k-elf
>>--prefix=$HOME/coldfire/bins/gcc/ -v
> 
> 
> Use the same --prefix for the binutils and gcc.
> 
> You may want to look at http://kegel.com/crosstool/
> 
> Ian
> 

I'll look at the cross tool soon. But for now, I got a little farther by 
using --prefix=$HOME/coldfire/bins on both of them. So my commands look 
like this (from my build directory)...

$ ../../src/gcc-3.4.2/configure --target=m68k-elf --prefix=$HOME/coldfire/bins
$ make all

It seems to get to the libc part and it then dies with this error message...

   configure: error: No support for this host/target configuration.

Looking up in the output I see the following messages...

   checking host system type... m68k-unknown-elf
   checking build system type... i686-pc-cygwin


Is this correct? Shouldn't the host be i686-pc-cygwin? I'm trying to 
develop a compiler that runs on my Windows box (with cygwin) and builds 
binaries for a Motorola coldfire embedded microcontroller with no operating 
system.

What else should I be looking at?

--

Brian






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross compile build problems
  2004-09-28 15:35   ` Brian Rose
@ 2004-09-28 16:57     ` Ian Lance Taylor
  2004-09-28 18:39       ` Brian Rose
  0 siblings, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2004-09-28 16:57 UTC (permalink / raw)
  To: Brian Rose; +Cc: GCC

Brian Rose <lists@brianrose.net> writes:

> $ ../../src/gcc-3.4.2/configure --target=m68k-elf --prefix=$HOME/coldfire/bins
> $ make all
> 
> It seems to get to the libc part and it then dies with this error message...
> 
>    configure: error: No support for this host/target configuration.
> 
> Looking up in the output I see the following messages...
> 
>    checking host system type... m68k-unknown-elf
>    checking build system type... i686-pc-cygwin
> 
> 
> Is this correct? Shouldn't the host be i686-pc-cygwin? I'm trying to
> develop a compiler that runs on my Windows box (with cygwin) and
> builds binaries for a Motorola coldfire embedded microcontroller with
> no operating system.

The above is correct when building code to run on the target, such as
libstdc++-v3.  Code which runs on cygwin, such as gcc, has a host
(and, in this case, build) of cygwin and a target of m68k-elf.  Code
which runs on the m68k-elf target, such as libstdc++-v3, has a host of
m68k-elf and a build of cygwin (and no target, since libstdc++-v3 is
not itself a cross-compilation tool).

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross compile build problems
  2004-09-28 16:57     ` Ian Lance Taylor
@ 2004-09-28 18:39       ` Brian Rose
  2004-09-28 18:41         ` Ian Lance Taylor
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Rose @ 2004-09-28 18:39 UTC (permalink / raw)
  To: rfc822 Compliance issue To: added by system POTENTIAL SPAM; +Cc: GCC

Ian Lance Taylor wrote:

> Brian Rose <lists@brianrose.net> writes:
> 
> 
>>$ ../../src/gcc-3.4.2/configure --target=m68k-elf --prefix=$HOME/coldfire/bins
>>$ make all
>>
>>It seems to get to the libc part and it then dies with this error message...
>>
>>   configure: error: No support for this host/target configuration.
>>
>>Looking up in the output I see the following messages...
>>
>>   checking host system type... m68k-unknown-elf
>>   checking build system type... i686-pc-cygwin
>>
>>
>>Is this correct? Shouldn't the host be i686-pc-cygwin? I'm trying to
>>develop a compiler that runs on my Windows box (with cygwin) and
>>builds binaries for a Motorola coldfire embedded microcontroller with
>>no operating system.
> 
> 
> The above is correct when building code to run on the target, such as
> libstdc++-v3.  Code which runs on cygwin, such as gcc, has a host
> (and, in this case, build) of cygwin and a target of m68k-elf.  Code
> which runs on the m68k-elf target, such as libstdc++-v3, has a host of
> m68k-elf and a build of cygwin (and no target, since libstdc++-v3 is
> not itself a cross-compilation tool).
> 
> Ian
> 
> 


It seemed to be building libc at the time so that makes sense. I guess libc 
needs to have some sort of operating system defined?

I tried building with newlib using the --with-newlib switch and I got the 
following error message...

   error: storage size of 're_comp_buf' isn't known

So maybe newlib will not run on a Coldfire processor? In any event, is 
there any way to tell the process not to compile any libraries? All of our 
software is custom written, so libraries are not really needed.

--

Brian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross compile build problems
  2004-09-28 18:39       ` Brian Rose
@ 2004-09-28 18:41         ` Ian Lance Taylor
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Lance Taylor @ 2004-09-28 18:41 UTC (permalink / raw)
  To: Brian Rose; +Cc: rfc822 Compliance issue To: added by system POTENTIAL SPAM

Brian Rose <lists@brianrose.net> writes:

> It seemed to be building libc at the time so that makes sense. I guess
> libc needs to have some sort of operating system defined?
> 
> I tried building with newlib using the --with-newlib switch and I got
> the following error message...
> 
>    error: storage size of 're_comp_buf' isn't known
> 
> So maybe newlib will not run on a Coldfire processor? In any event, is
> there any way to tell the process not to compile any libraries? All of
> our software is custom written, so libraries are not really needed.

I don't know what sources you are using.  newlib is not part of gcc.
It is a separate package.  Depending on what sources you are using,
gcc is distributed with support libraries for C++, Fortran, Java, and
Ada.

You can compile just gcc by using 'make all-gcc'.  To install it, use
'make install-gcc'.

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Cross compile build problems
  2004-09-26  1:26 Cross compile build problems Brian Rose
  2004-09-26 13:17 ` Ian Lance Taylor
@ 2004-09-30 22:08 ` Yew-Koon Tan
  1 sibling, 0 replies; 7+ messages in thread
From: Yew-Koon Tan @ 2004-09-30 22:08 UTC (permalink / raw)
  To: 'Brian Rose', 'GCC'

I noticed that you didn't specify --enable-languages=c etc flags in
your cross-compilation, the configure script is going to try to build
c++, java, etc. compilers. This would fail because building these
"higher" level language need the headers/libs from newlib which you
haven't build yet (chicken and egg problem). Therefore, you can only
build a C-only compiler at the beginning, build the newlib, and then
if you need other languages, you can use the C-only gcc with the
newlib to compile c++, java, etc. 

I recently got a C-only cross-compiler built and tested using
binutils-2.14, gcc-3.3.3 and newlib-1.12.0 for MIPS32 in Cygwin
on Window XP. I attach the sh script below. You can edit it
to whatever directory structure and target you need. I also
use a similar version of the script to cross-compile in Sun
for MIPS32.

If this build successfully, you would still need to supply the proper
initialization file for your embedded development hardware/simulator,
this is typically called crt0.S (otherwise, you would get a error
when you link your Coldfile program). If you cannot get crt0.S
from your supplier, you can start from newlib-1.12.0/libgloss/m68k/crt0.S
and hack this file to properly init your CPU. You can go to newlib
website http://sources.redhat.com/newlib for more details.

Hope this helps.

PS: There used to be a discussion group called cross-gcc, anybody
    know what happen to it?

YK.

=============================================================
Here is the cross-compile shell script:

#!/bin/sh
PF="/cygdrive/d/tools/test"
TG="mipsisa32-mips-elf"
SD="--enable-multilib=no --program-prefix=bcmx --with-gnu-as --with-gnu-ld
-v"
BD="$PF/$TG/bin"
BM="build"

PATH="$PF/bin:$PATH"

if test "$1" != special
then
  echo "cross-build: configure binutils"
  BDIR=$BM-binutils
  rm -rf $BDIR
  mkdir $BDIR
  cd $BDIR
  ../binutils-2.14/configure --prefix=$PF --target=$TG $SD
  echo "cross-build: compile binutils"
  make all
  echo "cross-build: install binutils"
  make install
  cd ..
fi

if test "$1" != special
then
  echo "cross-build: configure gcc"
  BDIR=$BM-gcc
  rm -rf $BDIR
  mkdir $BDIR
  cd $BDIR
  ../gcc-3.3.3/configure --enable-languages=c --with-newlib --prefix=$PF
--target=$TG $SD
  echo "cross-build: compile gcc"
  make all
  echo "cross-build: install gcc"
  make install
  cd ..
fi

if test "$1" != special
then
  echo "cross-build: configure newlib"
  BDIR=$BM-newlib
  rm -rf $BDIR
  mkdir $BDIR
  cd $BDIR
  ../newlib-1.12.0/configure --with-newlib --host=$TG --prefix=$PF $SD
  echo "cross-build: compile newlib"
  make all CC_FOR_TARGET=$BD/gcc \
       AS_FOR_TARGET=$BD/as \
       LD_FOR_TARGET=$BD/ld \
       AR_FOR_TARGET=$BD/ar \
       RANLIB_FOR_TARGET=$BD/ranlib
  echo "cross-build: install newlib"
  make install
  cd ..
fi

# Bug in gcc-3.3.3? doesn't link/copy automatically.
if test "$1" != special
then
  cd $PF/bin
  ln -s $TG-gcc bcmxgcc
fi

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Brian Rose
Sent: Saturday, September 25, 2004 6:26 PM
To: GCC
Subject: Cross compile build problems


I am trying to put together some GNU tools for embedded development. We are
working on a Motorola coldfire 5206e (among others) and I'd like to use
non-commercial tools for development. The target is a microcontroller
without an OS.

I am on a WindowsXP system with the Cygwin library installed. I am using the
following process to build the tools. All of this is done in my
/cygwin/home/brose directory

1) Download the source tarballs into coldfire/archive
2) Extract the sources into coldfire/src
3) Build and install binutils (works fine) like this
     cd $HOME/coldfire
     mkdir builds
     mkdir builds/binutils
     mkdir bins
     mkdir bins/binutils
     cd builds/binutils
     ../../src/binutils-2.15/configure --target=m68k-elf
--prefix=$HOME/coldfire/bins/binutils/ -v
     make all install

4) Attempt to build and install gcc like this
     cd $HOME/coldfire
     mkdir builds/gcc
     mkdir bins/gcc
     cd builds/gcc
     ../../src/gcc-3.4.2/configure --target=m68k-elf
--prefix=$HOME/coldfire/bins/gcc/ -v
     make all install

And I get this...

--snip--
/home/brose/coldfire/tools/build/gcc/gcc/xgcc
-B/home/brose/coldfire/tools/build/gcc/gcc/
-B/home/brose/coldfire/tools/bins/gcc//m68k-elf/bin/
-B/home/brose/coldfire/tools/bins/gcc//m68k-elf/lib/ -isystem
/home/brose/coldfire/tools/bins/gcc//m68k-elf/include -isystem
/home/brose/coldfire/tools/bins/gcc//m68k-elf/sys-include -O2 -DIN_GCC
-DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I.
-I../../../src/gcc-3.4.2/gcc -I../../../src/gcc-3.4.2/gcc/.
-I../../../src/gcc-3.4.2/gcc/../include   -g0 -finhibit-size-directive
-fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss
-fno-unit-at-a-time  \
   -Dinhibit_libc -c ../../../src/gcc-3.4.2/gcc/crtstuff.c -DCRT_BEGIN \
   -o crtbegin.o
as: unrecognized option `-mc68020'
make[1]: *** [crtbegin.o] Error 1
make[1]: Leaving directory `/home/brose/coldfire/tools/build/gcc/gcc'
make: *** [all-gcc] Error 2


I've tried the --with-as=$HOME/coldfire/tools/bins/bintuils/bin/m68k-elf-as 
with no luck.

Has anyone built the current compiler on/for Windows with a m68k target in 
mind? Pray tell, what was the procedure?

Thanks in advance,

--

Brian Rose








^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-09-30 22:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-26  1:26 Cross compile build problems Brian Rose
2004-09-26 13:17 ` Ian Lance Taylor
2004-09-28 15:35   ` Brian Rose
2004-09-28 16:57     ` Ian Lance Taylor
2004-09-28 18:39       ` Brian Rose
2004-09-28 18:41         ` Ian Lance Taylor
2004-09-30 22:08 ` Yew-Koon Tan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).