cocos2d-x-3.0 linux 64bit

cocos2d-x-3.0 linux 64bit
0.0 0



I am trying to upgrade to the latest cocos2d-x 3.0 src from github, but am running into dependencies issues on ubuntu 13.04 64bit.

I had previously successfully built 3.0, but after grabbing the latest source I see the dependencies have changes in

It used to require libglfw-dev but now uses libdsdl2-dev.

Has anyone built this latest source on ubuntu 13.04 (64bit)?



Add this ppa and install package libsdl2-dev:


Thank you, that did it for me.

Though running an existing sample game, the graphics did not look right… I’ll have to get back to this when I have some more time.



I just tried building the cocos2d project again from scratch. I had to follow these instructions to install glfw3:

but am still running into this issue when running /

LINK ../../lib/linux/debug/ /usr/bin/ld: error: /usr/local/lib/libglfw3.a(context.c.o): requires unsupported dynamic reloc 11; recompile with -fPIC

I am not sure how to fix this issue, could anyone provide some help? I am on ubuntu 13.04 64bit

Thanks for the help


Looking at cocos2dx/proj.linux/, it does seem to include -fPIC

CCFLAGS += -MMD -Wno-deprecated-declarations -fPIC CXXFLAGS += -MMD -Wno-deprecated-declarations -fPIC -std=gnu++0x

If anyone is successfully building cocos2dx v3 on linux 64bit (I am on Ubuntu 13.04), help would be appreciated


I built it successfully on Ubuntu 13.04 (plain install) yesterday with github develop branch.

I also documented the steps to build it here:

If that doesn’t work, please, let me know.



did you do anything else? I only see mention of running ./
I am trying to build cocos2d-x using which also runs install-deps-linux. It doesnt complain about any missing dependencies, other than glfw3 the first time I ran it. So I followed to build glfw from source. Did you not have to do this from your plain ubuntu install?

Now, running begins to build everything but eventually aborts on the above error
LINK ../../lib/linux/debug/ /usr/bin/ld: error: /usr/local/lib/libglfw3.a(context.c.o): requires unsupported dynamic reloc 11; recompile with -fPIC

I can see that the file already specifies -fPIC as part of the gcc compile flags, but that is as much as I know


The script should install glfw for you.

If it doesn’t install it, perhaps you already have it installed. If so, remove that .deb package and try to run the script again.

The script that installs glfw is cocos2dx/tools/travis-scripts/



thanks for the help. I had glfw2 installed, so I removed that and now the dependencies are all taken care of.

I am still having issues building cocos2d-x though. Now, running I see the following:
rm f bin/release/TestCpp core
make[1]: Leaving directory `/home/mike/projects/cocos2d/cocos2d-x/samples/Cpp/TestCpp/proj.linux’
C external/chipmunk/proj.linux
make: Circular libextensions <- cocosdenshion dependency dropped

and also the sample projects fail to build after this error:
make[1]: *** No rule to make target `obj/debug/auto-generated/lua-bindings/lua_cocos2dx_auto.o', needed by `/home/mike/projects/cocos2d/cocos2d-x/lib/linux/debug/'. Stop.

When I try to build them myself, for example
cd samples/Cpp/TestCpp/proj.linux/ && make DEBUG=1 all

it complains about the cocosdenshion.

While I am at it, I want to enable box2d over chipmunk, what is the correct way to do so? Should I just need to replace “chipmunk” with “box2d” in the “all” target in the toplevel Makefile ?




Make sure that you are using the latest commit from github/develop. It should be: 3e017e1a4249a4364ef9c51d0d79350ef957afa1

Lua bindings are not working on Linux as of today. It’s going to be fixed soon.

Besides Lua, the rest should work.

Just do:

$ cd cocos2d-x
$ make clean
$ ./ 
$ ./ 
$ make   # <--- do make again to compile release
$ cd samples/Cpp/TestCpp/proj.linux
$ make

And in bin/release and bin/debug you should have the binaries.
If it doesn’t work, please let me know.



thanks for the help, but I am still having issues. It does not compile completely cleanly, and when I try to build my sample project against it, it fails to find the cocosdension lib

make: *** No rule to make target `../../../cocos2d-x/lib/linux/debug/', needed by `bin/debug/HelloWorld'. Stop.

It looks like it is only with the debug build, the release build does have the cocosdenshion lib



I was able to compile a new project both in release and in debug mode.
I’m not sure why you are having those errors.

Just to make sure I understood the error correctly:

  • You are able to compile and run your game in RELEASE mode
  • But you can’t compile in DEBUG mode.

Is that correct?
If so, how are you compiling it in release mode ? Please post all the commands that you are using . thanks.



In DEBUG mode the shared is missing under lib/linux/debug. I just copy it from lib/linux/release though to solve that issue for now.

My gcc version is 4.7.3 if that matters


Note, that my Makefile is based off the sample/TestCPP project, i.e.) it includes this:

SHAREDLIBS = -lcocos2d -lcocosdenshion -lcurl -lpng

include ../../../../cocos2dx/proj.linux/

INCLUDES +=  -I../ \
    -I../../ \
    -I../Classes \
    -I$(COCOS_ROOT)/CocosDenshion/include \
    -I$(COCOS_ROOT)/extensions/ \


I think I see my issue.

My proj.linux script was still based off how it worked in an earlier rev of the cocos2d v3 branch. Having just generated a new sample project using the bundled tool, I can see that much more logic has been pushed into that script, including more dependency installation and I can see that it is building the Cocosdenshion debug lib as well.

Thanks for the help on, this.


I’m glad that it compiles ok now!