Spoonfeeding info: was Compiling with GCC on Windows7

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
User avatar
Muneer
Member
Member
Posts: 104
Joined: Tue Nov 02, 2010 2:05 am
Location: India

Spoonfeeding info: was Compiling with GCC on Windows7

Post by Muneer »

Download The Ld file at http://www.2shared.com/file/T7L8tPTu/Ld_online.html
Download The GCC file at http://www.2shared.com/file/J_FU0h68/DJGPP.html
Install Nasm as well.
Make the required environment variables by Right Clicking MyComputer -> properties -> Advanced -> Enviroment Variables. In the system variable section, click New, add to
Variable Name: DJGPP
VariableValue : %SystemDrive%\djgpp\djgpp.env
And add to the Path Variable, the address of the nasm installed directory as well as gcc (usually in C:\djgpp\bin),and the ld directory (eg: C:\ld\bin).

Note: do not use the ld inside Djgpp to link. Use the ld in the link provided.

Nasm Command Line1: nasm -Z Error1.txt -f elf -o File1.o File1.asm
Nasm Command Line2: nasm -Z Error2.txt -f elf -o File2.o File2.asm
GCC command Line: gcc @GCCArguements.txt -c -o main.o main.c
LD Command Line: ld -T "C:\ld\bin\link.ld" -o File3.bin @LinkArguements.txt

Make a text file called LinkArguements.txt and write into it : File1.o File2.o main.o
which ld will link with File1.o first and File2.o Second and main.o third. If you want additional files add it to the text file in your required order.
Likewise make a GCCArguements.txt and add to it
-ffreestanding -fno-leading-underscore


PS: Change "C:\ld\bin\link.ld" in the linker script as required

PS: The @LinkArguements.txt & @GCCArguements.txt helps you to get around the 127 character limit in xp. Seems like this is no longer a problem for Windows 7 though, but either ways it works.

Also the linker Script link.ld:

Code: Select all

OUTPUT_FORMAT("binary")
ENTRY(START)
phys = 0xC0000000; Adjust this to your requirements like 0x100000 for 1MB kernel
SECTIONS
{
  .text phys : AT(phys) {
    code = .;
    *(.text)
    *(.rodata)
    *(.rdata) 
    
  }
  .data : AT(phys + (data - code))
  {
    data = .;
    *(.data)
    
  }
  .bss : AT(phys + (bss - code))
  {
    bss = .;
    *(.bss)
    
  }
  end = .; KernelEnd = .;
}
Even the smallest person could change the course of the future - Lord Of The Rings.

In the end all that matters is what you have done - Alexander.

Even after a decade oh god those still gives me the shivers.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Compiling with GCC on Windows7

Post by Solar »

Great. Just great.

We have instructions on how to get an environment set up on Windows. For cryin' out loud, we have them already! They are the best-tested contents of the whole Wiki!

How come that anyone could believe a series of "download this, download that, don't forget to set command line options X, Y, and Z...." in a single thread would in any way be superior to the cross-compiler tutorial?

Anyone taking a bet that the OP will return with a question that will turn out to be specific to his environment 1..n times?
Every good solution is obvious once you've found it.
User avatar
Muneer
Member
Member
Posts: 104
Joined: Tue Nov 02, 2010 2:05 am
Location: India

Re: Compiling with GCC on Windows7

Post by Muneer »

We have instructions on how to get an environment set up on Windows. For cryin' out loud, we have them already! They are the best-tested contents of the whole Wiki!
True.
I know, that setting up a cross compiler is well documented. But judging by the OP comments, he seems to have a bit of a problem getting at it
Anyone taking a bet that the OP will return with a question that will turn out to be specific to his environment 1..n times?
Maybe. But I hoped that this will be of some help as an extra bonus.
in a single thread would in any way be superior to the cross-compiler tutorial?
I never said mine was superior.
Even the smallest person could change the course of the future - Lord Of The Rings.

In the end all that matters is what you have done - Alexander.

Even after a decade oh god those still gives me the shivers.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Compiling with GCC on Windows7

Post by Solar »

HardCoder wrote:But judging by the OP comments, he seems to have a bit of a problem getting at it.
And you really think that, if a person is unable to follow the tutorial, he'll be able to follow ad-hoc instructions with success? Instructions that confuse with a handful of patches and workarounds right from the start?

I agree with Combuster here: Not being able to make heads and tails out of the cross-compiler tutorial usually hints at something deeper being amiss, like a severe lack of experience with toolchain handling and figuring out technical instructions.
Every good solution is obvious once you've found it.
User avatar
Muneer
Member
Member
Posts: 104
Joined: Tue Nov 02, 2010 2:05 am
Location: India

Re: Compiling with GCC on Windows7

Post by Muneer »

And you really think that, if a person is unable to follow the tutorial, he'll be able to follow ad-hoc instructions with success? Instructions that confuse with a handful of patches and workarounds right from the start?
I don't know. I may not be as knowledgeable as you or combuster but I just hoped for good and as I said "as an extra bonus".
Even the smallest person could change the course of the future - Lord Of The Rings.

