Cocos2d-x-3.11 linux default project

Cocos2d-x-3.11 linux default project
0

Hi, everyone!

I have loaded a new version of the cocos engine and created default application. Then I have tried to build and run it using cocos utility but I have got the following error:

CMake Error at cocos2d/cmake/Modules/FindPackageHandleStandardArgs.cmake:136 (message):
  Could NOT find Chipmunk (missing: CHIPMUNK_LIBRARIES CHIPMUNK_INCLUDE_DIR)
Call Stack (most recent call first):
  cocos2d/cmake/Modules/FindPackageHandleStandardArgs.cmake:343 (_FPHSA_FAILURE_MESSAGE)
  cocos2d/cmake/Modules/FindChipmunk.cmake:77 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  cocos2d/cmake/Modules/CocosBuildHelpers.cmake:44 (find_package)
  cocos2d/CMakeLists.txt:238 (cocos_find_package)

Unfortunately, I am not cmake-rockstar ): Please, can anyone help me?

what do you mean “default” project?

You can cocos new ... and tried to compile it?

Can you show me your steps and I will test in my Ubuntu 15.04 VM?

I loaded Cocos, unpacked it, then I launched install-deps-linux.sh and setup.py and reloaded my bashrc. I created a default project using command:

cocos new stub11 -p com.example.stub -l cpp -d .

From the project folder I ran:

cocos run -p linux

and got CMake errors.

My CMake version is 3.2.2, and my Linux is 32-bit Ubuntu 14.04

ok, let me fire up my Ubuntu 15.04 and try this. I’ll get back to you with my findings.

Ubuntu 15.10, latest from GitHub.

I did:

jtsm@ubuntu:~$ cocos new MyCppGame -p com.slackmoehrle.game -l cpp -d .
> Copy template into /home/jtsm/cocos2d-x/MyCppGame
> Copying cocos2d-x files...
> Rename project name from 'HelloCpp' to 'MyCppGame'
> Replace the project name from 'HelloCpp' to 'MyCppGame'
> Replace the project package name from 'org.cocos2dx.hellocpp' to 'com.slackmoehrle.game'
> Replace the Mac bundle id from 'org.cocos2dx.hellocpp' to 'com.slackmoehrle.game'
> Replace the iOS bundle id from 'org.cocos2dx.hellocpp' to 'com.slackmoehrle.game'
jtsm@ubuntu:~$ 

jtsm@ubuntu:~$ cd MyCppGame
jtsm@ubuntu:~/MyCppGame$ cocos run -p linux

and after some time:

What is your CMake version?

cocos-3.10 works, I guess I should try to use some diff tool…

Hi,
I’ve been trying to install and use cocos2d-x on Ubuntu 15.10 32 bit but errors keep showing up. Here’s the complete procedure I followed and the error that occurs:

  1. git clone https://github.com/cocos2d/cocos2d-x.git
  2. cd cocos2d-x/
  3. python download-deps.py
  4. git submodule update --init
  5. ./setup.py
  6. in my /home/morpheus/Scrivania I made a directory called mygame and changed directory into /home/morpheus/Scrivania
  7. cocos new MyGame -p com.your_company.mygame -l cpp -d ./mygame/
  8. cd cocos2d-x/build/
  9. ./install-deps-linux.sh
  10. cocos run -p linux

The error that occurs is:

It appears you are builing natively for Linux with GCC
-- OpenGL include dirs: /usr/include
-- GLEW include dirs: /usr/include
-- PkgConfig found
-- GLFW3 include dirs: /usr/local/include/GLFW
-- FMOD include dirs: /home/morpheus/Scrivania/mygame/MyGame/cocos2d/external/linux-specific/fmod/include
-- Fontconfig include dirs: /usr/include/freetype2
-- GTK3 include dirs: /usr/include/gtk-3.0;/usr/include/at-spi2-atk/2.0;/usr/include/at-spi-2.0;/usr/include/dbus-1.0;/usr/lib/i386-linux-gnu/dbus-1.0/include;/usr/include/gtk-3.0;/usr/include/gio-unix-2.0/;/usr/include/mirclient;/usr/include/mircommon;/usr/include/cairo;/usr/include/pango-1.0;/usr/include/harfbuzz;/usr/include/pango-1.0;/usr/include/atk-1.0;/usr/include/cairo;/usr/include/pixman-1;/usr/include/freetype2;/usr/include/libpng12;/usr/include/gdk-pixbuf-2.0;/usr/include/libpng12;/usr/include/glib-2.0;/usr/lib/i386-linux-gnu/glib-2.0/include
-- Freetype include dirs: /home/morpheus/Scrivania/mygame/MyGame/cocos2d/external/freetype2/include/linux;/home/morpheus/Scrivania/mygame/MyGame/cocos2d/external/freetype2/include/linux
-- WebP include dirs: /home/morpheus/Scrivania/mygame/MyGame/cocos2d/external/webp/include/linux
CMake Error at cocos2d/cmake/Modules/FindPackageHandleStandardArgs.cmake:136 (message):
  Could NOT find Chipmunk (missing: CHIPMUNK_LIBRARIES CHIPMUNK_INCLUDE_DIR)
