This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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: Help with Gcc-3.0.3 cross-compile


Thank you very much Jim for all your help.

I have managed to get much further than before and better understand what
the whole cross compile process is.

I wanted to share what I have learned so far about building GCC for
cross-compile on IA32 to IA64.
Also, wanted to see if you or anyone on the list can make sense what the
error (at the bottom) means.

So the steps I followed are:
-I got the /usr/include and /usr/lib for an IA64 system by installing what
Red Hat 7.1
 distributes in it's IA64 distribution.  That was achieved by:
	+ mkdir -p /home/cross-compile/glibc-ia64/var/lib/rpm
	+ rpm -ivh glibc-2.2.4-19.3.ia64.rpm
--root=/home/cross-compile/glibc-ia64 --ignorearch --nodeps --noscripts
--force
	  same thing for glibc-common, glibc-profile and glibc-devel RPMs
for ia64.
	+ cd /home/cross-compile ; mkdir gcc-build ; mkdir binutils-build
	+ tar -zvxf binutils-2.11.2.tar.gz
	+ tar -zvxf gcc-3.1-expr (got from gcc cvs)
	+ cd binutils-build
	+ ../binutils-2.11.2/configure --target=ia64-pc-linux-gnu
--prefix=/usr/local/ia64-cross -v
	+ make all install
	>> binutils built and installed just fine.
	+ cd ../gcc-build
	+ ../gcc-3.1-expr/configure --target=ia64-pc-linux-gnu
--prefix=/usr/local/ia64-cross \
	    --with-libs=../../glibc-ia64/usr/lib \
	    --with-headers=../../glibc-ia64/usr/include -v

	+ make all
	>> broke for missing kernel include files in linux and asm, fixed
by:
	+ ln -s /usr/src/linux/include/linux
/usr/local/ia64-cross/ia64-pc-linux-gnu/sys-include/linux
	+ ln -s /usr/src/linux/include/asm-ia64
/usr/local/ia64-cross/ia64-pc-linux-gnu/sys-include/asm
	+ make all
	>> Build broke complaining about not finding "ia64-pc-linux-gnu-ar",
