GCC Cross Compiler error in Cygwin

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
B.E

Re:GCC Cross Compiler error in Cygwin

Post by B.E »

Candamir wrote: But anyway, your answer sounds to me as if I had already managed to build a cross-compiler and this cross-compiler would output some file GRUB wouldn't load... Wrong. Anyway, I already tested Solar's script under another WinXP machine (Cygwin, obviously) without Dev-C++ and without DJGPP installed - ever.
I was talking about the their ftp sites. I just tried to compile a simple hello world app and outputng to a ELF binary format and I get the same problem as you. It is to do with the object file format. The default format for gcc under cygwin is COFF(PE), because the COFF format is not compatable with the ELF binary format, the linker show that error. I have not tried to compile the gnu compiler.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:GCC Cross Compiler error in Cygwin

Post by Solar »

B.E wrote: The problem is that you are trying to get cygwin to do something at it was not designed for. cygwin was designed to be a UNIX-like envirnment for windows. the default gcc compiler links the cygwin dll to all excutables that it compiles. because cygwin is not a UNIX emulator, rather a "bridge" between the two systems, the cygwin can only link and run COFF format executables.
Correct so far.
I have tried to build a basic kernal with cygwin, it added extra stuff to the binary so that my kernal would not run.
That is why I wrote a HOWTO about building a cross compiler, which will run in the Cygwin environment, yet still churn out ELF object format.
I have not heard of anyone that uses cygwin for OS deving.
I did, and still occasionally do, and that is why and how I wrote (central parts of) the FAQ page in question.
BTW Did you unistall the default gcc compiler before you install the Cross compiler?
I hope this was not meant as a recommendation. ;)
I was talking about the their ftp sites. I just tried to compile a simple hello world app and outputng to a ELF binary format and I get the same problem as you.
What are you talking about?

For all I understood, Candamir is trying, and failing, to build a cross compiler (which would be a COFF / Cygwin executable). Of course you will fail to execute an ELF executable in Cygwin! But unless I am seriously mistaken, that is not Candamir's problem.
Every good solution is obvious once you've found it.
Candamir

Re:GCC Cross Compiler error in Cygwin

Post by Candamir »

For all I understood, Candamir is trying, and failing, to build a cross compiler (which would be a COFF / Cygwin executable). Of course you will fail to execute an ELF executable in Cygwin! But unless I am seriously mistaken, that is not Candamir's problem.
Correct. Right now, I have no other C/ASM projects than Hermes...
paulbarker

Re:GCC Cross Compiler error in Cygwin

Post by paulbarker »

Just a quick question...

Since this is for Cygwin on Windows, wouldn't it be an idea to put a set of known good binaries online somewhere for a crosscompiler to i386 ELF? I can host this on my website (as long as the archive compresses to less than 1MB, thats the file size limit from my provider, not from me), but I don't have access to Windows so I can't make or test this.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:GCC Cross Compiler error in Cygwin

Post by Candy »

paulbarker wrote: Just a quick question...

Since this is for Cygwin on Windows, wouldn't it be an idea to put a set of known good binaries online somewhere for a crosscompiler to i386 ELF? I can host this on my website (as long as the archive compresses to less than 1MB, thats the file size limit from my provider, not from me), but I don't have access to Windows so I can't make or test this.
It would be a good idea to make a host for crosscompilers running on windows + linux for crosscompiling to i386 ELF and x86_64 ELF, however, I usually add or remove some flags when I compile stuff. These would be pretty safe though, I'd be very happy with them. I'd also be happy to provide x86_64 crosscompiler binaries for linux :), they're quite large though...
paulbarker

Re:GCC Cross Compiler error in Cygwin

Post by paulbarker »

I know, its not just the binaries its the /usr/lib/gcc and /usr/lib/gcc-lib or whatever, and the platform triple (/usr/i386-pc-linux-gnu or other). I think a sourceforge project may be the best way of hosting this sort of stuff.
srg

Re:GCC Cross Compiler error in Cygwin

Post by srg »

I use cygwin for most of my programming, including osdev (when I get arround to it)

Following the information in the FAQ, I've successfully compiled cross compilers for the following platforms:

i386-elf
x86_64-elf
m68k-elf

that's with GCC 3.4.5 and 4.0.2, you may have to experiment with binutils versions.

I havn't tried others architectures yet, I may have a play arround though.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:GCC Cross Compiler error in Cygwin

Post by Solar »

@ paulbarker:

The thing is that some people might want to use GCC 4.x, some would want to use 3.4.x, then there's a new version of GCC released but the maintainer didn't do the compilation yet... I still think that providing a HOWTO about building your own toolchain works best for everybody.

And there's the issue that having a GCC cross-compiler binary installed doesn't give you a decent shell, make, version control etc. - you'd still have to install Cygwin for that, and it would probably generate as many problems as it would solve.

Of course you're free to set up such a service, but I'll stick to the HOWTO. (Looking forward to adding PDCLib and going to step 2... ;-) )
Every good solution is obvious once you've found it.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:GCC Cross Compiler error in Cygwin

Post by df »

B.E wrote: I have tried to build a basic kernal with cygwin, it added extra stuff to the binary so that my kernal would not run. I have not heard of anyone that uses cygwin for OS deving.
thats crap. a lot of us use cygwin for osdeving and it works fine. just tell cygwin not to use default libraries and it wont add the 'extra stuff'.
-- Stu --
srg

Re:GCC Cross Compiler error in Cygwin

Post by srg »

Solar wrote: @ paulbarker:

The thing is that some people might want to use GCC 4.x, some would want to use 3.4.x, then there's a new version of GCC released but the maintainer didn't do the compilation yet... I still think that providing a HOWTO about building your own toolchain works best for everybody.

And there's the issue that having a GCC cross-compiler binary installed doesn't give you a decent shell, make, version control etc. - you'd still have to install Cygwin for that, and it would probably generate as many problems as it would solve.
Agreed, the beauty of a HOWTO is that it is independant of what version of GCC you want to use and also what platform you'r developing on and for.
paulbarker

Re:GCC Cross Compiler error in Cygwin

Post by paulbarker »

The plan wasn't to replace the HOWTO, rather to suppliment it. It would help people who couldn't get the HOWTO working.
Candamir

Re:GCC Cross Compiler error in Cygwin

Post by Candamir »

Hey! Finally, I managed to build my cross compiler with Solar's script! I don't know /why/ it worked, I only know it worked. ??? I didn't modify anything in my Cygwin setup or anything... Strange but cool ;) Now I can continue with OS-deving (hadn't had much time these days, either...)
Post Reply