cocos2d-x-3.0 linux 64bit

Hi,

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 install-deps-linux.sh

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

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

Thanks

Add this ppa and install package libsdl2-dev: https://launchpad.net/~openmw/+archive/build

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.

Hi,

I just tried building the cocos2d project again from scratch. I had to follow these instructions to install glfw3: http://stackoverflow.com/questions/17768008/how-to-build-install-glfw-3-and-use-it-in-a-linux-project

but am still running into this issue when running /make-all-linux-project.sh

LINK ../../lib/linux/debug/libcocos2d.so /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/cocos2dx.mk, 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:
http://www.cocos2d-x.org/wiki/How_to_create_a_multi-platform_project_in_one_command_line#Linux-Builder-Requirements

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

Hi,

did you do anything else? I only see mention of running ./install-deps-linux.sh
I am trying to build cocos2d-x using make-all-linux-project.sh 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 http://stackoverflow.com/questions/17768008/how-to-build-install-glfw-3-and-use-it-in-a-linux-project to build glfw from source. Did you not have to do this from your plain ubuntu install?

Now, running make-all-linux-project.sh begins to build everything but eventually aborts on the above error
LINK ../../lib/linux/debug/libcocos2d.so /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 cocos2d.mk file already specifies -fPIC as part of the gcc compile flags, but that is as much as I know

The script install-deps-linux.sh 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/install_glfw.sh

Hi,

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 make-all-linux-project.sh 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’
make
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/liblua.so'. 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 ?

Thanks

Mike,

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
$ ./install-deps-linux.sh 
$ ./make-all-linux-project.sh 
$ 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.

Hi,

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/libcocosdenshion.so', needed by `bin/debug/HelloWorld'. Stop.

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

@Mike:

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.

Correct.

In DEBUG mode the shared libcocosdenshion.so 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
COCOS_LIBS = $(LIB_DIR)/libcocos2d.so $(LIB_DIR)/libcocosdenshion.so

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

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

I think I see my issue.

My proj.linux build.sh 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 build.sh 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!