Author Topic: CVS compile error  (Read 5293 times)

Offline kalxas

  • Single posting newcomer
  • *
  • Posts: 9
CVS compile error
« 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

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: CVS compile error
« Reply #1 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).

Offline kalxas

  • Single posting newcomer
  • *
  • Posts: 9
Re: CVS compile error
« Reply #2 on: October 19, 2005, 07:59:42 pm »
My machine is a Dual Core AMD64

Does this mean that I cannot compile Code::Blocks?

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: CVS compile error
« Reply #3 on: October 19, 2005, 08:22:40 pm »
Argh! Is this a C::B bug? :(

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: CVS compile error
« Reply #4 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?
« Last Edit: October 19, 2005, 08:29:38 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: CVS compile error
« Reply #5 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!!":
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)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: CVS compile error
« Reply #6 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...
Be patient!
This bug will be fixed soon...

Offline kalxas

  • Single posting newcomer
  • *
  • Posts: 9
Re: CVS compile error
« Reply #7 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

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: CVS compile error
« Reply #8 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:
Be patient!
This bug will be fixed soon...

Offline kalxas

  • Single posting newcomer
  • *
  • Posts: 9
Re: CVS compile error
« Reply #9 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

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: CVS compile error
« Reply #10 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 :)

Offline kalxas

  • Single posting newcomer
  • *
  • Posts: 9
Re: CVS compile error
« Reply #11 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?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: CVS compile error
« Reply #12 on: October 20, 2005, 11:00:47 am »
PS. When is RC2 going to be released?

Real Soon Now ;)
Be patient!
This bug will be fixed soon...