ProgrammingGuide > Installations > Linux Installation and Setup

Linux Installation and Setup

version: Cocos2d-x v3.x
update: Updated almost 2 years ago

Environment Requirements

Prerequisite

Download cocos2d-x and unzip it. (maybe: ~/)

Install dependencies. The dependencies are:

libx11-dev
libxmu-dev
libglu1-mesa-dev
libgl2ps-dev
libxi-dev
g++-4.9
libzip-dev
libpng12-dev
libcurl4-gnutls-dev
libfontconfig1-dev
libsqlite3-dev
libglew-dev
libssl-dev
glfw3

If you are using Ubuntu/Debian, there is a shell script build/install-deps-linux.sh
for you to install the dependences easily. Run commands below in terminal:

    $ cd $cocos2dx_root/build
    $ sudo ./install-deps-linux.sh (You should enter your root password here.)

After hit the command sudo ./install-deps-linuxsh, it might prompts you to hit ENTER to continue the installation process.
Otherwise, you should install the dependencies manually.

N.B. To install glfw3, you should run the script under

{your_cocos2dx_root}/tools/travis-scripts/install_glfw.sh

Generate Makefile

Run cmake to generate makefile:

    $ mkdir linux-build
    $ cd linux-build
    $ cmake ../..

When cmake returns correctly, many files & folders will be generated in

coocs2dx_root/build/linux-build

Compile

Run make to compile:

    $ make

Application will be generated in cocos2dx_root/build/linux-build/bin/cpp-tests/
if compiled successfully.

Run

    $ cd bin/cpp-tests/
    $ ./cpp-tests

1.png (54.8 kB) walzer@cocos2d-x.org, 2014-12-03 04:52

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.