Cross-Compiler Woes!

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
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Cross-Compiler Woes!

Post by pcmattman »

I just attempted to compile my OS with my Cygwin cross-compiler that I have built. It's targeted to elf and all that, but these are the sort of errors I get:

Code: Select all

$ make -f Makefile_cygwin all
Compiling kernel.cc
kernel.cc: In function 'void __cxa_pure_virtual()':
kernel.cc:50: warning: deprecated conversion from string constant to 'char*'
kernel.cc: In function 'void nullproc()':
kernel.cc:71: warning: deprecated conversion from string constant to 'char*'
kernel.cc:74: warning: deprecated conversion from string constant to 'char*'
kernel.cc:76: warning: deprecated conversion from string constant to 'char*'
kernel.cc: In function 'int main(multiboot_info_t*, unsigned int)':
kernel.cc:95: warning: deprecated conversion from string constant to 'char*'
kernel.cc:97: warning: deprecated conversion from string constant to 'char*'
kernel.cc:100: warning: deprecated conversion from string constant to 'char*'
kernel.cc:102: warning: deprecated conversion from string constant to 'char*'
kernel.cc:110: warning: deprecated conversion from string constant to 'char*'
kernel.cc:115: warning: deprecated conversion from string constant to 'char*'
kernel.cc:118: warning: deprecated conversion from string constant to 'char*'
kernel.cc:120: warning: deprecated conversion from string constant to 'char*'
kernel.cc:123: warning: deprecated conversion from string constant to 'char*'
kernel.cc:125: warning: deprecated conversion from string constant to 'char*'
kernel.cc:128: warning: deprecated conversion from string constant to 'char*'
kernel.cc:130: warning: deprecated conversion from string constant to 'char*'
kernel.cc:136: warning: deprecated conversion from string constant to 'char*'
kernel.cc:138: warning: deprecated conversion from string constant to 'char*'
kernel.cc:141: warning: deprecated conversion from string constant to 'char*'
kernel.cc:143: warning: deprecated conversion from string constant to 'char*'
kernel.cc:146: warning: deprecated conversion from string constant to 'char*'
kernel.cc:147: warning: deprecated conversion from string constant to 'char*'
kernel.cc:148: warning: deprecated conversion from string constant to 'char*'
And it continues... I'm using GCC 4.2.0:

Code: Select all

Using built-in specs.
Target: i586-elf
Configured with: ../gcc-core-4.2.0/gcc-4.2.0/configure --target=i586-elf --prefi
x=/usr/cross --disable-nls --enable-languages=c,c++ --without-headers --with-new
lib
Thread model: single
gcc version 4.2.0
Any ideas? Is my code suddenly non-standard or something?
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

Wait... -with-newlib could cause some problems down the track, am I right?

Must have built the compiler wrong :?
User avatar
mathematician
Member
Member
Posts: 437
Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk

Post by mathematician »

It looks as if you have transgressed against the decrees of some high priest of software development fashion. I wouldn't worry about it. If you are using a C++ compiler, they are forever giving you grief of that sort. Tell it to compile as a C program (if you can) and all of the warning and error messages will suddenly evaporate like the morning mist.
Last edited by mathematician on Mon May 28, 2007 3:29 am, edited 2 times in total.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

No, they'll get worse, because I use classes :D

I was hoping this would stop my template problem (ie. won't link), but it hasn't, just made it more obscure :D
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

pcmattman wrote:No, they'll get worse, because I use classes :D

I was hoping this would stop my template problem (ie. won't link), but it hasn't, just made it more obscure :D
You could try to handle string constants as const char *'s instead, since you can't modify them. What version of GCC warns for it though? Is that a 4.1.2?
uglyoldbob
Member
Member
Posts: 62
Joined: Tue Feb 13, 2007 10:46 am

Post by uglyoldbob »

The fix for this is simple. Place the const modifier in functions that use strings (like display) and the warnings will go away. I am switching from C to C++ kernel and that's what I did.
Hmm I didnt notice the thread was old. oops
I have an 80386SX 20MHz 2MB RAM.
It is my testbed platform. Only has the 3.5" and 5.25" floppy drives.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Yep, those deprecated warnings appeared in GCC 4.1.2 or something of that ilk.
Post Reply