Call Stack (most recent call first):
  cocos2d/cmake/Modules/FindPackageHandleStandardArgs.cmake:343 (_FPHSA_FAILURE_MESSAGE)
  cocos2d/cmake/Modules/FindChipmunk.cmake:77 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  cocos2d/cmake/Modules/CocosBuildHelpers.cmake:44 (find_package)
  cocos2d/cmake/Modules/BuildModules.cmake:45 (cocos_find_package)
  cocos2d/CMakeLists.txt:92 (BuildModules)

Can anyone confirm that it’s possible to use cocos2d-x v3.11 on Ubuntu? Nobody has experienced these errors?
I wanted to use cocos framework so much but I’m starting to get tired of wasting so much time just to install the framework, create and build a new project.

EDIT: after executing sudo apt-get install chipmunk-dev the previous error seems to be solved but then if I execute cocos run -p linux another bunch of errors show up like:

/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘cocos2d::Vec2 cocos2d::PhysicsJointLimit::getAnchr1() const’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:307:82: error: ‘cpSlideJointGetAnchorA’ was not declared in this scope
     return PhysicsHelper::cpv2point(cpSlideJointGetAnchorA(_cpConstraints.front()));
                                                                                  ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘void cocos2d::PhysicsJointLimit::setAnchr1(const cocos2d::Vec2&)’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:312:83: error: ‘cpSlideJointSetAnchorA’ was not declared in this scope
     cpSlideJointSetAnchorA(_cpConstraints.front(), PhysicsHelper::point2cpv(anchr));
                                                                                   ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘cocos2d::Vec2 cocos2d::PhysicsJointLimit::getAnchr2() const’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:317:82: error: ‘cpSlideJointGetAnchorB’ was not declared in this scope
     return PhysicsHelper::cpv2point(cpSlideJointGetAnchorB(_cpConstraints.front()));
                                                                                  ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘void cocos2d::PhysicsJointLimit::setAnchr2(const cocos2d::Vec2&)’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:322:83: error: ‘cpSlideJointSetAnchorB’ was not declared in this scope
     cpSlideJointSetAnchorB(_cpConstraints.front(), PhysicsHelper::point2cpv(anchr));
                                                                                   ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘cocos2d::Vec2 cocos2d::PhysicsJointSpring::getAnchr1() const’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:408:84: error: ‘cpDampedSpringGetAnchorA’ was not declared in this scope
     return PhysicsHelper::cpv2point(cpDampedSpringGetAnchorA(_cpConstraints.front()));
                                                                                    ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘void cocos2d::PhysicsJointSpring::setAnchr1(const cocos2d::Vec2&)’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:413:85: error: ‘cpDampedSpringSetAnchorA’ was not declared in this scope
     cpDampedSpringSetAnchorA(_cpConstraints.front(), PhysicsHelper::point2cpv(anchr));
                                                                                     ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘cocos2d::Vec2 cocos2d::PhysicsJointSpring::getAnchr2() const’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:418:84: error: ‘cpDampedSpringGetAnchorB’ was not declared in this scope
     return PhysicsHelper::cpv2point(cpDampedSpringGetAnchorB(_cpConstraints.front()));
                                                                                    ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘void cocos2d::PhysicsJointSpring::setAnchr2(const cocos2d::Vec2&)’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:423:85: error: ‘cpDampedSpringSetAnchorB’ was not declared in this scope
     cpDampedSpringSetAnchorB(_cpConstraints.front(), PhysicsHelper::point2cpv(anchr));
                                                                                     ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘cocos2d::Vec2 cocos2d::PhysicsJointGroove::getAnchr2() const’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:513:83: error: ‘cpGrooveJointGetAnchorB’ was not declared in this scope
     return PhysicsHelper::cpv2point(cpGrooveJointGetAnchorB(_cpConstraints.front()));
                                                                                   ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘void cocos2d::PhysicsJointGroove::setAnchr2(const cocos2d::Vec2&)’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:518:85: error: ‘cpGrooveJointSetAnchorB’ was not declared in this scope
     cpGrooveJointSetAnchorB(_cpConstraints.front(), PhysicsHelper::point2cpv(anchr2));
                                                                                     ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘cocos2d::Vec2 cocos2d::PhysicsJointLimit::getAnchr1() const’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:308:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘cocos2d::Vec2 cocos2d::PhysicsJointLimit::getAnchr2() const’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:318:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘cocos2d::Vec2 cocos2d::PhysicsJointSpring::getAnchr1() const’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:409:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘cocos2d::Vec2 cocos2d::PhysicsJointSpring::getAnchr2() const’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:419:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp: In member function ‘cocos2d::Vec2 cocos2d::PhysicsJointGroove::getAnchr2() const’:
