2015-04-12 832 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乾杯!