OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 25, 2024 4:40 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Really Should make a Cross Compiler...
PostPosted: Mon Apr 09, 2007 7:21 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Hi,

I normally compile my kernel on a WinXP machine using DJGPP with arguments to prevent use of the built in libc and standard runtime:

Code:
-Wall -O -fno-builtin -nostartfiles -fstrength-reduce -nostdinc -fnostdlib -ffreestanding


which seems to work fine - I tend to produce coff executables which my second stage loader can handle.

Problem is, I just tried to 'install' djgpp on my home Win2k box and with the above parameters get the message:

Code:
bin/main.o:main.c:(.text+0x13): undefined reference to `_alloca'
bin/main.o:main.c:(.text+0x18): undefined reference to `__main'


..which seems to indicate to me that gcc is attempting to use its built in runtime.

For this reason, I have tried to follow the cygwin x-compiler instructions but after binutils and gcc compile, I get error messages like the following:

Code:
checking errno.h usability...   11138 [main] sh 116856 fork: child -1 - died wai
ting for longjmp before initialization, retry 0, exit code 0x80, errno 11
     44 [main] sh 107312 fork: child -1 - died waiting for longjmp before initia
lization, retry 0, exit code 0x80, errno 11


I don't mind whether I get cygwin or djgpp working, and sorry it's kind of 2 questions in one, but they're related to the same problem. Any ideas much appreciated.

Cheers,
Adam


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 09, 2007 11:48 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 08, 2007 11:08 am
Posts: 670
Code:
-nostdinc -nostdlib -fno-builtin -ffreestanding -fno-common


That's what I use, works on Linux, GCC 3.3.2. Compiler flags like that can change a bit between different versions, so make sure you have the flags correctly for the version you are using.

Ofcourse I use lots of more flags, but those are the flags relevant for compiling without normal libs.

_________________
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 10, 2007 2:38 pm 
Offline
Member
Member

Joined: Fri Dec 22, 2006 5:32 pm
Posts: 60
Location: Somewhere Down...
Maybe it won't help you, but on cygwin: run the setup program, reinstall cygwin, gcc, binutils important packages and then follow the gcc-cross-compiler tutorial. Sorry, if the advice is wrong!

_________________
I think, I have problems with Bochs. The biggest one: Bochs hates me!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 11, 2007 4:46 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Thanks - the extra switch (I wasn't using -nostartfiles) didn't help unfortunately.

I will give it a go re-installing cygwin again. I know in the past people have been told "The tutorial just works so make sure you follow it *exactly*..." but I have already re-installed a couple of times, and if I am doing something wrong, I am obviously doing it wrong every time...

Cheers,
Adam


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 11, 2007 6:25 am 
Offline
Member
Member

Joined: Wed Oct 18, 2006 5:49 am
Posts: 200
Do you still have DJGPP installed on the machine that's running Cygwin? If so, try removing that first (it could be that GCC's configure script is running DJGPP programs instead of Cygwin programs).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 11, 2007 6:40 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Hi,

Thanks, I'll try that. I had removed c:\djgpp\bin from my PATH variable and had assumed that would be enough, but I'll try a full uninstall - could work!

Unfortunately I'm just on my XP machine today so can't try yet...

Adam


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: ErenJaeger, iansjack, Majestic-12 [Bot], RayanMargham and 217 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group