Page 1 of 1
Compiler
Posted: Sun Apr 25, 2010 9:30 am
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?
Re: Compiler
Posted: Sun Apr 25, 2010 9:36 am
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
Re: Compiler
Posted: Sun Apr 25, 2010 11:31 am
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?
Re: Compiler
Posted: Sun Apr 25, 2010 1:28 pm
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.
Re: Compiler
Posted: Sun Apr 25, 2010 1:42 pm
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...
Re: Compiler
Posted: Sun Apr 25, 2010 3:15 pm
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.
Re: Compiler
Posted: Sun Apr 25, 2010 4:29 pm
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...
Re: Compiler
Posted: Mon Apr 26, 2010 1:35 am
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.
Re: Compiler
Posted: Tue Apr 27, 2010 10:07 am
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
Re: Compiler
Posted: Tue Apr 27, 2010 11:32 am
by Combuster
jal wrote:as long as one is aware of all the dangers
And we all know that doesn't want to happen...
Re: Compiler
Posted: Wed Apr 28, 2010 1:18 am
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