Problem with building a cross compiler
Sorry to bring such an old post back from the dead, but I solved my problem and wanted to make sure no one else makes the same mistake I did.
First thing you want to make sure that you have downloaded all of the necessary tools to build gcc and binutils.
Then you want to make sure that your cygwin installation defaults to binary mode and not text mode. I changed a lot of things trying to get it to work and finally I made some progress after changing to binary mode.
Thank you everyone for helping me.
First thing you want to make sure that you have downloaded all of the necessary tools to build gcc and binutils.
Then you want to make sure that your cygwin installation defaults to binary mode and not text mode. I changed a lot of things trying to get it to work and finally I made some progress after changing to binary mode.
Thank you everyone for helping me.
Re: Problem with building a cross compiler
I also got the error
undefined reference to `_bfd_i386_arch'
while trying to compile binutils under cygwin (comfigured for DOS mode as it was recommended for building eCos).
After spending a night on that I figured out that cpu-i386.o file was not linking because Cygwin did not handled `cat ofiles` properly in the makefile. The fix for that is the following: in binutils source code, in bfd/Makefile.in, replace the line
by
After that do 'configure' and 'make' again and it should work.
undefined reference to `_bfd_i386_arch'
while trying to compile binutils under cygwin (comfigured for DOS mode as it was recommended for building eCos).
After spending a night on that I figured out that cpu-i386.o file was not linking because Cygwin did not handled `cat ofiles` properly in the makefile. The fix for that is the following: in binutils source code, in bfd/Makefile.in, replace the line
Code: Select all
echo $$f > tofiles
Code: Select all
echo $$f ' ' > tofiles
frank wrote: I got an error about an undefined reference to _bfd_i386_arch
I had a similar problem with gcc 4.1.2 and binutils 2.17. The also gave make errors during the Cygwin build. A rebuild all didn't fix it, however reinstalling cygwin with unix style fileformat instead of windows fixed the problem.
But i agree is should work normally.
But i agree is should work normally.
Author of COBOS
Yeah and you know there is a difference between RECOMMENDED and REQUIRED do you?Combuster wrote:There is a reason why the installer says "RECOMMENDED" in all capsfrank wrote:Yeah, once you set cygwin to binary it builds just fine with no problems at all.
Author of COBOS
OK guys. If you want to build eCos under Cygwin, you MUST use Cygwin in DOS mode, otherwise you won't be able to do it. It is written in eCos docs and seems to be true. That is why I used DOS mode when building cross tools.
Now, here is the Cygwin (or somebody's else?) bug:
There is a file 'ofiles', which contains the following:
Filenames are separated by spaces, at the end there is 0D 0A (since it was generated in DOS mode).
Now, the makefile has the following line:
As you can see, it is supposed to take all the files, including the ones that are listed in 'ofiles', and build them into a library. Now, here is what happens during the execution:
Note that the last file listed in 'ofiles' (cpu-i386) is somehow lost. However, if you do
it works fine.
This seems to be the bug (may be `cat ofiles` adds \r to the end of the last name?). So you guys better find out why this is happening rather than discuss if binary mode is recommended or required and what is the difference.
Now, here is the Cygwin (or somebody's else?) bug:
There is a file 'ofiles', which contains the following:
Code: Select all
elf32-i386.lo elf32.lo elf.lo elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo coff-i386.lo cofflink.lo elf32-gen.lo cpu-i386.lo
Now, the makefile has the following line:
Code: Select all
/bin/sh ./libtool --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -o libbfd.la -rpath /gnutools/i686-pc-cygwin/i386-elf/lib -release 2.13.1 archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo section.lo syms.lo targets.lo hash.lo linker.lo srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo merge.lo dwarf2.lo archive64.lo `cat ofiles`
Code: Select all
libtool: link: warning: undefined symbols not allowed in i686-pc-cygwin shared libraries
ar cru .libs/libbfd.a archive.o archures.o bfd.o cache.o coffgen.o corefile.o format.o init.o libbfd.o opncls.o reloc.o section.o syms.o targets.o hash.o linker.o srec.o binary.o tekhex.o ihex.o stabs.o stab-syms.o merge.o dwarf2.o archive64.o elf32-i386.o elf32.o elf.o elflink.o elf-strtab.o elf-eh-frame.o dwarf1.o coff-i386.o cofflink.o elf32-gen.o
ranlib .libs/libbfd.a
creating libbfd.la
Code: Select all
echo `cat ofiles`
This seems to be the bug (may be `cat ofiles` adds \r to the end of the last name?). So you guys better find out why this is happening rather than discuss if binary mode is recommended or required and what is the difference.