How can I build a cross compiler for Digital Unix?

Ioannis E. Venetis
Sat Sep 28 08:03:00 GMT 2002


A few days ago I sent a message to the gcc-help mailing list asking how
to build a cross compiler for an alpha-dec-osf system, but had only one
answer that didn't help very much. Today I found this list, so I am trying
my luck here.

I am trying to use the SMTSIM simulator, which simulates the Alpha
processor and adds some extensions to it for multi-threading. According to
the README of the simulator, it runs on Digital Unix and it also accepts
Alpha object code generated on such systems. My problem is that I have no
access to a system with Digital Unix. Therefore, I am porting the
simulator to another system (Origin 2000, R10000 processors, IRIX 6.5) and
I am almost done with it. By porting I mean that it will run on an Origin
2000 system, but the object code it will accept is still Alpha object
code. From the source code of the simulator I can tell that the object
file must be in a.out format. This does not mean much to me, but somehow I
feel that it is important. As you can imagine, I need also a compiler that
will generate object code for Digital Unix systems and a C library and to
build them I need some help, as all my attempts have failed and a few
pages I found searching in the Internet were not very useful.

First let me describe what I have done. I downloaded binutils-2.13,
uncompressed it and tried to configure it on my system (dual Pentium III,
866MHz, RedHat Beta "null"):

~/Temp # tar -xzvf binutils-2.13.tar.gz
~/Temp # mkdir binutils-2.13-build
~/Temp # cd binutils-2.13-build
~/Temp # ../binutils-2.13/configure --prefix=/usr/local/apps/alpha-dec-osf4

The few first lines of the output I get are:

Configuring for a i686-pc-linux-gnu host.
*** This configuration is not supported in the following subdirectories:
     gas ld
    (Any other directories should still work fine.)
Created "Makefile" in /root/Temp/RPMS/CrossGCC/binutils-2.13-build using "mt-frag"
Configuring intl...
creating cache ../config.cache

And finally I installed everything:

~/Temp # make install

With the exception of as and ld all other programs contained in the
binutils package are configured and built without any problems. I tried to
use binutils 2.12, 2.11.2 and 2.11 but all seem to have the same problem.
I found somewhere that I could built binutils with a target of
alpha-coff-osf4 and then replace all occurences of coff with dec in the
produced program files and directories. Therefore I tried:

~/Temp # ../binutils-2.13/configure --prefix=/usr/local/apps/alpha-dec-osf4

This time everything compiled correctly (including as and ld) and in the
installation directory (/usr/local/apps/alpha-dec-osf4) I changed all
occurences of coff with dec, for example:
/usr/local/apps/alpha-dec-osf4/bin/alpha-coff-osf4-as ->

I used osf4 because I found in the documentation of gcc-3.2 that it
doesn't support anything less than osf4.

Having these binutils I tried to build gcc-3.2 with a target
alpha-dec-osf4 (not alpha-coff-osf4 as binutils. This was suggested at the
same web page mentioned earlier):

~/Temp # tar -xzvf gcc-3.2.tar.gz
~/Temp # mkdir gcc-3.2-build
~/Temp # cd gcc-3.2-build
~/Temp # ../gcc-3.2/configure --prefix=/usr/local/apps/alpha-dec-osf4
--target=alpha-dec-osf4 --with-gnu-as --with-gnu-ld

~/Temp # make bootstrap

(After compiling several files)

./xgcc -B./ -B/usr/local/apps/alpha-dec-osf4/alpha-dec-osf4/bin/
-isystem /usr/local/apps/alpha-dec-osf4/alpha-dec-osf4/include
-isystem /usr/local/apps/alpha-dec-osf4/alpha-dec-osf4/sys-include
-O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -isystem ./include  -fPIC -g
-DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -c -o crtfastmath.o
../../gcc-3.2/gcc/config/alpha/crtfastmath.c:47: warning: no previous prototype for
/tmp/cc5ndBJJ.s: Assembler messages:
/tmp/cc5ndBJJ.s:70: Fatal error: unhandled relocation type (null)
make[2]: *** [crtfastmath.o] Error 1
make[2]: Leaving directory `/root/Temp/CrossGCC/gcc-3.2-build/gcc'
make[1]: *** [stage1_build] Error 2
make[1]: Leaving directory `/root/Temp/CrossGCC/gcc-3.2-build/gcc'
make: *** [bootstrap] Error 2

It seems that the experiment with binutils didn't went very well. The
problem is that I don't know what to try out next. Either I don't get as
and ld compiled or I cannot build gcc with the binutils I manage to
compile. Is there any combination of binutils, gcc and/or target (for
example alphaev68-dec-osf4) that I can use to build gcc as a
cross-compiler for a version of Digital Unix? Moreover, do I have to use
any more switches to the configure scripts for binutils and gcc? Does the
host play any role (32-bit Pentium host -> 64-bit Alpha target)? Is there
something else that I am doing wrong? At which point do I have to build
glibc? Any idea or help on this is greatly appreciated, but of course a
pointer to a good resource or a step-by-step explanation of what I have to
do would be even better :-)

Please take into account that it is my first time that I am trying to
build a cross-compiler and unfortunately I haven't been able to find
anywhere a well-organized document that describes the whole procedure.

Thank you in advance for any response,

Ioannis E. Venetis

P.S: If you need any more information for the errors that occur, please
send me a mail and I will provide the information to you.

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list