powerpc64-linux-g++ host types

Alan Modra amodra at bigpond.net.au
Thu Feb 13 13:24:49 EST 2003


On Wed, Feb 12, 2003 at 12:13:32PM -0600, Bradley Harrington wrote:
> The barrier seems to be, the requirement of glibc, which will not configure
> on AIX.  Any help at all would be greatly appreciated.

I've attached some instructions I wrote some time ago (they may be a
little stale) for bootstrapping cross-toolchains.

--
Alan Modra
IBM OzLabs - Linux Technology Centre
-------------- next part --------------
PowerPC64 toolchain bootstrapping.

The following assumes you want to build a full powerpc64-linux
toolchain including glibc for use in a cross-toolchain environment,
starting from a system with no powerpc64 tools installed, and that
you have the correct sources available.  The examples configure lines
are for an i686-linux host installing tools to the default prefix of
/usr/local.  Adjust to suit your system, and the location of your
binutils, gcc, linux etc. sources.

1)  Build binutils

mkdir /tmp/binutils
cd /tmp/binutils
/src/binutils-current/configure --prefix=/usr/local \
 --build=i686-linux --host=i686-linux --target=powerpc64-linux \
 --disable-nls
make
su
make install
exit

Note: On a powerpc-linux system it's possible to build a biarch set
of binutils that handles both powerpc-linux and powerpc64-linux.  In
that case, you would configure using something like:

/src/binutils-current/configure --prefix=/usr/local \
 --build=powerpc-linux --host=powerpc-linux --target=powerpc-linux \
 --enable-targets=powerpc64-linux --disable-nls

Besides reducing the number of toolchain binaries on your system,
this has the advantage of enabling some features of ld only available
on native toolchains (ie. with host == target).

2) Build gcc

First make sure your PATH includes /usr/local/bin so you have access
to the binutils you installed in step (1).

Edit /src/gcc-ppc64-3.2/gcc/config/rs6000/linux.h, and replace
the line "#ifdef IN_LIBGCC2" with "#if 0"  We don't have any glibc
or kernel headers yet.  Alternatively, steal a copy of the headers
from somewhere and install to /usr/local/powerpc64-linux/include/

mkdir /tmp/gcc
cd /tmp/gcc
/src/gcc-ppc64-3.2/configure --prefix=/usr/local \
 --build=i686-linux --host=i686-linux --target=powerpc64-linux \
 --disable-nls --disable-threads --disable-shared --enable-languages=c
make
su
make install
exit

3) Build a powerpc64-linux kernel

This step is necessary to generate kernel headers used by glibc
and gcc.  <Insert kernel build instructions>

4) Build glibc

The changed --prefix and --host below are _not_ typos.

mkdir /tmp/glibc
cd /tmp/glibc
/src/glibc-ppc64/configure --prefix=/usr/local/powerpc64-linux \
 --build=i686-linux --host=powerpc64-linux --target=powerpc64-linux \
 --with-headers=/src/linux-2.4.19/include --without-cvs \
 --enable-add-ons --enable-shared --disable-sanity-checks
make
su
make install

# Add links to kernel headers, or copy them if you like
cd  /usr/local/powerpc64-linux/include/
ln -s /src/linux-2.4.19/include/asm-ppc64 asm
ln -s /src/linux-2.4.19/include/linux linux

# Make /usr/local/powerpc64-linux writable for the next gcc compile
# The reason being that --with-headers copies include/ to sys-include/
# You need --with-headers for gcc's limits.h to be properly generated
# with #include_next to pick up the "real" limits.h, and to adjust
# libgcc support now that you have glibc installed.
chmod 777 /usr/local/powerpc64-linux

# If your host is powerpc-linux and you intend running powerpc64 apps on
# the host, link (or copy) powerpc64-linux ld.so to the standard location
mkdir /lib64
ln -s ../usr/local/powerpc64-linux/lib/ld.so.1 /lib64/ld64.so.1
exit

5) Rebuild gcc, with more language support

Undo the change to linux.h you made in step 2.

rm -rf /tmp/gcc
mkdir /tmp/gcc
cd /tmp/gcc
/src/gcc-ppc64-3.2/configure --prefix=/usr/local \
 --build=i686-linux --host=i686-linux --target=powerpc64-linux \
 --disable-nls --enable-shared --enable-languages=c,c++,f77 \
 --with-headers=/usr/local/powerpc64-linux/include
make
su
make install
chmod 755 /usr/local/powerpc64-linux
exit

That's it!


More information about the Linuxppc64-dev mailing list