Page 1 of 2
Problem with building a cross compiler
Posted: Sat Dec 30, 2006 2:58 pm
by frank
Hello,
For several days now I have been trying to build a GCC cross compiler capable of producing plain binary files for my kernel. I cannot get it to work no matter how hard I try. Any help or suggestions?
Host Compiler: GCC version 3.4.4
Host binutils: version 2.17.50
The binutils version I am trying to build is 2.17 from gnu.org
I am using Cygwin. Everything is up too date and I just downloaded it a couple of days ago. I tried:
Code: Select all
configure --target=i686-elf --prefix=/cbin --disable-nls
and it worked just fine, but after running make I get the following error
Code: Select all
Configuring in ./libiberty
configure: error: invalid feature name: nls
I also tried it without --disable-nls but after about an hour of scrolling text I got an error about an undefined reference to _bfd_i386_arch
Thanks for your time,
Frank
Posted: Sun Dec 31, 2006 4:44 am
by Combuster
there's a step-by-step explanation
on the wiki. It lists some pitfalls. So far, that always worked for me.
Posted: Sun Dec 31, 2006 5:05 am
by Candy
i686-elf isn't a valid target, try i686-pc-elf. That could be a small problem, but I don't think it's your main problem...
Posted: Sun Dec 31, 2006 5:43 am
by Combuster
Candy wrote:i686-elf isn't a valid target, try i686-pc-elf. That could be a small problem, but I don't think it's your main problem...
I never noticed any differences between i386-elf and i386-*-elf...
Posted: Sun Dec 31, 2006 8:04 am
by gaf
Hello,
I've uploaded a cygwin hosted toolchain to my sourceforge project some time ago (
link). It's should still be up to data and you might give it a try if you can't solve your compiler issue.
regards,
gaf
Posted: Sun Dec 31, 2006 11:21 am
by frank
Thanks gaf. I will look into that. Can they output a plain binary?
I followed the step by step explanation on the wiki and I still get those errors. I never get past building binutils. Do you think that I should try to build earlier version of binutils, like 2.16.1.
Thanks for your help,
Frank
Posted: Tue Jan 02, 2007 8:16 am
by MHaggag
I've had different trouble with building i686-elf targetted tools before--they kept segfaulting on my kernel builds. I tried building for i586-elf instead and it worked, so it might be worth trying it out. (Reference thread:
http://www.osdev.org/phpBB2/viewtopic.php?t=11813)
Posted: Tue Jan 02, 2007 9:38 am
by Solar
frank wrote:I followed the step by step explanation on the wiki and I still get those errors. I never get past building binutils.
Check again
pedantically that you are following the steps in the Wiki. I mean,
pedantically.
For example, your example configure call doesn't have the leading ../binutils-... part - are you really
outside the binutils source tree, and are you really calling the configure script of the
binutils source tree? Please
do try the
exact instructions from the Wiki before trying any deviations. The Wiki instructions
do work, and do so
reliably.
Do you think that I should try to build earlier version of binutils, like 2.16.1.
No. 2.17 is proven to work.
Posted: Tue Jan 02, 2007 10:48 am
by Combuster
frank wrote:Do you think that I should try to build earlier version of binutils, like 2.16.1.
From user experience: 2.16.1 has a nasty bug in GAS.
Also what people tend to forget, you need flex and bison installed
Posted: Tue Jan 02, 2007 6:19 pm
by frank
Hello,
This is exactly what I tried and the output I received:
Code: Select all
Frank Holton@franks-computer /usr/src/build-binutils
$ export PREFIX=/usr/cross
Frank Holton@franks-computer /usr/src/build-binutils
$ export TARGET=i586-elf
Frank Holton@franks-computer /usr/src/build-binutils
$ cd /usr/src/build-binutils
Frank Holton@franks-computer /usr/src/build-binutils
$ ../binutils-2.17/configure --target=$TARGET --prefix=$PREFIX --disable-nls
creating cache ./config.cache
checking host system type... i686-pc-cygwin
checking target system type... i586-pc-elf
checking build system type... i686-pc-cygwin
checking for a BSD compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for gnatbind... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f
2
checking for correct version of gmp.h... no
checking for bison... bison -y
checking for bison... bison
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... makeinfo
checking for expect... expect
checking for runtest... runtest
checking for i686-pc-cygwin-ar... no
checking for ar... ar
checking for i686-pc-cygwin-as... no
checking for as... as
checking for i686-pc-cygwin-dlltool... no
checking for dlltool... dlltool
checking for i686-pc-cygwin-ld... /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../
i686-pc-cygwin/bin/ld.exe
checking for i686-pc-cygwin-lipo... no
checking for lipo... no
checking for i686-pc-cygwin-nm... no
checking for nm... nm
checking for i686-pc-cygwin-ranlib... no
checking for ranlib... ranlib
checking for i686-pc-cygwin-strip... no
checking for strip... strip
checking for i686-pc-cygwin-windres... no
checking for windres... windres
checking for i686-pc-cygwin-objcopy... no
checking for objcopy... objcopy
checking for i686-pc-cygwin-objdump... no
checking for objdump... objdump
checking for i586-elf-cc... no
checking for i586-elf-gcc... no
checking for i586-elf-c++... no
checking for i586-elf-g++... no
checking for i586-elf-cxx... no
checking for i586-elf-gxx... no
checking for i586-elf-gcc... no
checking for i586-elf-gcj... no
checking for i586-elf-gfortran... no
checking for ar... no
checking for i586-elf-ar... no
checking for as... no
checking for i586-elf-as... no
checking for dlltool... no
checking for i586-elf-dlltool... no
checking for ld... no
checking for i586-elf-ld... no
checking for lipo... no
checking for i586-elf-lipo... no
checking for nm... no
checking for i586-elf-nm... no
checking for objdump... no
checking for i586-elf-objdump... no
checking for ranlib... no
checking for i586-elf-ranlib... no
checking for strip... no
checking for i586-elf-strip... no
checking for windres... no
checking for i586-elf-windres... no
checking where to find the target ar... just compiled
checking where to find the target as... just compiled
checking where to find the target cc... pre-installed
checking where to find the target c++... pre-installed
checking where to find the target c++ for libstdc++... pre-installed
checking where to find the target dlltool... just compiled
checking where to find the target gcc... pre-installed
checking where to find the target gcj... pre-installed
checking where to find the target gfortran... pre-installed
checking where to find the target ld... just compiled
checking where to find the target lipo... pre-installed
checking where to find the target nm... just compiled
checking where to find the target objdump... just compiled
checking where to find the target ranlib... just compiled
checking where to find the target strip... just compiled
checking where to find the target windres... just compiled
checking whether to enable maintainer-specific portions of Makefiles... no
updating cache ./config.cache
creating ./config.status
creating Makefile
Frank Holton@franks-computer /usr/src/build-binutils
$ make all install
make[1]: Entering directory `/usr/src/build-binutils'
mkdir -p -- ./libiberty
Configuring in ./libiberty
configure: error: invalid feature name: nls
make[1]: *** [configure-libiberty] Error 1
make[1]: Leaving directory `/usr/src/build-binutils'
make: *** [all] Error 2
I'm sorry if I'm missing something really simple.
Yes I have flex and bison.
By the way, do I need to download the GCC packages to be able to build just binutils?
Thanks gaf, they will do just fine. I would really like to get all of this to work so I can build a compiler for my OS( one day )
Thanks for your help,
Frank
Posted: Wed Jan 03, 2007 12:45 am
by Combuster
At this point, I suspect a broken cygwin download...
Posted: Wed Jan 03, 2007 3:17 am
by Solar
Once again the proof-of-concept regression test...
<deleting local Cygwin installation>
<installing Cygwin default install>
<installing Cygwin packages gcc-core / flex / bison / make>
<testing...>
Works for me. So either your Cygwin setup is broken, or... I don't know.
frank wrote:By the way, do I need to download the GCC packages to be able to build just binutils?
No.
Posted: Wed Jan 03, 2007 9:44 pm
by frank
Well thanks everybody for your help. Maybe one day in the future I will try it again.
Yea I think I got a bad download. It just takes forever on 56k and I can't watch it the whole time.
Thanks,
Frank
Posted: Thu Jan 04, 2007 1:00 am
by Solar
frank wrote:It just takes forever on 56k...
YIKES!
If you drop me a PM with your postal address, I can send you a CD or DVD with the current Cygwin packages.
Posted: Thu Jan 04, 2007 7:12 pm
by frank
Thanks, but it's not that big of a deal. It only takes a couple of hours.
I downloaded gaf's toolchain and I think that they will work until I need to port GCC over to my OS.
Thanks,
Frank