[OpenSuse] Can't build cpp-tests as a desktop linux project

I am using OpenSuse 13.1, all necessary dependencies installed, cocos2dx version is 3.2 (stable). And installing/launching cpp-tests for Android (via terminal) works like a charm, no problems at all. But now
I want to use it for desktop.

cd COCOS2DX_HOME
mkdir opensuse_build
cd opensuse_build
cmake …

– The C compiler identification is GNU 4.8.1
– The CXX compiler identification is GNU 4.8.1
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
Using chipmunk …
– Configuring done
– Generating done
– Build files have been written to: /home/username/DevTools/Cocos2dx/cocos2dx/cocos2d-x-3.2/opensuse_build

make


[ 11%] Built target xxhash
Scanning dependencies of target audio
[ 11%] Building CXX object cocos/audio/CMakeFiles/audio.dir/linux/SimpleAudioEngineFMOD.cpp.o
In file included from /home/username
/DevTools/Cocos2dx/cocos2dx/cocos2d-x-3.2/cocos/cocos2d.h:211:0,
                 from /home/username
/DevTools/Cocos2dx/cocos2dx/cocos2d-x-3.2/cocos/audio/linux/SimpleAudioEngineFMOD.cpp:29:
/home/username
/DevTools/Cocos2dx/cocos2dx/cocos2d-x-3.2/cocos/platform/desktop/CCGLView.h:32:19: fatal error: glfw3.h: No such file or directory
 #include “glfw3.h”
                   ^
compilation terminated.
make[2]: *** [cocos/audio/CMakeFiles/audio.dir/linux/SimpleAudioEngineFMOD.cpp.o] Error 1
make[1]: *** [cocos/audio/CMakeFiles/audio.dir/all] Error 2
make: *** [all] Error 2

I’ve used this tutorial http://stackoverflow.com/questions/17768008/how-to-build-install-glfw-3-and-use-it-in-a-linux-project, looked at install-deps-linux.sh script, some other considerations and compiled and properly installed glfw3 - I am 100% sure here as I double chacked everything twice. After installing glfw3 I’ve launched make again.

make


here goes a lot of output from building process

Linking CXX static library …/…/…/lib/libluabinding.a
[ 72%] Built target luabinding
Scanning dependencies of target cpp-empty-test
[ 72%] Building CXX object tests/cpp-empty-test/CMakeFiles/cpp-empty-test.dir/proj.linux/main.cpp.o

Linking CXX executable …/…/bin/cpp-empty-test/cpp-empty-test
/usr/lib64/gcc/x86_64-suse-linux/4.8/…/…/…/…/x86_64-suse-linux/bin/ld: cannot find -lglfw
collect2: error: ld returned 1 exit status
make[2]: *** [bin/cpp-empty-test/cpp-empty-test] Error 1
make[1]: *** [tests/cpp-empty-test/CMakeFiles/cpp-empty-test.dir/all] Error 2
make: *** [all] Error 2

And that’s all, I don’t know what should I do next. Any ideas ?

Before I was using PcLinuxOS and I face similar issue and the following link assist me

Currently I’m using linux kubuntu and its compling and working perfect.

Thank you, but looks like I’ve already solved this. I had this error (as author of those article):

But I have compiled and installed successfully appropriate glfw library version, and now I have a problem on the next stage:

Any other ideas ?

OK, I’ve got the solution, that was completely linking problem.

To solve this problem go to

COCOS_ROOT/cocos/CMakeLists.txt

There you could find the following section:

set(COCOS_LINK
  jpeg
  webp
  tiff
  freetype
  fontconfig
  png
  pthread
  glfw
  GLEW
  GL
  X11
  rt
  z
)

Replace

glfw

to

glfw3
Xi  
Xxf86vm
Xrandr

Total looks like

set(COCOS_LINK
  jpeg
  webp
  tiff
  freetype
  fontconfig
  png
  pthread
  glfw3
  Xi  
  Xxf86vm
  Xrandr
  GLEW
  GL
  X11
  rt
  z
)

And that’s all.

Probably later I will add complete complete list of actions to run cocos2dx on openSuse. For now just briefly description:

  1. Install dependencies
  2. Properly install glfw3

// don’t forget to use here ‘checkinstall’ instead of ‘make install’ (it could be installed via zypper of yast, checkinstall and rpm-build packages)

  1. Edit CMakeLists.txt according to instructions above
  2. that’s all

Hi, @daxh!
Can you please test on OpenSuse v3 branch of cocos2d-x from github, after this commit: Fix finding glfw3 on ubuntu 14.10?

Recently auto detection of needed libraries was added to code, so it is high chance that now glfw3 will be find properly (but currently tested environments only ubuntu and CentOS on CI cluster), so if you can test on OpenSuse it will be very useful!