Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: kalxas on October 19, 2005, 05:29:30 pm

Title: CVS compile error
Post by: kalxas on October 19, 2005, 05:29:30 pm
Hello!

I am trying to compile Code::Blocks for Linux without success so far.
I use WxWidgets 2.6.2 and GCC 4.01
My distibution is Mandriva 2006.

I downloaded the last version from the site but the makefile didn't work.
Then I got the lattest CVS code and used the bootstrap method.

I got the following error during the make process:

parser/parser.cpp: In member function 'void Parser::OnAllThreadsDone(CodeBlocksE vent&)':
parser/parser.cpp:844: error: cast from 'Parser*' to 'int' loses precision
make[4]: *** [parser.lo] Error 1
make[4]: Leaving directory `/home/kalxas/build/codeblocks-1.0/src/plugins/codeco mpletion'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/kalxas/build/codeblocks-1.0/src/plugins/codeco mpletion'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/kalxas/build/codeblocks-1.0/src/plugins'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/kalxas/build/codeblocks-1.0/src'
make: *** [all-recursive] Error 1

Can anyone help?

Thanks in advance.
kalxas
Title: Re: CVS compile error
Post by: Urxae on October 19, 2005, 07:12:27 pm
Ah, that's a portability no-no: casting pointers to ints.
On what kind of machine are you compiling? (x86? x86-64? PPC?)
From the error message it looks like on your machine sizeof(Parser*) > sizeof(int).
Title: Re: CVS compile error
Post by: kalxas on October 19, 2005, 07:59:42 pm
My machine is a Dual Core AMD64

Does this mean that I cannot compile Code::Blocks?
Title: Re: CVS compile error
Post by: rickg22 on October 19, 2005, 08:22:40 pm
Argh! Is this a C::B bug? :(
Title: Re: CVS compile error
Post by: thomas on October 19, 2005, 08:27:43 pm
Hmm...

sizeof(int) == 4
sizeof(Parser*) == 8 under Linux 64bit?

What does wxEvent::SetInt do in 64 bit environments?
Title: Re: CVS compile error
Post by: Urxae on October 19, 2005, 10:25:38 pm
Argh! Is this a C::B bug? :(

Yes, and what's worse, it's one that was supposed to have been fixed. From "Code::Blocks compiles in 64 bit Linux!! (http://forums.codeblocks.org/index.php/topic,247.0.html)":
Mandrav: You were using wxCommandEvent::SetInt in several places to pass a Parser*. This is naturally no longer allowed, since int remains 4 bytes while Parser* is 8. I modified the code to always use wxCommandEvent::SetExtraLong instead of SetInt, but that didn't actually prevent the crash, even after modifying ALL of the SetInt calls rather than just the ones that used SetInt to transfer a pointer. I'm looking around the source, but if you have any insight as to where the problem might be, that'd be greatly appreciated.
You 're right. It was a quick-hack to pass around the Parser* while developing and it got left in there. What's worse, I forgot about it...
Thanks for reminding me :)

Either Yiannis forgot about it (again) even after being reminded, or it somehow snuck back in :(.
Well, to look at the bright side, at least the fix is known :D. (The crash they were talking about was the infamous "codecompletion plugin on Linux" one)
Title: Re: CVS compile error
Post by: mandrav on October 19, 2005, 10:57:53 pm
@kalxas: I 've commited the fix in CVS. In a few hours it 'll be available in anonymous CVS too. Let's hope I 've fixed all the occurences :)

Either Yiannis forgot about it (again) even after being reminded, or it somehow snuck back in :(.

See, that's why I usually tell people to post a bug-report/feature-request: it's the only certain way of keeping a list of things to be done.
Thanks for the sarcasm anyway...
Title: Re: CVS compile error
Post by: kalxas on October 19, 2005, 11:01:23 pm
Thanks a lot Yanni!
I will compile the source tommorow and report back the result :)

But I have a question:

Shouldn't it be sizeof(int) == 8 in a 64bit OS?

Thanks again!
Kalxas
Title: Re: CVS compile error
Post by: mandrav on October 19, 2005, 11:18:40 pm
Shouldn't it be sizeof(int) == 8 in a 64bit OS?

I think that (int=32bit) and (long int=64bit) in 64-bit systems, but don't take my word for it. I have near-zero experience with 64-bit systems  :oops:
Title: Re: CVS compile error
Post by: kalxas on October 19, 2005, 11:55:12 pm
I bought my first 64bit system, few months ago, and I didn't have the chance to test it with a 64 bit OS until now.
 I was under the impression that I should get 64bits for the plain integer in my code, and this was the main reason I wanted to move to a pure 64bit OS. But, until now, all test show that sizeof(int) == 4 must be the case :(

So, in C::B you use a cast to get through this problem? Is this wxCommandEvent::SetExtraLong command a wrap of a reinterpret_cast() in Wx?

Cheers. :)
Kalxas
Title: Re: CVS compile error
Post by: rickg22 on October 20, 2005, 02:08:43 am
Well as soon as RC2 is released, we'll be back on track with the bug reports :)
Title: Re: CVS compile error
Post by: kalxas on October 20, 2005, 10:34:12 am
I just completed compilation of Code::Blocks in my 64bit system with absolute success.
Thanks a lot guys!!!

Kalxas

PS. When is RC2 going to be released?
Title: Re: CVS compile error
Post by: mandrav on October 20, 2005, 11:00:47 am
PS. When is RC2 going to be released?

Real Soon Now ;)