2015-04-12 238 views
1

我试图编译的cocos2d-X 3.5在openSUSE 13.2,我得到.log文件以下错误:CMake的失败编译

Determining if the pthread_create exist failed with the following output: 
Change Dir: /home/humman/android-dev/cocos2d-x-3.5/cocos2d-x-3.5/build/linux-build/CMakeFiles/CMakeTmp 

Run Build Command:"/usr/bin/gmake" "cmTryCompileExec846787943/fast" 
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec846787943.dir/build.make CMakeFiles/cmTryCompileExec846787943.dir/build 
gmake[1]: Entering directory '/home/humman/android-dev/cocos2d-x-3.5/cocos2d-x-3.5/build/linux-build/CMakeFiles/CMakeTmp' 
/usr/bin/cmake -E cmake_progress_report /home/humman/android-dev/cocos2d-x-3.5/cocos2d-x-3.5/build/linux-build/CMakeFiles/CMakeTmp/CMakeFiles 1 
Building C object CMakeFiles/cmTryCompileExec846787943.dir/CheckSymbolExists.c.o 
/usr/bin/cc -fno-exceptions -std=c99 -o CMakeFiles/cmTryCompileExec846787943.dir/CheckSymbolExists.c.o -c /home/humman/android-dev/cocos2d-x-3.5/cocos2d-x-3.5/build/linux-build/CMakeFiles/CMakeTmp/CheckSymbolExists.c 
Linking C executable cmTryCompileExec846787943 
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec846787943.dir/link.txt --verbose=1 
/usr/bin/cc -fno-exceptions -std=c99  CMakeFiles/cmTryCompileExec846787943.dir/CheckSymbolExists.c.o -o cmTryCompileExec846787943 -rdynamic 
CMakeFiles/cmTryCompileExec846787943.dir/CheckSymbolExists.c.o: In function `main': 
CheckSymbolExists.c:(.text+0x16): undefined reference to `pthread_create' 
collect2: error: ld returned 1 exit status 
CMakeFiles/cmTryCompileExec846787943.dir/build.make:88: recipe for target 'cmTryCompileExec846787943' failed 
gmake[1]: *** [cmTryCompileExec846787943] Error 1 
gmake[1]: Leaving directory '/home/humman/android-dev/cocos2d-x-3.5/cocos2d-x-3.5/build/linux-build/CMakeFiles/CMakeTmp' 
Makefile:118: recipe for target 'cmTryCompileExec846787943/fast' failed 
gmake: *** [cmTryCompileExec846787943/fast] Error 2 

File /home/humman/android-dev/cocos2d-x-3.5/cocos2d-x-3.5/build/linux-build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: 
/* */ 
#include <pthread.h> 

int main(int argc, char** argv) 
{ 
    (void)argv; 
#ifndef pthread_create 
    return ((int*)(&pthread_create))[argc]; 
#else 
    (void)argc; 
    return 0; 
#endif 
} 

Determining if the function pthread_create exists in the pthreads failed with the following output: 
Change Dir: /home/humman/android-dev/cocos2d-x-3.5/cocos2d-x-3.5/build/linux-build/CMakeFiles/CMakeTmp 

Run Build Command:"/usr/bin/gmake" "cmTryCompileExec3838281423/fast" 
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec3838281423.dir/build.make CMakeFiles/cmTryCompileExec3838281423.dir/build 
gmake[1]: Entering directory '/home/humman/android-dev/cocos2d-x-3.5/cocos2d-x-3.5/build/linux-build/CMakeFiles/CMakeTmp' 
/usr/bin/cmake -E cmake_progress_report /home/humman/android-dev/cocos2d-x-3.5/cocos2d-x-3.5/build/linux-build/CMakeFiles/CMakeTmp/CMakeFiles 1 
Building C object CMakeFiles/cmTryCompileExec3838281423.dir/CheckFunctionExists.c.o 
/usr/bin/cc -fno-exceptions -std=c99 -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTryCompileExec3838281423.dir/CheckFunctionExists.c.o -c /usr/share/cmake/Modules/CheckFunctionExists.c 
Linking C executable cmTryCompileExec3838281423 
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3838281423.dir/link.txt --verbose=1 
/usr/bin/cc -fno-exceptions -std=c99 -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTryCompileExec3838281423.dir/CheckFunctionExists.c.o -o cmTryCompileExec3838281423 -rdynamic -lpthreads 
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lpthreads 
collect2: error: ld returned 1 exit status 
CMakeFiles/cmTryCompileExec3838281423.dir/build.make:88: recipe for target 'cmTryCompileExec3838281423' failed 
gmake[1]: *** [cmTryCompileExec3838281423] Error 1 
gmake[1]: Leaving directory '/home/humman/android-dev/cocos2d-x-3.5/cocos2d-x-3.5/build/linux-build/CMakeFiles/CMakeTmp' 
Makefile:118: recipe for target 'cmTryCompileExec3838281423/fast' failed 
gmake: *** [cmTryCompileExec3838281423/fast] Error 2 

我手动安装的依赖和库,但我仍然得到这个错误。有谁知道发生了什么事?

注:当我尝试编译,第2行是:

~/android-dev/cocos2d-x-3.5/cocos2d-x-3.5/build/linux-build> cmake ../.. 
CMake Error at CMakeLists.txt:35 (cmake_policy): 
    Policy "CMP0054" is not known to this version of CMake. 

感谢:d

回答

2

解决,我只是没了评论此行的CMakeList.txt文件

#if(CMAKE_VERSION VERSION_GREATER 3) 
    #cmake_policy(SET CMP0054 NEW) 
#endif() 

但是现在,当我使用make命令(无论使用NetBeans还是终端时),它以98%的错误结束(编译约15分钟后)

[ 98%] Built target cocos2d 
[ 98%] Built target MyGame_CORE_PRE_BUILD 
MyGame_PRE_BUILD ... 
[ 98%] Built target MyGame_PRE_BUILD 
Linking CXX executable bin/MyGame 
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: lib/libcocos2d.a(CCSpriteFrameCache.cpp.o): undefined reference to symbol '[email protected]@GLIBCXX_3.4' 
/usr/lib64/libstdc++.so.6: error adding symbols: DSO missing from command line 
collect2: error: ld returned 1 exit status 
CMakeFiles/MyGame.dir/build.make:164: recipe for target 'bin/MyGame' failed 
make[2]: *** [bin/MyGame] Error 1 
CMakeFiles/Makefile2:64: recipe for target 'CMakeFiles/MyGame.dir/all' failed 
make[1]: *** [CMakeFiles/MyGame.dir/all] Error 2 
Makefile:76: recipe for target 'all' failed 
make: *** [all] Error 2 

任何想法?


解决,如果任何人有同样的问题,只是使用cmake的使用参数-pthread,然后你就可以使用make来构建。如果你想使用NetBeans构建,你只需要保留-G“Unix ...”参数,并在CMakefile.txt中添加以下行:set(-pthread) - 我确实在顶部添加了它 - 那就是所有,它应该是一切OK:D干杯!