Page 1 of 1

error can't build gcc

Posted: Mon Feb 23, 2009 11:46 am
by overburn
ok, i have the exact framework of the barebones kernel tutorial , and i compiled it , linked and put it on an image.
when i boot it , grub starts
and when i type kernel 200+18 it gives the error in the title
as the kernel.o file was PE, i tried adding OUTPUT_FORMAT("elf32-i386") to the ld file, but i get "ld: cannot perform PE operations on non PE output file 'kernel.bin'. "

anyone know wat's happening?
i'm using windows and cygwin and haven't figured out yet how to make gcc output elf files

Re: grub error 13: unsupported executable format

Posted: Mon Feb 23, 2009 11:57 am
by xyzzy
Build a cross compiler that can create ELF files: http://wiki.osdev.org/GCC_Cross-Compiler

Re: grub error 13: unsupported executable format

Posted: Mon Feb 23, 2009 12:02 pm
by overburn
i have a cross compiler... followed the tut
but how do i make it elf?

Re: grub error 13: unsupported executable format

Posted: Mon Feb 23, 2009 12:50 pm
by xDDunce
search google for a program called "ld-elf.exe" that sorted my problems out whilst using windows. its the easy way round that error. although you will need a cross compiler eventually, it makes it all so much easier! but ld-elf is a simple quick fix if you just wanna build the barebones tutorials.

Cheers,
James.

Re: grub error 13: unsupported executable format

Posted: Mon Feb 23, 2009 1:10 pm
by overburn
ld-elf.exe are you sure?
i mean i find only blabla on google, no file

Re: grub error 13: unsupported executable format

Posted: Tue Feb 24, 2009 1:35 am
by Solar
overburn wrote:i have a cross compiler... followed the tut
but how do i make it elf?
Easy - if you followed the tutorial, that cross compiler you build there doesn't generate anything but ELF files.

If your kernel.o is still a PE file, chances are you did build the cross-compiler, but aren't using it. Check GCC Cross-Compiler: Usage.

Re: grub error 13: unsupported executable format

Posted: Tue Feb 24, 2009 7:20 am
by overburn
i can't build gcc , followed the exact instructions in the wiki. downloaded everything.
but when i make all-gcc i get error at the end: make: *** [all-gcc] Error 2
and a whoooole bunch of warnings.
any tips?

Re: error can't build gcc

Posted: Tue Feb 24, 2009 9:29 am
by Solar
1) Can't help without the topmost error.

2) The tutorial in the Wiki works. Trust me. Proven dozens of times over. Every time someone said "it didn't work", he didn't follow the instructions closely enough.

Re: error can't build gcc

Posted: Tue Feb 24, 2009 9:53 am
by AJ
Hi,

Due to joining the Pedigree team, I've recently been playing a lot with cross compilers on Cygwin. Over the last couple of weeks, I have built cross compilers for GCC 4.3.0 - 4.3.3 using binutils 2.19 and it all works very nicely.

As Solar is aware, I originally had problems with building a cross-compiler myself, and I never figured out the cause (all I know is a new release of GCC solved my problem at the time - about 2 years ago). I can assure you, however, that the latest versions do work with the tutorial. Have you extended your PATH environment variable?

Cheers,
Adam

Re: error can't build gcc

Posted: Tue Feb 24, 2009 10:00 am
by overburn
yes.. i have
so i should get a newer gcc .. thanx :D