Page 1 of 1

Building Cross-Compiler: BFD Default Target?

Posted: Wed Feb 20, 2008 1:23 am
by pcmattman
Hi everyone,

I'm following the OS_Specific_Toolchain tutorial on the wiki and I've run into some trouble while compiling GCC:

Code: Select all

/usr/mattise/cross/i586-pc-mattise/bin/ar  rc ./libgcc.a libgcc/./_muldi3.o libg
cc/./_negdi2.o libgcc/./_lshrdi3.o libgcc/./_ashldi3.o libgcc/./_ashrdi3.o libgc
c/./_cmpdi2.o libgcc/./_ucmpdi2.o libgcc/./_clear_cache.o libgcc/./_enable_execu
te_stack.o libgcc/./_trampoline.o libgcc/./__main.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/./_ffssi2.o libgcc/./_ffsdi2.o libgcc/./_cl
z.o libgcc/./_clzsi2.o libgcc/./_clzdi2.o libgcc/./_ctzsi2.o libgcc/./_ctzdi2.o
libgcc/./_popcount_tab.o libgcc/./_popcountsi2.o libgcc/./_popcountdi2.o libgcc/
./_paritysi2.o libgcc/./_paritydi2.o libgcc/./_powisf2.o libgcc/./_powidf2.o lib
gcc/./_powixf2.o libgcc/./_powitf2.o libgcc/./_mulsc3.o libgcc/./_muldc3.o libgc
c/./_mulxc3.o libgcc/./_multc3.o libgcc/./_divsc3.o libgcc/./_divdc3.o libgcc/./
_divxc3.o libgcc/./_divtc3.o libgcc/./_fixunssfsi.o libgcc/./_fixunsdfsi.o libgc
c/./_fixunsxfsi.o libgcc/./_fixsfdi.o libgcc/./_fixunssfdi.o libgcc/./_floatdisf
.o libgcc/./_floatundisf.o libgcc/./_fixdfdi.o libgcc/./_fixunsdfdi.o libgcc/./_
floatdidf.o libgcc/./_floatundidf.o libgcc/./_fixxfdi.o libgcc/./_fixunsxfdi.o l
ibgcc/./_floatdixf.o libgcc/./_floatundixf.o libgcc/./_fixtfdi.o libgcc/./_fixun
stfdi.o libgcc/./_floatditf.o libgcc/./_floatunditf.o libgcc/./_eprintf.o libgcc
/./__gcc_bcmp.o libgcc/./_divdi3.o libgcc/./_moddi3.o libgcc/./_udivdi3.o libgcc
/./_umoddi3.o libgcc/./_udiv_w_sdiv.o libgcc/./_udivmoddi4.o libgcc/./unwind-dw2
$
./unwind-c.o
/usr/mattise/cross/i586-pc-mattise/bin/ar: can't set BFD default target to `i586
-pc-mattise': Invalid bfd target
I've set up the bfd/config.bfd file properly, I think:

Code: Select all

 i[3-7]86-*-mattise*)
   targ_defvec=bfd_elf32_i386_vec
   targ_selvecs=i386coff_vec
   ;;
Any clues as to why this is happening? Thanks in advance!

Posted: Wed Feb 20, 2008 9:03 am
by Brynet-Inc
Porting binutils/gcc seem to be a bit troublesome eh? :)

Your edit of bfd/config.bfd looks a little weird...

Try targ_selfvecs=i386mattise_vec

There are also other changes required to both binutils and GCC when building your own custom target.. at this point, I can only assume you set them up correctly.

Good luck :)

Posted: Wed Feb 20, 2008 3:26 pm
by pcmattman
Actually, I think I put the definition before the targmatch.h section, which meant that the target wasn't being put into BFD's target list - I'm compiling again now to find out if moving it to the proper location has fixed this.

Posted: Thu Feb 21, 2008 3:45 pm
by pcmattman
Sorry about the double post everyone :(...

I've actually gotten past that stage and am now attempting to compile GCC, but I'm running into strife (no surprises there, I guess):

Code: Select all

Configuring in ./libiberty
configure: loading cache ./config.cache
configure: error: `CFLAGS' has changed since the previous run:
configure:   former value:  -g -O2
configure:   current value: -g -O2
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm ./config.cache' and start over
This happens after I run configure and during "make all-gcc". Any ideas?

Posted: Thu Feb 21, 2008 5:04 pm
by binutils

Code: Select all

Configuring in ./libiberty
configure: loading cache ./config.cache
configure: error: `CFLAGS' has changed since the previous run:
configure:   former value:  -g -O2
configure:   current value: -g -O2
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm ./config.cache' and start over
the above says the answer, make clean or make distclean && (some configure) && make all-gcc

HTH

Posted: Fri Feb 22, 2008 5:54 pm
by pcmattman
Thanks, I was at school yesterday when I noticed the folder I was in - making GCC in build-binutils isn't a great idea ;). Now it all works, thanks for the help guys!