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]

Crosscompiler for powerpc-linux from Cygwin


Hi all,

I am a student working on my thesis and I am working on a GNU cross toolchain 
for powerpc-linux running on a Cygwin host; OS : Win2000 prof. Currently I am 
using the following sources :

  - gcc 2.95.3-5 (cygwin special)
  - glibc 2.2.3
  - binutils 2.11.2
  - linux kernel 2.4.16

tools :
  - Cygwin (DLL 1.3.12-2)

Building binutils and first stage gcc (powerpc-linux-gcc) works fine, but I 
am encountering massive trouble when building glibc. i am using the following 
script :

#!/bin/sh
#
# make.sh: All-in-One Single-Pass Cross-Compiler Build Script Doohickey
#
#          (c) 2001, David A. Desrosiers
#              hacker at gnu dash designs dot com
#

ARCH=powerpc
HOST=i686-pc-linux-gnu
TARGET=$ARCH-linux
PRISTINE=/root/pristine
BUILD=/root/crossdev/build
PREFIX=/usr/local/
HEADERS=/root/kernel/linux/include

########################################################
#
# Set your versions here, without this, everything below will fail in
# wonderfully undesirable ways
#
########################################################
BINUTILS=binutils-2.11.2
GCC=gcc-2.95.3-5
GLIBC=glibc-2.2.3

if [ ! -d $PRISTINE -o ! -d $BUILD -o ! -d $PREFIX ]; then
   echo "$0: configuration error"
   exit
fi

KERNELHOME=/root/kernel/linux
PATH=$PREFIX/bin:$PATH


########################################################
#
# configure, build, and install binutils
#
########################################################

echo "#################################################"
echo "### building $BINUTILS"; date
echo "#################################################"
cd $BUILD
mkdir $BINUTILS-$ARCH
cd $BINUTILS-$ARCH
$PRISTINE/$BINUTILS/configure --prefix=$PREFIX --target=$TARGET \
 --with-headers=$HEADERS 2>&1 | tee ~/pristine/logs/binutilsconf.log

make 2>&1 | tee ~/pristine/logs/binutilsmake.log
make install 2>&1 | tee ~/pristine/logs/binutilsinst.log

########################################################
# configure the kernel for the target architecture
#
########################################################

echo "#################################################"
echo "### configuring kernel for $TARGET-linux"; date
echo "#################################################"
cd $KERNELHOME

########################################################
#
# configure and build the first pass of gcc, we will need two of these. The
# first one is built without threads or glibc support. It is then used to
# build glibc itself, then gcc is built a second time, but this time with
# glibc and thread support.
#
########################################################

echo "#################################################"
echo "### configuring $GCC without glib"; date   
echo "#################################################"

# consider using a path such as $GCC-$ARCH-nolibc, which should be totally
# separate from the second build directory and structure. Not necessary,
# just being anal.

cd $BUILD
mkdir $GCC-$ARCH
cd $GCC-$ARCH

$PRISTINE/$GCC/configure --target=$TARGET  --prefix=$PREFIX 
--enable-languages=c --disable-threads --with-headers=$HEADERS 
--disable-shared --with-cpu=powerpc 2>&1 | tee ~/pristine/logs/gcc1conf.log

########################################################
# patch gcc/Make-target and gcc/Makefile for the first compile phase, that
# happens without use of glibc.  The Makefiles really ought to leave a
# better hook for this step.  I tried overriding the variables from the
# command line, but they don't propagate to make in the gcc subdir.
########################################################
( cd gcc
  mv Make-target Make-target.orig
  sed -e '/^TARGET_LIBGCC2_CFLAGS/s/$/ -Dinhibit_libc -D__gthr_posix_h/' \
      -e 's/ _dvmd_lnx$/ _dvmd_tls/' \
      <Make-target.orig >Make-target
  mv Makefile Makefile.orig
  sed -e '/^TARGET_LIBGCC2_CFLAGS/s/$/ -Dinhibit_libc -D__gthr_posix_h/' \
      -e 's/ _dvmd_lnx$/ _dvmd_tls/' \
      <Makefile.orig >Makefile
)
make 2>&1 | tee ~/pristine/logs/gcc1make.log

########################################################

make install 2>&1 | tee ~/pristine/logs/gcc1inst.log


########################################################
#
# configure, build, and install glibc +crypt +linuxthreads
#
# If we're using glibc 2.1.x or earlier, you will need to add 'crypt' to the
# enable-add-ons line. Since we're using 2.2.3 in this script, and crypt is
# now part of glibc, we no longer need to statically declare it (and doing
# so will cause ./configure to throw an error)
#
########################################################

echo "#################################################"
echo "### building $GLIBC now"; date   
echo "#################################################"
cd $BUILD
mkdir $GLIBC-$ARCH
cd $GLIBC-$ARCH

# The following step needs to find <linux/version.h>, so it has to happen
# after a real build of the kernel.  Or, as the glibc FAQ 1.8 suggests,
# after `make include/linux/version.h'.

CC=$TARGET-gcc $PRISTINE/$GLIBC/configure $TARGET --build=$HOST 
--prefix=$PREFIX/$TARGET --with-headers=$HEADERS 
--enable-add-ons=linuxthreads --program-prefix=$TARGET- 2>&1 | tee 
~/pristine/logs/glibcconf.log

make 2>&1 | tee ~/pristine/logs/glibcmake.log
make install 2>&1 | tee ~/pristine/logs/glibcinst.log

########################################################
#
# Now we can go back and re-build gcc with glibc, g++, and threads support
#
########################################################


echo "#################################################"
echo "### building $GCC second pass"; date   
echo "#################################################"

