Page 1 of 1

Cross-Compiler Woes!

Posted: Mon May 28, 2007 2:36 am
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?

Posted: Mon May 28, 2007 2:44 am
by pcmattman
Wait... -with-newlib could cause some problems down the track, am I right?

Must have built the compiler wrong :?

Posted: Mon May 28, 2007 3:22 am
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.

Posted: Mon May 28, 2007 3:24 am
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

Posted: Mon May 28, 2007 4:27 am
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?

Posted: Wed Dec 19, 2007 4:50 pm
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

Posted: Thu Dec 20, 2007 3:33 am
by JamesM
Yep, those deprecated warnings appeared in GCC 4.1.2 or something of that ilk.