This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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: Build a cross compiler on an intel/linux plateform


Thanks for this help.
I can build without any problem binutil 2.12 for the target rs6000-aix
plateform.
But when I try to built gcc 3.1 with the command # make LANGUAGES=c all-gcc,
i('ve got this error :

SHLIB_MULTILIB=''; \
gcc -DIN_GCC -DCROSS_COMPILE   -g -O2 -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic
-Wno-long-long  -DHAVE_CONFIG_H    -I. -I. -I. -I./. -I./config
-I./../include \
  -DSTANDARD_STARTFILE_PREFIX=\"../../../\"
-DSTANDARD_EXEC_PREFIX=\"/usr/local/crossgcc/lib/gcc-lib/\"
-DDEFAULT_TARGET_VERSION=\"3.1\" -DDEFAULT_TARGET_MACHINE=\"rs6000-aix\"
-DSTANDARD_BINDIR_PREFIX=\"/usr/local/crossgcc/bin/\"
-DTOOLDIR_BASE_PREFIX=\"../../../../\" `test "X${SHLIB_LINK}" = "X" || test
"yes" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` `test "X${SHLIB_MULTILIB}"
= "X" || echo "-DNO_SHARED_LIBGCC_MULTILIB"` \
  -c ./gcc.c -o gcc.o)
In file included from ./gcc.c:154:
configargs.h:2: warning: string length `724' is greater than the minimum
length `509' ISO C89 is required to support
./gcc.c:672: warning: string length `775' is greater than the minimum length
`509' ISO C89 is required to support
./gcc.c:833: warning: string length `679' is greater than the minimum length
`509' ISO C89 is required to support
In file included from specs.h:1,
                 from ./gcc.c:863:
cp/lang-specs.h:38: warning: string length `1003' is greater than the
minimum length `509' ISO C89 is required to support
./gcc.c:1409: warning: string length `982' is greater than the minimum
length `509' ISO C89 is required to support
./gcc.c:1409: warning: string length `768' is greater than the minimum
length `509' ISO C89 is required to support
(SHLIB_LINK='' \
SHLIB_MULTILIB=''; \
gcc -DIN_GCC -DCROSS_COMPILE   -g -O2 -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic
-Wno-long-long  -DHAVE_CONFIG_H    -I. -I. -I. -I./. -I./config
-I./../include \
  -DSTANDARD_STARTFILE_PREFIX=\"../../../\"
-DSTANDARD_EXEC_PREFIX=\"/usr/local/crossgcc/lib/gcc-lib/\"
-DDEFAULT_TARGET_VERSION=\"3.1\" -DDEFAULT_TARGET_MACHINE=\"rs6000-aix\"
-DSTANDARD_BINDIR_PREFIX=\"/usr/local/crossgcc/bin/\"
-DTOOLDIR_BASE_PREFIX=\"../../../../\" `test "X${SHLIB_LINK}" = "X" || test
"yes" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` `test "X${SHLIB_MULTILIB}"
= "X" || echo "-DNO_SHARED_LIBGCC_MULTILIB"` \
  -c ./gccspec.c -o gccspec.o)
gcc -DIN_GCC -DCROSS_COMPILE   -g -O2 -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic
-Wno-long-long  -DHAVE_CONFIG_H  -o xgcc gcc.o gccspec.o intl.o \
  prefix.o version.o  ./intl/libintl.a   ../libiberty/libiberty.a
gcc -c -DIN_GCC -DCROSS_COMPILE   -g -O2 -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic
-Wno-long-long  -DHAVE_CONFIG_H    -I. -I. -I. -I./. -I./config
-I./../include cppmain.c -o cppmain.o
gcc -DIN_GCC -DCROSS_COMPILE   -g -O2 -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic
-Wno-long-long  -DHAVE_CONFIG_H  -o cpp0 cppmain.o \
intl.o libcpp.a ./intl/libintl.a   ../libiberty/libiberty.a
/usr/src/redhat/BUILD/gcc-3.1/gcc/xgcc -B/usr/src/redhat/BUILD/gcc-3.1/gcc/
-nostdinc -B/usr/src/redhat/BUILD/gcc-3.1/rs6000-aix/newlib/ -isystem
/usr/src/redhat/BUILD/gcc-3.1/rs6000-aix/newlib/targ-include -isystem
/usr/src/redhat/BUILD/gcc-3.1/newlib/libc/include
-B/usr/local/crossgcc/rs6000-aix/bin/ -B/usr/local/crossgcc/rs6000-aix/lib/
-isystem /usr/local/crossgcc/rs6000-aix/include -dumpspecs > tmp-specs
mv tmp-specs specs
echo "int xxy_us_dummy;" >tmp-dum.c
/usr/src/redhat/BUILD/gcc-3.1/gcc/xgcc -B/usr/src/redhat/BUILD/gcc-3.1/gcc/
-nostdinc -B/usr/src/redhat/BUILD/gcc-3.1/rs6000-aix/newlib/ -isystem
/usr/src/redhat/BUILD/gcc-3.1/rs6000-aix/newlib/targ-include -isystem
/usr/src/redhat/BUILD/gcc-3.1/newlib/libc/include
-B/usr/local/crossgcc/rs6000-aix/bin/ -B/usr/local/crossgcc/rs6000-aix/lib/
-isystem /usr/local/crossgcc/rs6000-aix/include -S tmp-dum.c
echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c
if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \
  echo "int prepends_underscore = 1;" >>tmp-under.c; \
else \
  echo "int prepends_underscore = 0;" >>tmp-under.c; \
fi
/bin/sh ./move-if-change tmp-under.c underscore.c
underscore.c is unchanged
rm -f tmp-dum.c tmp-dum.s
echo timestamp > s-under
gcc -DIN_GCC -DCROSS_COMPILE   -g -O2 -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic
-Wno-long-long  -DHAVE_CONFIG_H  -o Tcollect2 \
        collect2.o tlink.o hash.o intl.o underscore.o version.o
./intl/libintl.a   ../libiberty/libiberty.a
collect2.o: In function `main':
/usr/src/redhat/BUILD/gcc-3.1/gcc/./collect2.c:1150: undefined reference to
`resolve_lib_name'
collect2: ld returned 1 exit status
make[1]: *** [collect2] Erreur 1
make[1]: Quitte le répertoire `/usr/src/redhat/BUILD/gcc-3.1/gcc'
make: *** [all-gcc] Erreur 2

Can someone have a solution for this or a solution for build a cross gcc for
an rs6000-aix plateform.

Many Thanks your help.

Mike

-----Message d'origine-----
De : lit_mouse [mailto:lit_mouse0@hotmail.com]
Envoyé : vendredi 5 juillet 2002 15:47
À : Camalet, Mike
Objet : Re: Build a cross compiler on an intel/linux plateform


May be the follow can help you:
The follow is a build a cross compile on cygwin not at RH7.3 but i think it
is same.
Good Lock!

%%howto-version: 1.0
%%title: Building Cygwin hosted newlib-based target toolchain 
%%url: http://www.nanotech.wisc.edu/~khan/software/gnu-win32/
%%category: cygwin
%%filename: cygwin-to-newlib-cross-howto
%%author: Mumit Khan

This howto provides a roadmap to building a newlib-based target
development toolchain such as powerpc-eabi hosted on Cygwin 
(ix86-pc-cygwin) platform. Even though I am using Cygwin as the host
in this HOWTO, the information here is just as applicable to other hosts.

TOC:
  - Background
  - Preliminaries
  - Build steps
  - Postscript

Created: Thu Jan 25 11:10:11 CST 2001
Last Modified: Thu Jan 25 15:05:13 CST 2001

Background:
===========

When it comes to cross-compiling (the simple kind or the canadian kind),
three terms are very important -- host, target and build. The host is
the machine that the resulting toolchain will run on, the build is the
machine that the resulting toolchain are being built on, and target is
the machine that resulting toolchain will create binaries for. The most
usual case is where host == build == target (eg., if you're using a Linux
compiler on a Linux box that was created on a Linux box); in the case of
most cross-compilers, host == build, target is different (eg., host and
build could be say Linux and target could be say i686-pc-cygwin, so that
when you compile/link on Linux box using this toolchain, you create
binaries that will run on i686-pc-cygwin); in the case of building a 
canadian cross compiler, host, build and target may all be different
(I'll refrain from expounding on this one, and leave it to your 
imagination).

Ok, so let's say we have a PC running Win2k and Cygwin, and we want to
able to build powerpc-eabi binaries on that PC. The runtime library
for that target is newlib, which should be quite known to those who
are into this sort of thing. This HOWTO is applicable to all supported
GCC targets that use newlib as the runtime library, and I just happen
to be using powerpc-eabi as an example.

CrossGCC folks use various schemes, and I personally find those too
complicated, but do it my way mostly because I'm too lazy to read the 
instructions.

Here're the basic steps: (Preliminaries) Decide on where you want to 
install and so on, (1) Gather all the source packages you need, move 
these over to the Cygwin host, (2) Build and install Binutils, (3) Build 
and install *just* the C compiler in GCC, then (4) use the C compiler
just installed to build and install newlib, and finally (5) go back 
and build the rest of the compilers and language support runtimes in
GCC and install those as well. Postscript shows a simple example,
and shows how to avoid GCC from always adding .exe to the executable
name (if you want to avoid that, read that before step 3).

There is one thing to note here -- you will run into the term "single
tree" build, which means that all the required components are in one
tree, and set up so that you can simply do a `configure', followed by
a `make', and you're good to go without having to go through the steps
I have outlined here. However, unless you already have a tested and
verified single-tree configuration such as GNUPro formerly from Cygnus 
Solutions and now from RedHat if you are a customer, you are much better 
off building each piece individually. One might think that building a 
single tree out of all the individual pieces is trivial -- just unpack 
on top of each other, and then combine all the common pieces. Try that 
with different versions of bfd included in binutils and in gdb, and 
you'll soon run into a disaster. Stick with multiple separate packages, 
and you will not regret the extra keystrokes. It is after all scriptable, 
so keystrokes go down to just a few.

For the purposes of this HOWTO, I've used the following packages:

1. Cygwin   -- 1.1.7 (with all updates applied to date)
2. GCC      -- 2.95.2-6 (part of Cygwin source distribution)
3. Binutils -- 2.10.1 (standard GNU distribution)
4. newlib   -- 1.9.0 (http://sources.redhat.com/newlib/)

Preliminaries:
==============

Scattered throughout this article are user commands that you'll type
in, and I've used ``cygwin$'' as the shell prompt.

Let's say we'll be using the following (I'm using bash, so if you're 
using a csh/tcsh type shell, do the right thing):
  
  cygwin$ host=i686-pc-cygwin
  cygwin$ build=i686-pc-cygwin
  cygwin$ target=powerpc-eabi
  cygwin$ prefix=/usr/local/powerpc
  cygwin$ src_root=/usr/local/src/gnu

Feel free to change $prefix and/or $src_root to match your environment,
but please don't mess with $host, $build and $target. Do make sure that
$src_root directory does exist. You don't have to set these shell 
variables of course, but it saves me some typing and saves you from my 
inevitable typos.

You should also add $prefix/bin to your PATH, but you can wait till you
have installed binutils for that (ie., end of Step 2).

Step 1:
=======
Gather all the source packages you need. The minimal set is the compiler
sources, binary utilities.

Let's say we get the following from a GNU or RedHat sourceware mirror:
  
  gcc-2.95.2.tar.gz
  binutils-2.10.1.tar.gz
  newlib-1.9.0.tar.gz

Since we're building on a Cygwin host, the safe bet is to get a version
of gcc-2.95.2 from the Cygwin distribution instead which may have some
Cygwin specific fixes, which is what I use. See Cygwin home page at
http://sources.redhat.com/cygwin/ to see how to download the GCC source 
package using the network "setup" utility (or just ftp it over from one
the mirrors). At the time of this writing, the latest one is gcc-2.95.2-6.

Download these on your Cygwin box and unpack:
  
  cygwin$ cd $src_root
  cygwin$ tar zxf /tmp/gcc-2.95.2.tar.gz
  cygwin$ tar zxf /tmp/binutils-2.10.1.tar.gz
  cygwin$ tar zxf /tmp/newlib-1.9.0.tar.gz

Step 2:
=======

Build and install binutils. Never build in the source tree, so I'll just 
arbitrarily pick $src_root/BUILD as the top build directory, under which
I'll build both binutils and gcc.

  cygwin$ mkdir -p $src_root/BUILD/binutils
  cygwin$ cd $src_root/BUILD/binutils
  cygwin$ $src_root/binutils-2.10.1/configure \
    --with-included-gettext \
    --target=$target --host=$host --build=$build \
    --prefix=$prefix -v
  cygwin$ make > make.log 2>&1

If all goes well, install.

  cygwin$ make install > install.log 2>&1

*IMPORTANT* Add $prefix/bin to your PATH Before going forward.
  
  cygwin$ export PATH=$PATH:$prefix/bin

Check:

  cygwin$ $target-ld --version
  GNU ld 2.10.1
  Copyright 2000 Free Software Foundation, Inc.
  This program is free software; you may redistribute it under the terms of
  the GNU General Public License.  This program has absolutely no warranty.
    Supported emulations:
     elf32ppc

Done.

Step 3:
=======

Build and install *just the C compiler* from GCC. 

  cygwin$ mkdir -p $src_root/BUILD/gcc
  cygwin$ cd $src_root/BUILD/gcc
  cygwin$ $src_root/gcc-2.95.2/configure \
    --enable-languages=c,c++ \
    --with-included-gettext --enable-shared --enable-threads \
    --target=$target --host=$host --build=$build \
    --with-newlib \
    --prefix=$prefix -v

Feel free to change the arguments to --enable-languages, or leave it 
out altogether if you want to build all available languages. Also, 
do as you wish with --enable-shared and --enable-threads parameters.
Don't mess with the rest. The --with-newlib is critical since it
tells the compiler not to try to include stdlib.h and unistd.h when
building libgcc.a, which is built as part of the core C compiler
build (short answer: the configure script defines the inhibit_libc
macro, which in turn guards against certain target includes in
gcc/libgcc2.c file).

Now, please note that we're specifically only building the C compiler
and just that.

  cygwin$ make LANGUAGES=c all-gcc > make.log 2>&1
  cygwin$ mv make.log make-c-only.log

If all goes well, install.

  cygwin$ make LANGUAGES=c install-gcc > install.log 2>&1
  cygwin$ mv install.log install-c-only.log

Now you can build C code with the installed compiler. You could have
also built the C++ compiler as well, but since we don't need that for
building newlib, let's hold on till we're done with step 4.

Step 4:
=======

Build and install newlib:

  cygwin$ mkdir -p $src_root/BUILD/newlib
  cygwin$ cd $src_root/BUILD/newlib
  cygwin$ $src_root/newlib-1.9.0/configure \
    --target=$target --host=$host --build=$build \
    --prefix=$prefix -v

  cygwin$ make > make.log 2>&1

If all goes well, install.

  cygwin$ make install > install.log 2>&1

Now you have the target environment in place, and you can build the
rest of the world.

Step 5:
=======

Build and install the rest of the GCC compilers and language runtime
and/or support libraries.

  cygwin$ cd $src_root/BUILD/gcc
  cygwin$ make > make.log 2>&1
  cygwin$ make install > install.log 2>&1


----- Original Message ----- 
From: "Camalet, Mike" <Mike.Camalet@par.galileo.com>
To: <crossgcc@sources.redhat.com>
Sent: Friday, July 05, 2002 9:29 PM
Subject: Build a cross compiler on an intel/linux plateform


> Hi,
> 
> I'm a beginner on Linux and cross compiler.
> I installed an RedHat 7.3 on a intel machine and I want to build a cross
> compiler for rs6000-ibm-aix, and soon other machines like hpux, m68K
etc....
> 
> How can do this ?
> Should I get the rpm source (binutils and gcc) and rebuild them, or doing
> something else ?
> 
> Thanks a lot for your help.
> 
> Mike
> 
> 
> 
> 
> 
> The information in this electronic mail message is sender's business
> Confidential and may be legally privileged.  It is intended solely for the
> addressee(s).  Access to this Internet electronic mail message by anyone
> else is unauthorized.  If you are not the intended recipient, any
> disclosure, copying, distribution or any action taken or omitted to be
taken
> in reliance on it is prohibited and may be unlawful. 
> The sender believes that this E-mail and any attachments were free of any
> virus, worm, Trojan horse, and/or malicious code when sent. This message
and
> its attachments could have been infected during  transmission. By reading
> the message and opening any attachments, the recipient accepts full
> responsibility for taking protective and remedial action about viruses and
> other defects. Galileo International is not liable for any loss or damage
> arising in any way from this message or its attachments.
> 
> 
> 
> ------
> Want more information?  See the CrossGCC FAQ,
http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to
crossgcc-unsubscribe@sources.redhat.com
> 


The information in this electronic mail message is sender's business
Confidential and may be legally privileged.  It is intended solely for the
addressee(s).  Access to this Internet electronic mail message by anyone
else is unauthorized.  If you are not the intended recipient, any
disclosure, copying, distribution or any action taken or omitted to be taken
in reliance on it is prohibited and may be unlawful. 
The sender believes that this E-mail and any attachments were free of any
virus, worm, Trojan horse, and/or malicious code when sent. This message and
its attachments could have been infected during  transmission. By reading
the message and opening any attachments, the recipient accepts full
responsibility for taking protective and remedial action about viruses and
other defects. Galileo International is not liable for any loss or damage
arising in any way from this message or its attachments.



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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