cd $BUILD/$GCC-$ARCH
$PRISTINE/$GCC/configure --target=$TARGET  --prefix=$PREFIX \
--enable-languages=c,c++ --with-headers=$HEADERS --with-cpu=powerpc 2>&1 | 
tee ~/pristine/logs/gcc2conf.log

make clean
make 2>&1 | tee ~/pristine/logs/gcc2make.log
make install 2>&1 | tee ~/pristine/logs/gcc2inst.log

echo "#################################################"
echo "### DONE! Congratulations!!!"; date   
echo "#################################################"

When I have reached the stage of building glibc I get the following error 
message (this happens in the ../glibc-2.2.3/iconv dorectory) :

powerpc-linux-gcc -nostdlib -nostartfiles -o
/crossdev/build/glibc-2.2.3-powerpc/iconv/iconv_prog
-Wl,-dynamic-linker=/usr/local//powerpc-linux/lib/ld.so.1
/crossdev/build/glibc-2.2.3-powerpc/csu/crt1.o
/crossdev/build/glibc-2.2.3-powerpc/csu/crti.o `powerpc-linux-gcc
--print-file-name=crtbegin.o`
/crossdev/build/glibc-2.2.3-powerpc/iconv/iconv_prog.o
/crossdev/build/glibc-2.2.3-powerpc/iconv/iconv_charmap.o
/crossdev/build/glibc-2.2.3-powerpc/iconv/charmap.o
/crossdev/build/glibc-2.2.3-powerpc/iconv/charmap-dir.o
/crossdev/build/glibc-2.2.3-powerpc/iconv/linereader.o
/crossdev/build/glibc-2.2.3-powerpc/iconv/dummy-repertoire.o
/crossdev/build/glibc-2.2.3-powerpc/iconv/simple-hash.o
/crossdev/build/glibc-2.2.3-powerpc/iconv/xstrdup.o

-Wl,-rpath-link=/crossdev/build/glibc-2.2.3-powerpc:/crossdev/build/glibc-2.2.3-powerpc/math:/crossdev/build/glibc-2.2.3-powerpc/elf:/cros
sdev/build/glibc-2.2.3-powerpc/dlfcn:/crossdev/build/glibc-2.2.3-powerpc/nss:/crossdev/build/glibc-2.2.3-powerpc/nis:/crossdev/build/glibc
-2.2.3-powerpc/rt:/crossdev/build/glibc-2.2.3-powerpc/resolv:/crossdev/build/glibc-2.2.3-powerpc/crypt:/crossdev/build/glibc-2.2.3-powerpc
/linuxthreads
/crossdev/build/glibc-2.2.3-powerpc/libc.so.6
/crossdev/build/glibc-2.2.3-powerpc/libc_nonshared.a -lgcc
`powerpc-linux-gcc --print-file-name=crtend.o`
/crossdev/build/glibc-2.2.3-powerpc/csu/crtn.o
/crossdev/build/glibc-2.2.3-powerpc/iconv/iconv_prog.o: In function
`main':
/pristine/glibc-2.2.3/iconv/iconv_prog.c:138: undefined reference to
`exit'
/pristine/glibc-2.2.3/iconv/iconv_prog.c:138: relocation truncated to
fit: R_PPC_REL24 exit
/pristine/glibc-2.2.3/iconv/iconv_prog.c:311: undefined reference to
`close'
/pristine/glibc-2.2.3/iconv/iconv_prog.c:311: relocation truncated to
fit: R_PPC_REL24 close
/pristine/glibc-2.2.3/iconv/iconv_prog.c:259: undefined reference to
`open'
/pristine/glibc-2.2.3/iconv/iconv_prog.c:259: relocation truncated to
fit: R_PPC_REL24 open
/pristine/glibc-2.2.3/iconv/iconv_prog.c:273: undefined reference to
`__fxstat'
/pristine/glibc-2.2.3/iconv/iconv_prog.c:273: relocation truncated to
fit: R_PPC_REL24 __fxstat

I used the same script on a linux host, and it worked nicely, no error 
messages at all. Several howto's and scripts are telling me to transfer the 
target's runtime environment into /usr/local/lib, /usr/local/include. But the 
configure script (binutils, gcc and glibc) copies headerfiles etc. 
automatically. So I am a bit lost. Do I need to hack those configure scripts ?

The above error message seems to be a linking problem as far as I know.

Maybe it's also worth mentioning that before I came to this problem I have 
had another one, which I seemed to have solved. The build process of glibc 
terminated because cc1 received a signal-11 when in the ../glibc-2.2.3/nss 
directory trying to compile nsswitch.c. Here I changed the lines :

line 358	      /* Construct the function name.  */
line 359	      __stpcpy (__stpcpy (__stpcpy (__stpcpy (name, "_nss_"),
      360					    ni->library->name),
			  "_"),
			fct_name);

to
		strcpy (name, "_nss_");
		strcat (name, ni->library->name);
		strcat (name, "_");
		strcat (name, fct_name);

After that I encountered the above problem.


To sum up : the ultimate goal would be to compile a kernel for powerpc (MPC 
823/855) under Cygwin.

Any help would be very much appreciated. 

Kindest regards,
Peter

-- 
_____________________________________________________
Peter Groessinger
Software Development
TTTech Computertechnik AG
Schoenbrunner Strasse 7, A-1040 Vienna, Austria
http://www.tttech.com

Phone: +43(1)585 34 34-42, Fax: +43(1)585 34 34-90
mailto: groessinger@tttech.com
_____________________________________________________
TTA-Group Forum, November 15, Munich, Germany
Infos and registration at http://www.ttagroup.org


------
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]