In the end all that matters is what you have done - Alexander.

Even after a decade oh god those still gives me the shivers.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Compiling with GCC on Windows7

Post by Solar »

I didn't mean to critizise your knowledge. I was questioning the wisdom of helping people "evade" the tutorial.

Sorry for my peeved-out reaction. I'm not in a good mood these days and will shut up now. :(
Every good solution is obvious once you've found it.
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: Compiling with GCC on Windows7

Post by Combuster »

While providing cygwin binaries may be justifiable (though not smart, see solar's and my previous comments), DJGPP IS FOR DOS. It has a ton of known issues and really, really should not be used.
Anyone taking a bet that the OP will return with a question that will turn out to be specific to his environment 1..n times?
Either that or being scared away.
"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 ]
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: Compiling with GCC on Windows7

Post by Combuster »

Do you honestly believe suggesting djgpp now saves time in the long run?

The point here was, spoonfeeding is generally considered educationally bad practice and should be discouraged, both from people asking, and from people answering. If people can't do the simple things, they are guaranteed to be unable to do the difficult thing. If you give away the easy parts for free, what do you think will happen when you are unable to answer the question?
"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 ]
User avatar
Muneer
Member
Member
Posts: 104
Joined: Tue Nov 02, 2010 2:05 am
Location: India

Re: Compiling with GCC on Windows7

Post by Muneer »

Do you honestly believe suggesting djgpp now saves time in the long run?
Technically possible if the OP remains with the x86-32. But I was under the belief that once he sets foot in the kernel land and as time goes by , he might be able to strengthen himself and make the necessary changes to his toolchain.
Even the smallest person could change the course of the future - Lord Of The Rings.

In the end all that matters is what you have done - Alexander.

Even after a decade oh god those still gives me the shivers.
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: Compiling with GCC on Windows7

Post by Combuster »

So by your definition doing B, failing a few times because of it, then doing A correctly and start again from scratch is faster than doing A the first time around.

Your logic is flawed.
"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 ]
User avatar
Muneer
Member
Member
Posts: 104
Joined: Tue Nov 02, 2010 2:05 am
Location: India

Re: Compiling with GCC on Windows7

Post by Muneer »

And the complete reason why I posted like that was because.....
I have this friend of mine who is poor and just bought his PC at home but is interested in programming and is doing his Computer Science Engineering as a first year. But we learned the x86 architecture and assembly language(now C) together. But as he lacks skill in any OS available now, I had to set up his environment for him.
Even the smallest person could change the course of the future - Lord Of The Rings.

In the end all that matters is what you have done - Alexander.

Even after a decade oh god those still gives me the shivers.
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Re: Compiling with GCC on Windows7

Post by piranha »

If I were a mod I would split this thread up with an axe.

Combuster has a point - people don't seem to learn from spoonfeeding (this argument has been had here before, please lets not get into it again), and the OP doesn't seem to be able to follow the simple tutorials and therefor it is logical to deduce that he probably isn't ready for OSdev.

While hardcoder's method of teaching with flawed stuff and spoonfeeding is clearly not in the best interest in the long run for the OP, the intention was to help, which is good.

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
harmanjeet
Posts: 10
Joined: Sun Feb 06, 2011 7:03 am
Location: India
Contact:

Re: Compiling with GCC on Windows7

Post by harmanjeet »

Combuster might forgot himself when he was a beginner. piranha! You r right. If someone is required help, he should be helped instead of highlighting his weak points. By the way, for information, i does OS Development using Visual Studio 2010. But i also wanted to taste gcc, that's why I created this thread. Sorry Combuster! I just want to say that, if someone requires help, plz help him. May be, he knows more than u, or leaves u behind in the race... [-X
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: Compiling with GCC on Windows7

Post by Combuster »

piranha wrote:the intention was to help, which is good.
QFT. Somehow that got lost between the frustration of correcting someone with poor advice and seeing it followed up with even worse advice. I hope you can keep up the good intentions, and help at the same time :wink:
Combuster might forgot himself when he was a beginner.
Sigh, that is the one insult that really does not help with someone that was taught programming by getting hit in the face with a good book at the age of 6. I might survive the nuclear war, and I sense people here who might not.

Most of the lecture was about teaching Hardcoder some didactics, and at the same time preventing you from making stupid mistakes. I don't see how that's not helping.
"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 ]
User avatar
harmanjeet
Posts: 10
Joined: Sun Feb 06, 2011 7:03 am
Location: India
Contact:

Re: Compiling with GCC on Windows7

Post by harmanjeet »

Sorry buddy! this was not to make u feel bad. Sorry if it hurts u. You are much more experienced than me. I salute u and respect u. But, I think, no question is small. So, we should respect everyone for his question, because he is still learning. So we should help her/him. This might happen, that, he may lead us in future... So respect everyone... :)
Post Reply