fixed by:
	+ export PATH=$PATH:/usr/include/ia64-cross/bin	
	+ make all
	>> build broke "/lib/libc.so.6.1" (sorry forgot to capture what
needed it, but I think it was ld)
	>> fixed by:
	+ cp /home/cross-compile/glibc-ia64/lib/* /usr/local/ia64-cross/lib
//libc.so.6.1 in there now
	+ make all
	>> Build breaks

Begin***********************************************************************
***********

Making all in libsupc++
make[3]: Entering directory
`/home/cross-compile/cross-build/gcc-build/ia64-pc-linux-gnu/libstdc++-v3/li
bsupc++'
/bin/sh ../libtool --tag CXX --tag disable-shared --mode=compile
/home/cross-compile/cross-build/gcc-build/gcc/xgcc
-B/home/cross-compile/cross-build/gcc-build/gcc/ -nostdinc++
-L/home/cross-compile/cross-build/gcc-build/ia64-pc-linux-gnu/libstdc++-v3/s
rc
-L/home/cross-compile/cross-build/gcc-build/ia64-pc-linux-gnu/libstdc++-v3/s
rc/.libs -B/usr/local/ia64-cross//ia64-pc-linux-gnu/bin/
-B/usr/local/ia64-cross//ia64-pc-linux-gnu/lib/ -isystem
/usr/local/ia64-cross//ia64-pc-linux-gnu/include
-I../../../../gcc-3.1-beta/libstdc++-v3/../gcc
-I../../../../gcc-3.1-beta/libstdc++-v3/../include
-I/home/cross-compile/cross-build/gcc-build/ia64-pc-linux-gnu/libstdc++-v3/i
nclude/ia64-pc-linux-gnu
-I/home/cross-compile/cross-build/gcc-build/ia64-pc-linux-gnu/libstdc++-v3/i
nclude -I../../../../gcc-3.1-beta/libstdc++-v3/libsupc++   -g -O2
-D_GNU_SOURCE -fno-implicit-templates -prefer-pic -Wall -Wno-format -W
-Wwrite-strings -Winline  -fdiagnostics-show-location=once
-ffunction-sections -!
 fdata-sections  -g    -c
../../../../gcc-3.1-beta/libstdc++-v3/libsupc++/eh_exception.cc
/home/cross-compile/cross-build/gcc-build/gcc/xgcc
-B/home/cross-compile/cross-build/gcc-build/gcc/ -nostdinc++
-L/home/cross-compile/cross-build/gcc-build/ia64-pc-linux-gnu/libstdc++-v3/s
rc
-L/home/cross-compile/cross-build/gcc-build/ia64-pc-linux-gnu/libstdc++-v3/s
rc/.libs -B/usr/local/ia64-cross//ia64-pc-linux-gnu/bin/
-B/usr/local/ia64-cross//ia64-pc-linux-gnu/lib/ -isystem
/usr/local/ia64-cross//ia64-pc-linux-gnu/include
-I../../../../gcc-3.1-beta/libstdc++-v3/../gcc
-I../../../../gcc-3.1-beta/libstdc++-v3/../include
-I/home/cross-compile/cross-build/gcc-build/ia64-pc-linux-gnu/libstdc++-v3/i
nclude/ia64-pc-linux-gnu
-I/home/cross-compile/cross-build/gcc-build/ia64-pc-linux-gnu/libstdc++-v3/i
nclude -I../../../../gcc-3.1-beta/libstdc++-v3/libsupc++ -g -O2
-D_GNU_SOURCE -fno-implicit-templates -Wall -Wno-format -W -Wwrite-strings
-Winline -fdiagnostics-show-location=once -ffunction-sections
-fdata-sections -g -c
../../../../gcc-3.1-beta/libstdc++-v3/libsupc++/eh_exception.!
 cc  -fPIC -DPIC -o eh_exception.o
/tmp/ccPW5LKa.s: Assembler messages:
/tmp/ccPW5LKa.s:300: Error: Unknown opcode `data16.ua
@iplt(_ZNSt13bad_exceptionD1Ev#)'
/tmp/ccPW5LKa.s:301: Error: Unknown opcode `data16.ua
@iplt(_ZNSt13bad_exceptionD0Ev#)'
/tmp/ccPW5LKa.s:302: Error: Unknown opcode `data16.ua
@iplt(_ZNKSt9exception4whatEv#)'
/tmp/ccPW5LKa.s:312: Error: Unknown opcode `data16.ua
@iplt(_ZNSt9exceptionD1Ev#)'
/tmp/ccPW5LKa.s:313: Error: Unknown opcode `data16.ua
@iplt(_ZNSt9exceptionD0Ev#)'
/tmp/ccPW5LKa.s:314: Error: Unknown opcode `data16.ua
@iplt(_ZNKSt9exception4whatEv#)'
make[3]: *** [eh_exception.lo] Error 1
make[3]: Leaving directory
`/home/cross-compile/cross-build/gcc-build/ia64-pc-linux-gnu/libstdc++-v3/li
bsupc++'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
`/home/cross-compile/cross-build/gcc-build/ia64-pc-linux-gnu/libstdc++-v3'
make[1]: *** [all-recursive-am] Error 2
make[1]: Leaving directory
`/home/cross-compile/cross-build/gcc-build/ia64-pc-linux-gnu/libstdc++-v3'
make: *** [all-target-libstdc++-v3] Error 2

****************************************************************************
********End

Any ideas?

Are the steps listed above valid?

Thank you so much for your time.

--
Tariq




-----Original Message-----
From: Jim Wilson [mailto:wilson@redhat.com]
Sent: Tuesday, February 12, 2002 12:57 PM
To: Shureih, Tariq
Cc: gcc@gcc.gnu.org
Subject: Re: Help with Gcc-3.0.3 cross-compile 


>Does that apply even if what I am trying to produce is a tools chain to be
>distributed in a "Development" environment that supports both IA32 and
IA64?

I think this kind of thing is best left to the OS system vendors because it
can be very complicated.  I don't even try to do it myself.  I let the Red
Hat
OS group build the toolchains and libraries for me.

Another thing, because IA-64 linux support is still so new, there is a very
good chance that trying to build your own compiler different from the system
compiler will fail, because of ABI incompatibilities.  This is going to be
a serious problem until we have a gcc 3.1 release and systems that use gcc
3.1
as the system compiler.  It may be OK with systems using gcc 3.0.2 and later
as the system compiler, but I am unsure.

>This is my goal, to provide a root-jail environment which developers can
use
>to develop and validate code for both IA32 and IA64.

Validating IA-64 code on an IA-32 machine implies a simulator environment.
It would be much easier to use the HP IA-64 Linux Developer's Kit than to
create your own.

You should build the IA-32 and IA-64 environments separately, so make things
simpler.

>When I ran configure with --target=ia64-pc-linux-gnu
>--prefix=/home/cross-ia64, my intent was to build the include and lib that
>will be later used with gcc cross compile.
>I didn't think it was going to work, but sure enough, "make all" worked,
>didn't make sense, but I didn't question it.

Alexandre Oliva answered this.  The --target option is meaningless for
glibc.
You need to use --host instead.

>So, if that's not the correct way to produce the headers and libs to be
used
>with gcc cross compile, where do I get, or how do I build, the "target"
>headers and libs.  

You don't build them.  You create them by copying them from the target
system.
Log into the target IA-64 system.  Run tar on /usr/include and /usr/lib.
Copy the tar file to the IA-32 host.  Untar.

If you need to build your own glibc for some reason, then what you are doing
is far too complicated for me to explain in email, mainly because I don't
know enough about how to do it.  See above where I said I let the system
vendors do this work for me.

>Last, does redhat or any other linux distributor provide such package?  A
>cross-ia64 development package that I can install in my redhat 7.1 for
>example and have both IA64 and IA32 tool chains?

HP has one, though I am not sure if the compiler in it is up-to-date.
http://www.software.hp.com/products/LIA64/overview2a.htm

Red Hat OS group does not distribute cross compilers that I am aware of.
The Red Hat tools group does for customers, and we did provide cross
compilers for the Trillian group for about a year and half, until IA-64
systems were working well enough that we didn't need cross compilers
anymore.

It shouldn't be hard to build your own cross-compiler, as long as you only
build a cross-compiler, and don't try to build the entire world including
glibc.

Jim


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