Help - Search - Members - Calendar
Full Version: gcc 3.2
OESF Forums > Distros, Development, and Model Specific Forums > Everything Development > Linux Applications
ced
Hi,

Where can I find a FAQ/HOWTO to setup an ARM cross-compiler using gcc 3.2.x?

Ced.
lardman
I've just set one up (partially at least, I didn't compile my own binutils but used the ones from an existing OZ GCC 3.x cross-toolchain to save me the effort, and my toolchain's working fine), what do you want to know?


Si
ced
just installation instructions step by step... :-)
Richjn
ced

I am in the process of setting up a gcc 3.3.2 cross compiler and am trying to follow the instructions here

http://paipai.org/~humorum/pukiwiki/pukiwi...php?ZaurusSelf2

Hope this proves of some help

Richard
lardman
Right this is what I did for my toolchain:

Get the one on which I was going to base it (for the headers, various libs and binutils)

http://www.openzaurus.org/official/toolcha...s-3.3.2.tar.bz2

I extracted this toolchain so that it sits in /usr/local/arm/3.3.2 (note that it won't work from here, it should be placed in /opt/cross I think - there's a readme in the parent dir, but this is where I wanted mine to end up.

Copy /usr/local/arm/3.3.2/arm-linux/sys-include to /usr/local/arm/3.3.2/sys-include (this is what GCC expects I think, or perhaps I just did it for the hell of it, can't remember)

Extract gcc-3.3.2.tar.gz somewhere, make a build dir which is not in the source tree as it recommends then use the following configure (alter the languages to your particular liking - read the /INSTALL/ files, it tells you quite a bit, including working out which are available):

../gcc-3.3.2/configure --disable-shared --enable-languages='c,c++,f77' --target=arm-linux --prefix='/usr/local/arm/3.3.2' --with-headers=/usr/local/arm/3.3.2/arm-linux/sys-include --with-libs=' '/usr/local/arm/3.3.2/arm-linux/lib /usr/local/arm/3.3.2/lib' '

After that finishes, make, then make install and there you go.


Si

P.S. I'm sure I didn't need to specify everything as I did but it worked for me. A couple of things to note, use a fresh extract of GCC if it all goes wrong and you have to ./configure again. I don't think make distclean actually does what it says on the tin, probably also worth using a fresh


BTW for my toolchain this is what I use in my dev-arm-OZ.sh script:

=======================================
#!/bin/bash

CC=arm-linux-gcc
CXX=arm-linux-g++
CCX=arm-linux-gcc
CXXX=arm-linux-g++
COMPILER=arm-linux-gcc
LINKER=arm-linux-g++
G77=arm-linux-g77
F77=arm-linux-g77

PATH=/usr/local/arm/3.3.2/bin:/usr/local/arm/3.3.2/arm-linux/bin:$PATH

PS1='!OZ-dev-armu@h:w$ '

export PATH CC CXX CCX CXXX COMPILER LINKER G77 F77
echo "Altered environment for OZ 3.3.2 Development"
========================================
ced
thx dude, I'll try that later... :-)
ced
what I done so far:

- untar http://www.openzaurus.org/official/toolcha...s-3.3.2.tar.bz2 to / (unpack it in /op/cross)

- untar ftp://ftp.mirror.ac.uk/sites/ftp.gnu.org/...cc-3.3.2.tar.gz somewhere

- I didn't specify the language option because I want all the languages

CC=/opt/cross/bin/arm-linux-gcc ../gcc-3.3.2/configure --disable-shared --target=arm-linux --prefix=/opt/cross --with-headers=/opt/cross/arm-linux/sys-include --with-libs=/opt/cross/arm-linux/lib

- if I specify --with-libs="/op/cross/arm-linux/lib /opt/cross/lib" then it complained about:

CODE
Configuring zlib...

configure: warning: /opt/cross/lib: invalid host type

loading cache ../config.cache

configure: error: can only configure for one host and one target at a time

Configure in /home/cedric/upload/compiler/bluid/zlib failed, exiting.

- I get this during the make

CODE
make[1]: Entering directory `/home/cedric/upload/compiler/bluid/libiberty'

make[2]: Entering directory `/home/cedric/upload/compiler/bluid/libiberty/testsuite'

make[2]: Nothing to be done for `all'.

make[2]: Leaving directory `/home/cedric/upload/compiler/bluid/libiberty/testsuite'

make[1]: Leaving directory `/home/cedric/upload/compiler/bluid/libiberty'

make[1]: Entering directory `/home/cedric/upload/compiler/bluid/zlib'

: make; exec true "AR_FLAGS=rc" "CC_FOR_BUILD=/opt/cross/bin/arm-linux-gcc" "CFLAGS=-O2 -Wa,-mfpu=fpa11 -mcpu=xscale" "CXXFLAGS=-g -O2" "CFLAGS_FOR_BUILD=" "CFLAGS_FOR_TARGET=-O2 -O2 -Wa,-mfpu=fpa11 -mcpu=xscale" "INSTALL=/bin/sh /home/cedric/upload/compiler/gcc-3.3.2/install-sh -c" "INSTALL_DATA=/bin/sh /home/cedric/upload/compiler/gcc-3.3.2/install-sh -c -m 644" "INSTALL_PROGRAM=/bin/sh /home/cedric/upload/compiler/gcc-3.3.2/install-sh -c " "INSTALL_SCRIPT=/bin/sh /home/cedric/upload/compiler/gcc-3.3.2/install-sh -c" "LDFLAGS=" "LIBCFLAGS=-O2 -Wa,-mfpu=fpa11 -mcpu=xscale" "LIBCFLAGS_FOR_TARGET=-O2 -O2 -Wa,-mfpu=fpa11 -mcpu=xscale" "MAKE=make" "MAKEINFO=makeinfo --no-split " "PICFLAG=" "PICFLAG_FOR_TARGET=" "SHELL=/bin/sh" "EXPECT=expect" "RUNTEST=runtest" "RUNTESTFLAGS=" "exec_prefix=/opt/cross" "infodir=/opt/cross/info" "libdir=/opt/cross/lib" "prefix=/opt/cross" "tooldir=/opt/cross/arm-linux" "AR=ar" "AS=as" "CC=/opt/cross/bin/arm-linux-gcc" "CXX=c++" "LD=ld" "LIBCFLAGS=-O2 -Wa,-mfpu=fpa11 -mcpu=xscale" "NM=nm" "PICFLAG=" "RANLIB=ranlib" "DESTDIR=" DO=all multi-do

make[1]: Leaving directory `/home/cedric/upload/compiler/bluid/zlib'

make[1]: Entering directory `/home/cedric/upload/compiler/bluid/fastjar'

make[1]: Leaving directory `/home/cedric/upload/compiler/bluid/fastjar'

make[1]: Entering directory `/home/cedric/upload/compiler/bluid/gcc'

./gengenrtl -h > tmp-genrtl.h

/bin/sh: line 1: ./gengenrtl: cannot execute binary file

make[1]: *** [s-genrtl] Error 126

make[1]: Leaving directory `/home/cedric/upload/compiler/bluid/gcc'

make: *** [all-gcc] Error 2



PS: I'm using RedHat 9 for my cross compile host
lardman
QUOTE
CC=/opt/cross/bin/arm-linux-gcc ../gcc-3.3.2/configure --disable-shared --target=arm-linux --prefix=/opt/cross --with-headers=/opt/cross/arm-linux/sys-include --with-libs=/opt/cross/arm-linux/lib 


Are you trying to create a native ARM GCC toolchain?? Because that's what the above will try to do (unfortunatley as you've only specificed that the arm-linux-gcc should be used to compile it's probably pretty confused).

If you plan to make a native arm toolchain (not a cross toolchain), then you need to modify the script I posted above, source it before running configure, and also use --host=arm-linux probably...

If you want to make a cross-toolchain (which runs on you desktop box and creates ARM code), then get rid of the CC=.... stuff and make sure you've not sourced the script at all.


Si
ced
I'm trying to create cross-toolchain, I'm a bit confused...

$ gcc --version
CODE
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)


$ ../gcc-3.3.2/configure --disable-shared --target=arm-linux --prefix=/opt/cross --with-headers=/opt/cross/arm-linux/sys-include --with-libs=/opt/cross/arm-linux/lib
CODE
Configuring for a i686-pc-linux-gnu host.

Created "Makefile" in /home/cedric/upload/compiler/build using "mt-frag"

../gcc-3.3.2/configure: line 8: arm-linux-gcc: command not found

*** The command 'arm-linux-gcc -o conftest -g -O2   conftest.c' failed.

*** You must set the environment variable CC to a working compiler.
lardman
It looks like you still have CC exported (and pointing to the arm version of GCC).

See whether 'export' indicates a CC variable.

Try opening up a new terminal and running configure again.

Another thing which may have happened is that configure has cached CC and you would therefore need to run 'make distclean' to get rid of the cache.

Try this (are you sure that not specifying the languages defaults to all, it may do but I'd check):

../gcc-3.3.2/configure --disable-shared --target=arm-linux --prefix='/opt/cross' --with-headers=/opt/cross/arm-linux/sys-include --with-libs=' '/opt/cross/arm-linux/lib /opt/cross/lib' '


Si
ced
the language stuff it's stated in the readme/install file

I've started again from fresh...

unpack the cross-3.3.2
uppack the gcc3.3.2

CODE
../gcc-3.3.2/configure --disable-shared --target=arm-linux --prefix=/opt/cross --with-headers=/opt/cross/arm-linux/sys-include --with-libs=/opt/cross/arm-linux/lib


after 1/2h of compilation I get this...

CODE
make GCC_FOR_TARGET="/home/cedric/upload/compiler/build/gcc/xgcc -B/home/cedric/upload/compiler/build/gcc/ -B/opt/cross/arm-linux/bin/ -B/opt/cross/arm-linux/lib/ -isystem /opt/cross/arm-linux/include"

 BUILD_PREFIX="" BUILD_PREFIX_1="loser-"

 AR_FOR_TARGET="arm-linux-ar"

 AR_CREATE_FOR_TARGET="arm-linux-ar  rc"

 AR_FLAGS_FOR_TARGET=""

 CFLAGS="-g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long "

 RANLIB_FOR_TARGET="arm-linux-ranlib"

 RANLIB_TEST_FOR_TARGET="[ -f arm-linux-ranlib ] || ( [ "i686-pc-linux-gnu" = "arm-unknown-linux-gnu" ] && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )"

 NM_FOR_TARGET="/opt/cross/arm-linux/bin/nm" AWK="gawk"

 LIBGCC2_CFLAGS="-O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include  -fomit-frame-pointer -fPIC -g0 -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED "

 INCLUDES="-I. -I. -I../../gcc-3.3.2/gcc -I../../gcc-3.3.2/gcc/. -I../../gcc-3.3.2/gcc/config -I../../gcc-3.3.2/gcc/../include"

 CONFIG_H="tconfig.h " MACHMODE_H="machmode.h machmode.def ../../gcc-3.3.2/gcc/config/arm/arm-modes.def"

 LIB1ASMSRC='arm/lib1funcs.asm'

 MAKEOVERRIDES=

 -f libgcc.mk all

make[2]: Entering directory `/home/cedric/upload/compiler/build/gcc'

for d in libgcc; do

 if [ -d $d ]; then true; else /bin/sh ../../gcc-3.3.2/gcc/mkinstalldirs $d; fi;

done

if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi

rm -rf ./libgcc.a

arm-linux-ar  rc ./libgcc.a libgcc/./_udivsi3.o libgcc/./_divsi3.o libgcc/./_umodsi3.o libgcc/./_modsi3.o libgcc/./_dvmd_lnx.o libgcc/./_muldi3.o libgcc/./_negdi2.o libgcc/./_lshrdi3.o libgcc/./_ashldi3.o libgcc/./_ashrdi3.o libgcc/./_ffsdi2.o libgcc/./_clz.o libgcc/./_cmpdi2.o libgcc/./_ucmpdi2.o libgcc/./_floatdidf.o libgcc/./_floatdisf.o libgcc/./_fixunsdfsi.o libgcc/./_fixunssfsi.o libgcc/./_fixunsdfdi.o libgcc/./_fixdfdi.o libgcc/./_fixunssfdi.o libgcc/./_fixsfdi.o libgcc/./_fixxfdi.o libgcc/./_fixunsxfdi.o libgcc/./_floatdixf.o libgcc/./_fixunsxfsi.o libgcc/./_fixtfdi.o libgcc/./_fixunstfdi.o libgcc/./_floatditf.o libgcc/./_clear_cache.o libgcc/./_trampoline.o libgcc/./__main.o libgcc/./_exit.o libgcc/./_absvsi2.o libgcc/./_absvdi2.o libgcc/./_addvsi3.o libgcc/./_addvdi3.o libgcc/./_subvsi3.o libgcc/./_subvdi3.o libgcc/./_mulvsi3.o libgcc/./_mulvdi3.o libgcc/./_negvsi2.o libgcc/./_negvdi2.o libgcc/./_ctors.o libgcc/./_divdi3.o libgcc/./_moddi3.o libgcc/./_udivdi3.o libgcc/./_umoddi3.o libgcc/./_udiv_w_sdiv.o libgcc/./_udivmoddi4.o libgcc/./unwind-dw2.o libgcc/./unwind-dw2-fde-glibc.o libgcc/./unwind-sjlj.o libgcc/./unwind-c.o libgcc/./_eprintf.o libgcc/./_bb.o libgcc/./__gcc_bcmp.o

make[2]: arm-linux-ar: Command not found

make[2]: *** [libgcc.a] Error 127

make[2]: Leaving directory `/home/cedric/upload/compiler/build/gcc'

make[1]: *** [libgcc.a] Error 2

make[1]: Leaving directory `/home/cedric/upload/compiler/build/gcc'

make: *** [all-gcc] Error 2
lardman
Oops, yes that's normal. I forgot about it.

In the command below make sure you only add the path to the bin directory which holds the files which are called arm-linux-*, otherwise the compilation will break.

So do something like:

'export PATH=$PATH:/opt/cross/arm-linux/bin'

Though it might be:

'export PATH=$PATH:/opt/cross/bin'

I'm not in front of my Linux box at the moment so I can't tell you. After you've done this just run 'make' again and it will pick off where it left off.

Sorry,


Si
ced
export PATH=$PATH:/opt/cross/bin did the trick!

Thanks a lot.
Ced.
ced
I've try to compile a simple Qtopia example with my new cross-compiler and it failed to find the qtopia library (undefined reference to <widget name>)

the only thing I've changed is my PATH:

from -> PATH=/opt/Embedix/tools/bin:$PATH
to -> PATH=/opt/cross/bin:$PATH

It's ok to compile an ARM binary using the old cross-compiler (gcc 2.95).
Do I need to re-compile the qtopia library using gcc3? or do I need to do something else?


Is it possible to upgrade the default Sharp ROM (1.32) with the glibc 2.3.2? (like the openzaurus 3.3.6 version). To do that, do I need to create a custom rom by recompiling every thing with gcc3?
lardman
Glad you've got it all working.

QUOTE
I've try to compile a simple Qtopia example with my new cross-compiler and it failed to find the qtopia library (undefined reference to <widget name>) 


I presume it's complaining that it can't find the qtopia related (libqpe, libopie, whatever) arm libs. You'll probably need to either compile it all yourself (with gcc 3.x) or copy the libs over from your Z (which have already been compiled with gcc 3.x). I don't know much about this, I generally only do command line stuff. Perhaps drop Mickeyl a line?

QUOTE
It's ok to compile an ARM binary using the old cross-compiler (gcc 2.95). 


You shouldn't compile with 2.95 unless you want to use compat libs.

QUOTE
Is it possible to upgrade the default Sharp ROM (1.32) with the glibc 2.3.2? (like the openzaurus 3.3.6 version). To do that, do I need to create a custom rom by recompiling every thing with gcc3?


You would have to make a new ROM as libc can't be changed on the fly. All of the C++ stuff would bneed to be recompiled due to name-mangling issues, but the commandline stuff would probably be okay as libc seems to be backwards compatible.


Si
VeeDubb
Ced,
When you finaly get this done, you should put up a condensed and clear How-To for others. i would also like to get this set up, and several people have tried to help me, and have helped somewhat, but I have been unseccessfull in compiling anything and i'd love a clear Begining to end How-To.
summer00
QUOTE
ced

I am in the process of setting up a gcc 3.3.2 cross compiler and am trying to follow the instructions here  

http://paipai.org/~humorum/pukiwiki/pukiwi...php?ZaurusSelf2

Hope this proves of some help

Richard


can i follow the instructions if i am using gcc 3.2.2 ?
lardman
Yes
tz
Is there any way to backport the optimizer or other enhancements to 2.95 (so things will work with the old libc)?
Sy Ali
cross-compiler howto:
http://paipai.org/~humorum/pukiwiki/pukiwiki.php?ZaurusSelf2

Should I just use an online translator, or has anyone made the equivalent instructions in English?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.