Compiler

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.
Post Reply
Atom
Posts: 10
Joined: Sun Apr 25, 2010 8:50 am
Location: Aracaju,Brazil

Compiler

Post by Atom »

What's the best compiler to make a OS?I try to use djgpp but i can't found the djgpp.env
Can somebody help me?
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Re: Compiler

Post by quok »

The most recommended approach here is to use a cross compiler. Check out the wiki tutorial on how to build one: GCC_Cross-Compiler
Atom
Posts: 10
Joined: Sun Apr 25, 2010 8:50 am
Location: Aracaju,Brazil

Re: Compiler

Post by Atom »

But i'd like to use a ready compiler like djgpp or cygwin,because i'm starting the OS dev now .Where can i download a version of djgpp with the djgpp.env file? :?:
Selenic
Member
Member
Posts: 123
Joined: Sat Jan 23, 2010 2:56 pm

Re: Compiler

Post by Selenic »

Atom wrote:But i'd like to use a ready compiler like djgpp or cygwin
You really shouldn't. You can get away with it, yes, but the effort and pain involved far outweighs having to wait for a while (during which you can be coding away!) for a cross-compiler to build. Just install Cygwin and do what the wiki page tells you to, because it's much simpler.

Also, while you're doing the cross-compilation, you can laugh at the "make [5]" messages for binutils. Yes, that's six levels of nested make. And it runs ./configure once per program. Ouch.
skyking
Member
Member
Posts: 174
Joined: Sun Jan 06, 2008 8:41 am

Re: Compiler

Post by skyking »

Unless you're aiming for a different target platform I see no reason to bother building a cross compiler. When I'm compiling for i386 I have used the standard gcc that came with my linux distribution for quite some time now and I've seen no reason to change it...
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Compiler

Post by neon »

Hello,

There is no "best" compiler. Besides, you may need more then a complier to build anything complex. A better question would have been "what is the best toolchain" but even that falls short as there is no "best" anything.

Use whatever toolchain that best suits you. Later on you will want to make your system self hosting anyways. For now just use whats best for you - djgpp, gcc, msvc, or build a cross-compiler if needed.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: Compiler

Post by gravaera »

skyking wrote:Unless you're aiming for a different target platform I see no reason to bother building a cross compiler. When I'm compiling for i386 I have used the standard gcc that came with my linux distribution for quite some time now and I've seen no reason to change it...
Yay... :roll:
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Compiler

Post by Solar »

skyking wrote:Unless you're aiming for a different target platform I see no reason to bother building a cross compiler.
So let me iterate for the umpteenth time:
  • a cross-compiler will not accept the #include of host platform headers, giving you a clear message about "file not found" instead of unresolved linker references.
  • a cross-compiler will not silently link any host platform binaries.
  • a cross-compiler will not silently compile in any dependencies on host platform runtime binaries (mostly a Windows problem, but there you are).
  • a cross-compiler is the first step towards a native toolchain, i.e. you have to make this step sooner or later anyway.
  • a cross-compiler is build from vanilla sources, making it possible for others to reproduce your exact build environment.
  • a cross-compiler is what most people here use; if you encounter toolchain problems down the road (like problems with leading underscores etc.), the first thing you will be told (again) is to build a cross-compiler.
Bottom line: You are of course free to do and use whatever you want, but we will continue to strongly suggest building a cross-compiler, and suggesting otherwise is generally not considered helpful. Especially since it's a trivial thing to build one.
Every good solution is obvious once you've found it.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: Compiler

Post by jal »

Solar wrote:Bottom line: You are of course free to do and use whatever you want, but we will continue to strongly suggest building a cross-compiler, and suggesting otherwise is generally not considered helpful. Especially since it's a trivial thing to build one.
I'm not sure whether it's that trivial. I've tried building GNU/open source/Linux stuff from sources, and it's always a big pain in the butt to configure everything correctly and get it to compile. Although I agree that sooner or later one probably needs a cross-compiler, for early development I see no harm in using the vanilla GCC on Linux, as long as one is aware of all the dangers you list.


JAL
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Compiler

Post by Combuster »

jal wrote:as long as one is aware of all the dangers
And we all know that doesn't want to happen...
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: Compiler

Post by jal »

Combuster wrote:
jal wrote:as long as one is aware of all the dangers
And we all know that doesn't want to happen...
True, true. But in my experience, those that are not aware of them seldomly manage to even copy a tutorial let alone build a cross compiler, and start asking stupid questions anyway.


JAL
Post Reply