problem - ia64 gcc-3.2.3-glibc-2.3.2 cross compile using crosstool

Peter Leggett P.Leggett@gre.ac.uk
Wed Jan 18 16:02:00 GMT 2006


Hi,

I have an ia64 cross compile problem. If anyone can help I would be
grateful.

I need to compile some code and send it as a library for use by a remote end user.
Their system is ia64 gcc-3.2.3-glibc-2.3.2.

I have non-root access to a local ia64 system configured as follows:-

Linux ladon1 2.4.3-12smp #1 SMP Fri Jun 8 13:06:07 EDT 2001 ia64 unknown
% /usr/bin/gcc -v
Reading specs from /usr/lib/gcc-lib/ia64-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
% rpm -q glibc
glibc-2.2.3-10

I.E. both gcc and glibc are older versions that the ones i need to compile
and provide libraries for.

I am unable to get the machine's OS/compiler or glibc updated so this has lead
me to trying to use crosstool to compile gcc-3.2.3-glibc-2.3.2. Ideally I want
to be able to run this new gcc-glibc combo directly on my local ia64 box.

My first attempt was to attempt to compile gcc-3.2.3-glibc-2.3.2 on the
local ia64 box directly using an adapted demo-ia64.sh

[lp01@hersh crosstool-0.38]$ more ia64.sh
#!/bin/sh
set -ex
TARBALLS_DIR=/home/psp/public/crosstool
RESULT_TOP=/home/psp/pkg/crosstool/ia64-unknown-linux-gnu
GCC_EXTRA_CONFIG=--disable-gcc-checking
GLIBC_EXTRA_CONFIG=--disable-gcc-checking
BINUTILS_EXTRA_CONFIG=--disable-gcc-checking
export TARBALLS_DIR RESULT_TOP
export GCC_EXTRA_CONFIG
export GLIBC_EXTRA_CONFIG
export BINUTILS_EXTRA_CONFIG
GCC_LANGUAGES="c"
export GCC_LANGUAGES
http_proxy=www-proxy.gre.ac.uk:3128
export http_proxy
mkdir -p $RESULT_TOP
eval `cat ia64.dat gcc-3.2.3-glibc-2.3.2.dat`        sh all.sh  --notest
echo Done.

This gave up as follows:-
..
..
+ CC=gcc
+ /home/psp/pkg-src/crosstool-0.38/build/ia64-unknown-linux-gnu/gcc-3.2.3-glibc-2.3.2/glibc-2.3.2/configure --prefix=/usr 
--build=ia64-unknown-linux-gnu --host=ia64-unknown-linux-gnu --without-cvs --disable-sanity-checks 
--with-headers=/home/psp/pkg/crosstool/ia64-unknown-linux-gnu/gcc-3.2.3-glibc-2.3.2/ia64-unknown-linux-gnu/ia64-unknown-linux-gnu/include 
--enable-hacker-mode --disable-gcc-checking
checking build system type... ia64-unknown-linux-gnu
checking host system type... ia64-unknown-linux-gnu
checking sysdep dirs... sysdeps/ia64/elf sysdeps/unix/sysv/linux/ia64 sysdeps/unix/sysv/linux sysdeps/gnu sysdeps/unix/common 
sysdeps/unix/mman sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix sysdeps/posix sysdeps/ia64/fpu sysdeps/ia64 sysdeps/wordsize-64 
sysdeps/ieee754/ldbl-96 sysdeps/ieee754/dbl-64 sysdeps/ieee754/flt-32 sysdeps/ieee754 sysdeps/generic/elf sysdeps/generic
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for pwd... /bin/pwd
checking for ia64-unknown-linux-gnu-gcc... gcc
checking version of gcc... 2.96, bad
checking for gnumake... no
checking for gmake... gmake
checking version of gmake... 3.79.1, ok
configure: error:
*** These critical programs are missing or too old: gcc
*** Check the INSTALL file for required versions.

OK, so then I tried to produce an gcc-3.2.3-glibc-2.3.2 via a two stage "cross compile" (I hope
I have used the correct terminology here) using another x86 based machine.

STAGE 1
---------
The first stage was performed on an i686 box I have access too. It's details are:-

[lp01@hersh crosstool-0.38]$ uname -a
Linux hersh 2.4.22-ow1 #1 SMP Mon Sep 15 02:16:18 BST 2003 i686 i686 i386 GNU/Linux
[lp01@hersh crosstool-0.38]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix 
--disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
[lp01@hersh crosstool-0.38]$ rpm -q glibc
glibc-2.3.2-27.9.7
[lp01@hersh crosstool-0.38]$

The script I used was :-

