This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Building a Solaris cross compiler
- From: "Mark Cuss" <mcuss at cdlsystems dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Thu, 27 May 2004 16:23:23 -0600
- Subject: Building a Solaris cross compiler
- Reply-to: mcuss at cdlsystems dot com
Hi All
I'm working on building a Solaris cross compiler on my Linux machine. I'm
really new to building compilers so please bear with me. I've looked
through the CrossGCC fact and done some googling but can't seem to make this
work. Hopefully someone can point me in the right direction.
My host machine is a Pentium 4 box running Red Hat 8. I'm attempting to
build the cross compiler using the stock RH8 compiler.
I'm using binutils version 2.14 and gcc 3.4.0.
I've cobbled up the following procedure based upon two different howto's
that I've found on the net. My build environment is set up like this:
Base is ~/cross2
binutils is built in ~/cross2/build-binutils
gcc is built in ~/cross2/build-gcc
everything is installed in ~/cross2/build-install
I've used the following shell file to set up my environment:
export crosssrc=/users/mark/cross2
export host=i686-pc-gnu
export target=sparc-sun-solaris2.9
export prefix=$crosssrc/build-install
export sysroot=$crosssrc/sysroot
export syslibs=$sysroot/usr/lib
export sysincludes=$sysroot/usr/include
I've made my "sysroot" by tarring up /usr/include /usr/ccs/lib /usr/lib and
/lib from my Solaris 9 box.
The procedure - this is what I've tried:
1) Build bin-utils:
I've configured binutils using the following flags:
--host=$host --target=$target --prefix=$prefix -v
This seems to compile and install into the prefix directory without a
problem.
2) Build gcc
First, I do this to add the newly compiled binutils to my path:
export PATH=$prefix/sparc-sun-solaris2.9:$PATH
I then configure gcc using the following flags:
--host=$host --target=$target --with-headers=$sysincludes --with-libs=$sysli
bs --with-gnu-ld --with-gnu-as --prefix=$prefix --enable-languages=c,c++,obj
c
The configure fails with these messages:
[mark@cussy1 build-gcc]$
../gcc-3.4.0/configure --prefix=$prefix --target=$target --host=$host --with
-gnu-as --with-gnu-ld --with-libs=$syslibs --with-headers=$sysincludes --ena
ble-languages=c,c++,objc
creating cache ./config.cache
checking host system type... i686-pc-gnu
checking target system type... sparc-sun-solaris2.9
checking build system type... i686-pc-gnu
checking for a BSD compatible install... /usr/bin/install -c
*** This configuration is not supported in the following subdirectories:
target-libf2c target-libffi target-boehm-gc target-zlib target-libjava
zlib fastjar
(Any other directories should still work fine.)
Copying /users/mark/cross2/sysroot/usr/lib to
/users/mark/cross2/build-install/sparc-sun-solaris2.9/lib
tar: ./pt_chmod: Cannot open: Permission denied
tar: ./uucp/bnuconvert: Cannot open: Permission denied
tar: ./uucp/remote.unknown: Cannot open: Permission denied
tar: ./uucp/uucheck: Cannot open: Permission denied
tar: ./uucp/uucico: Cannot open: Permission denied
tar: ./uucp/uucleanup: Cannot open: Permission denied
tar: ./uucp/uusched: Cannot open: Permission denied
tar: ./uucp/uuxqt: Cannot open: Permission denied
tar: Error exit delayed from previous errors
Copying /users/mark/cross2/sysroot/usr/include to
/users/mark/cross2/build-install/sparc-sun-solaris2.9/sys-include
/tmp/ccQ2EJ2k.s: Assembler messages:
/tmp/ccQ2EJ2k.s:8: Error: Unknown opcode: `pushl'
/tmp/ccQ2EJ2k.s:9: Error: Illegal operands
/tmp/ccQ2EJ2k.s:10: Error: Unknown opcode: `subl'
/tmp/ccQ2EJ2k.s:11: Error: Unknown opcode: `andl'
/tmp/ccQ2EJ2k.s:12: Error: Unknown opcode: `xorl'
/tmp/ccQ2EJ2k.s:13: Error: Unknown opcode: `leave'
*** The command '/usr/bin/gcc -o conftest -O2 conftest.c' failed.
*** You must set the environment variable CC to a working compiler.
The permissions things bugged me - I figured that this was a problem with
permissions on the solaris headers and libs, so I ran this as root. The
permissions errors vanished, byt the unknown opcodes are still there.
Any ideas? As far as I know the gcc on the system is fine.... I tried
setting $CC to my compiler /usr/bin/gcc as the message suggested but to no
avail. If anyone can help me out I'd really appreciate it.
Thanks in advance,
Mark
Mark Cuss, B. Sc.
Real Time Systems Analyst
System Administrator
CDL Systems Ltd
Suite 230
3553 - 31 Street NW
Calgary, AB, Canada
Phone: 403 289 1733 ext 226
Fax: 403 282 1238
www.cdlsystems.com