/home/morpheus/Scrivania/mygame/MyGame/cocos2d/cocos/physics/CCPhysicsJoint.cpp:514:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
cocos2d/cocos/CMakeFiles/cocos2dInternal.dir/build.make:2699: set di istruzioni per l'obiettivo "cocos2d/cocos/CMakeFiles/cocos2dInternal.dir/physics/CCPhysicsJoint.cpp.o" non riuscito
make[2]: *** [cocos2d/cocos/CMakeFiles/cocos2dInternal.dir/physics/CCPhysicsJoint.cpp.o] Errore 1
CMakeFiles/Makefile2:562: set di istruzioni per l'obiettivo "cocos2d/cocos/CMakeFiles/cocos2dInternal.dir/all" non riuscito
make[1]: *** [cocos2d/cocos/CMakeFiles/cocos2dInternal.dir/all] Errore 2
Makefile:75: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2
Error running command, return code: 2.

I posted a few screenshots of it working for me. I am happy to try with a 32-bit version. I am using a 64-bit version. I’ll need to download a 32-bit version, so give me some time to test this, please.

I too am having the same issues with the 32-bit version of Ubuntu with cocos v3.11.1. It looks like it’s missing the 32-bit chipmunk library in the prebuilt folder for linux. After adding the 32-bit library from an earlier version of cocos, I get the same error as condorwasabi.

You need to build the latest libchipmunk.a static library to make it work on linux 32-bit system. As of now cocos2d-x contains only the 64-bit version.

Follow the instructions here to build it.

Clone the repo. After installling the prequisites go to the build directory and open terminal and type:
./build.sh -p=linux --libs=chipmunk --arch=i386

This will build the required library. Just copy the libchipmunk.a file from the i386 folder to the 32-bit folder (create it if it doesn’t exist) in your project.

hello I have the same problem.

yfk@yfkprivate:~/Document/cocostest/linux-build$ sudo su
root@yfkprivate:/home/yfk/Document/cocostest/linux-build# cocos

/home/yfk/文档/cocos/cocos2d-x-3.17.2/tools/cocos2d-console/bin/cocos.py 2.3 - cocos console: cocos2d-x 的命令行工具集。

可用的命令:
run 在设备或者模拟器上编译,部署和运行工程。
luacompile 对 lua 文件进行加密和编译为字节码的处理。
deploy 编译并在设备或模拟器上部署工程。
compile 编译并打包工程。
gen-simulator 生成 Cocos 模拟器。
new 创建一个新的工程。
jscompile 对 js 文件进行加密和压缩处理。

可用的参数:
-h, --help 显示帮助信息。
-v, --version 显示命令行工具的版本号。
–ol [‘en’, ‘zh’, ‘zh_tr’] 指定输出信息的语言。
–agreement [‘y’, ‘n’] 使用指定的值来同意或拒绝协议。

示例:
cocos new --help
cocos run --help
root@yfkprivate:/home/yfk/Document/cocostest/linux-build# cmake …
– PROJECT_NAME:cocostest
– PROJECT_SOURCE_DIR:/home/yfk/Document/cocostest
– COCOS2DX_ROOT_PATH:/home/yfk/Document/cocostest/cocos2d
– CMAKE_MODULE_PATH:/home/yfk/Document/cocostest/cocos2d/cmake/Modules/
– PROJECT_BINARY_DIR:/home/yfk/Document/cocostest
– ENGINE_BINARY_PATH:/home/yfk/Document/cocostest/engine
– CMAKE_GENERATOR: Unix Makefiles
– CMAKE_BUILD_TYPE: Debug
– Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
– Checking for one of the modules ‘fontconfig’
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Fontconfig (missing: FONTCONFIG_FOUND) (found version “”)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cocos2d/cmake/Modules/FindFontconfig.cmake:13 (find_package_handle_standard_args)
cocos2d/cmake/Modules/CocosBuildHelpers.cmake:273 (find_package)
cocos2d/cmake/Modules/CocosConfigDepend.cmake:11 (cocos_find_package)
cocos2d/cmake/Modules/CocosConfigDepend.cmake:91 (cocos2dx_depend)
cocos2d/cocos/CMakeLists.txt:131 (use_cocos2dx_libs_depend)

– Configuring incomplete, errors occurred!
See also “/home/yfk/Document/cocostest/CMakeFiles/CMakeOutput.log”.

It looks like you are missing dependencies. Did you use our docs to install?