Ubuntu 64Bit


#1

Hi,

I am trying to build cocos2d-x under ubuntu 11.10 64Bit. I get the error:

../tileMap_parallax_nodes/CCTMXLayer.cpp: In member function ‘unsigned int cocos2d::CCTMXLayer::atlasIndexForExistantZ(unsigned int)’:
../tileMap_parallax_nodes/CCTMXLayer.cpp:399:21: error: cast from ‘int*’ to ‘int’ loses precision
../tileMap_parallax_nodes/CCTMXLayer.cpp:399:53: error: cast from ‘void**’ to ‘int’ loses precision
../tileMap_parallax_nodes/CCTMXLayer.cpp: In member function ‘unsigned int cocos2d::CCTMXLayer::atlasIndexForNewZ(int)’:
../tileMap_parallax_nodes/CCTMXLayer.cpp:408:45: error: cast from ‘void*’ to ‘int’ loses precision
../tileMap_parallax_nodes/CCTMXLayer.cpp: In member function ‘virtual void cocos2d::CCTMXLayer::removeChild(cocos2d::CCNode*, bool)’:
../tileMap_parallax_nodes/CCTMXLayer.cpp:475:70: error: cast from ‘void*’ to ‘unsigned int’ loses precision

I am guessing, this is because I am on a 64Bit machine and cocos2d-x can not (yet?) be compiled for 64Bit.

Now I do not really understand what in the lines listed above happens. But it has all to do with explicit converting “m_pAtlasIndexArray->arr[…]”.
Can this be made 64Bit compatible? Are there any other difficulties expected for 64Bit?

Thanks!
Nathan


#2

This pull request is to fix this error


But currently we have no ubuntu 64bit system to check this.


#3

I also fixed this in my fork on github (same username), but Walzer told me “int was enough” :confused:

Luke.


#4

No, the pull request can not work. It have no 64-bit libs.
You said you have fixed it, did you use the 32-bit libs, such as libpng.


#5

64 bit libs are added to the pull request. Can you have a check?


#6

But the other question I asked… Why we bundle those libs? Shouldn’t we use those libs that comes with the OS?


#7

Did the OS offers it? Or just use apt-get install to install it?
I think it is better if we can do it like this.
Linux port is done by laschweinski.

But I agree with you if we can do it better.


#8

Now I have only 32-bit ubuntu.
I have downloaded 64-bit, but my vmware is 32-bit.
I don’t know if I can install 64-bit ubuntu on 32-bit vmware.
I will try it.


#9

BTW, my pc is 64-bit.


#10

I believe libfreetype, libcurl, libxml2, libpng and libjpeg can be installed using apt-get. However, I don’t know where is libfmodex.so come from.

I have not tried myself, but I believe you can install 64 bit ubuntu if your host is 64 bit.


#11

I have also added 64 bit fmodex to the pull request. However, please note that fmodex is not free software, see www.fmod.org.

I think in future, we should avoid using fmodex.


#12

Yes, I agree with you.

It is better if somebody has time to do the job:

  1. replace fmodex
  2. use apt-get to download the needed libs

#13

No, I said I fixed the code. In my version, I changed the makefiles to remove hard coding but also used the system libs.

But the code was right, which you said it wasn’t.

Luke.


#14

I think Luke may have some important points. I thought that there is no pointer converted to int values. Only “index” was converted to int values. I will re-exam the source see if it is this case.


#15

I have re-examed the patch. I think it is quite safe to use int values there because those int values are the indexes into the array not a pointer value.


#16

Thank you, I have merged it.