[lp01@hersh crosstool-0.38]$ more cross-compile-stage1-ia64.sh
#!/bin/sh
set -ex
unset LD_LIBRARY_PATH
TARBALLS_DIR=/home/psp/public/crosstool
RESULT_TOP=/home/psp/pkg/crosstool/`config.guess`
export TARBALLS_DIR RESULT_TOP
export GCC_EXTRA_CONFIG
export GLIBC_EXTRA_CONFIG
export BINUTILS_EXTRA_CONFIG
GCC_LANGUAGES="c"
export GCC_LANGUAGES
mkdir -p $RESULT_TOP
eval `cat ia64.dat gcc-3.2.3-glibc-2.3.2.dat`        sh all.sh --notest
[lp01@hersh crosstool-0.38]$

This produced a ia64 compiler that ran on the i686 box and would compile
and link an ia64 executable that runs on my local ia64 box fine and also
the end user's box. Hurray! But this still does not give me a compiler that
runs directly on the ia64 box which is really what i would like to achieve.

STAGE 2
---------

I attempted to use the compiler from stage 1 to compile a "native" ia64 compiler
that will run on my local ia64 box and allow me to compile, link and run code
from a gcc-3.2.3-glibc-2.3.2 combo.

The script I used was :-

#!/bin/sh
set -ex
unset LD_LIBRARY_PATH
TARBALLS_DIR=/home/psp/public/crosstool
RESULT_TOP=/home/psp/pkg/crosstool/ia64-unknown-linux-gnu
CROSS_COMPILER_DIR=/home/psp/pkg/crosstool/i686-pc-linux-gnu/gcc-3.2.3-glibc-2.3.2/ia64-unknown-linux-gnu/bin
CC=$CROSS_COMPILER_DIR/ia64-unknown-linux-gnu-gcc
AR=$CROSS_COMPILER_DIR/ia64-unknown-linux-gnu-ar
RANLIB=${CROSS_COMPILER_DIR}/ia64-unknown-linux-gnu-ranlib
PATH=${CROSS_COMPILER_DIR}:${PATH}
export CC AR RANLIB PATH
GCC_EXTRA_CONFIG=--disable-gcc-checking
GLIBC_EXTRA_CONFIG=--disable-gcc-checking
BINUTILS_EXTRA_CONFIG=--disable-gcc-checking
GCC_HOST=ia64-unknown-linux-gnu
export GCC_HOST
export TARBALLS_DIR RESULT_TOP
export GCC_EXTRA_CONFIG
export GLIBC_EXTRA_CONFIG
export BINUTILS_EXTRA_CONFIG
GCC_LANGUAGES="c"
export GCC_LANGUAGES
mkdir -p $RESULT_TOP
eval `cat ia64.dat gcc-3.2.3-glibc-2.3.2.dat`        sh all.sh --notest

N.B. I had to pass in RANLIB as well as CC and AR to get this to run through.
      (use of RANLIB is not mentioned in the crosstool howto)

The whole of stage2 appears to compile ok.

However, although I can use the new compiler on the ia64 box to compile it is failing at the link stage
with the message:-

/home/psp/pkg/crosstool/ia64-unknown-linux-gnu/gcc-3.2.3-glibc-2.3.2/ia64-unknown-linux-gnu/lib/gcc-lib/ia64-unknown-linux-gnu/3.2.3/../../../../ia64-unknown-linux-gnu/bin/ld: 
/lib/libc.so.6.1: version `GLIBC_2.3' not found (required by 
/home/psp/pkg/crosstool/ia64-unknown-linux-gnu/gcc-3.2.3-glibc-2.3.2/ia64-unknown-linux-gnu/lib/gcc-lib/ia64-unknown-linux-gnu/3.2.3/../../../../ia64-unknown-linux-gnu/bin/ld)

If I run ld directly I get :-

[lp01@ladon1 src]$ 
/home/psp/pkg/crosstool/ia64-unknown-linux-gnu/gcc-3.2.3-glibc-2.3.2/ia64-unknown-linux-gnu/lib/gcc-lib/ia64-unknown-linux-gnu/3.2.3/../../../../ia64-unknown-linux-gnu/bin/ld
/home/psp/pkg/crosstool/ia64-unknown-linux-gnu/gcc-3.2.3-glibc-2.3.2/ia64-unknown-linux-gnu/lib/gcc-lib/ia64-unknown-linux-gnu/3.2.3/../../../../ia64-unknown-linux-gnu/bin/ld: 
/lib/libc.so.6.1: version `GLIBC_2.3' not found (required by 
/home/psp/pkg/crosstool/ia64-unknown-linux-gnu/gcc-3.2.3-glibc-2.3.2/ia64-unknown-linux-gnu/lib/gcc-lib/ia64-unknown-linux-gnu/3.2.3/../../../../ia64-unknown-linux-gnu/bin/ld)
[lp01@ladon1 src]$

The error message presumbly means that ld is failing to find the correct glibc
libraries to actually run itself.

My glibc and gcc build knowledge is basically 10 days old now :-( and after quite a lot
of googling I've not got any furthur. Can anyone shed light on what I need to do to
get the link stage to work please ? What is the bit of magic i've missed out ?

Thank you for any help you can provide.

Regards,

Pete


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



More information about the crossgcc mailing list