Ubuntu 64Bit

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

This pull request is to fix this error


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

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

Luke.

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.

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

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

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.

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.

BTW, my pc is 64-bit.

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.

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.

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

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.

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.

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.

Thank you, I have merged it.