Cocos2d-x 2.2 on Linux 64bit - Eclipse build problems

Cocos2d-x 2.2 on Linux 64bit - Eclipse build problems
0.0 0


Hey there folks,

I’m encountering numerous problems, when trying to build and compile some of the Linux projects (as for example TestCpp) in Eclipse. My machine is running on #!Crunchbang (based on Debian 7), 64bit. The cocos2d-x samples are running quite well when starting them from the terminal, but Eclipse isn’t able to load/find some of the dependencies, needed to build the samples. Just to mention: I do not want to develop Android games. I just like to develop on a Linux distribution - well - until now…

So after the failed trial to build the projects (libBox2D, libChipmunk, libcocos2d, libCocosDenshion, libextension, liblua and TestCpp) I’m getting 7 Errors and a Warning.
(Some of the error messages are translated into English)

Description | Resource | Path | Location | Type

# ./linux/FmodAudioPlayer.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC | libCocosDenshion |  |  | C/C++ Problem

# fatal error: libwebsockets.h: file or directory not found | WebSocket.h | /libextension/network | line 35 | C/C++ Problem

# fatal error: WebSocket.h: file or directory not found | WebSocketTest.h | /TestCpp/Classes/ExtensionsTest/NetworkTest | line 14 | C/C++ Problem

# make: *** [Classes/ExtensionsTest/NetworkTest/WebSocketTest.o] Error 1 | TestCpp |  |  | C/C++ Problem

# make: *** [] Error 1 | libCocosDenshion |  |  | C/C++ Problem

# make: *** [network/WebSocket.o] Error 1 | libextension |  |  | C/C++ Problem

# make: *** No rule available for the target »../../../cocos2dx/platform/third_party/linux/libraries/libxml2.a«, | libcocos2d  |  |  | C/C++ Problem


# Invalid project path: Include path not found (/usr/local/cocos2d-x-2.2/cocos2dx/platform/third_party/linux/libxml2). | libcocos2d |  | pathentry | Path Entry Problem

I will also attach pictures of the console output.

Thanks for your time and help,



libcocos2d.png (83.1 KB)

libCocosDenshion.png (104.9 KB)

libextension.png (130.6 KB)

TestCpp.png (131.9 KB)



I found the error causes:

  • lack of “PIC” option (Position Independent Option);
  • two implementation of SimpleAudioEngine (SimpleAudioEngineFMOD.cpp and SimpleAudioEngineOpenAL.cpp);

To fix it:

  • mark PIC option; Select “Properties” of libCocoDenshion; Properties~~>C/C++ Build~~>Settings~~>Miscellanous~~>Position Independent Code

  • select audio engine:

This could be done in different manners. I decided to use preprocessor commands to indicate that on linux I would like to use OpenAL.

I changed following files:

  • /libCocosDenshion/linux/FmodAudioPlayer.cpp
  • /libCocosDenshion/linux/FmodAudioPlayer.h
  • /libCocosDenshion/linux/SimpleAudioEngineFMOD.cpp

By adding on the beginning of the file:


at the end.

That’s all :wink:

I think, there is also need to fix script that creates cdt project, but for my purposes uper changes are sufficient.