Linux config cocos
//https://www.cnblogs.com/coolulu/p/4142342.html
编译完之后执行文件在cocos2d-x-3.1/build/linux-build/bin的子文件夹里
sudo apt-get install libx11-dev | |||
sudo apt-get install libxmu-dev | |||
sudo apt-get install libglu1-mesa-dev | |||
sudo apt-get install libgl2ps-dev | |||
sudo apt-get install libxi-dev | |||
sudo apt-get install g++ | |||
sudo apt-get install libzip-dev | |||
sudo apt-get install libpng12-dev | |||
sudo apt-get install libcurl4-gnutls-dev | |||
sudo apt-get install libfontconfig1-dev | |||
sudo apt-get install libsqlite3-dev | |||
sudo apt-get install libglew*-dev | |||
sudo apt-get install libssl-dev | |||
$ cd $cocos2dx_root/build | |||
$ ./install-deps-linux.sh | |||
$ mkdir linux-build | |||
$ cd linux-build | |||
$ cmake ../.. | |||
$ make(建议make -k遇到错误不中断,继续编译,节省时间) | |||
问题1 解决 | cocos2dx3.x 生成makefile g++需要支持-std=c++11编译选项 把g++升级到4.8.3 | ||
问题2 解决 | Linking CXX executable ../../bin/cpp-empty-test/cpp-empty-test | ||
/usr/bin/ld: cannot find -lfmodex64 | |||
/usr/bin/ld: cannot find -lwebsockets | |||
/usr/bin/ld: cannot find -ljpeg | sudo apt-get install libjpeg-dev | ||
/usr/bin/ld: cannot find -lwebp | sudo apt-get install libwebp-dev | ||
/usr/bin/ld: cannot find -ltiff | sudo apt-get install libtiff4-dev | ||
collect2: 错误:ld 返回 1 | |||
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 | |||
问题3 解决 | /usr/bin/ld: cannot find -lfmodex64 | ||
FQ | 参考:http://ubuntuguide.org/wiki/Skulltag_tips | ||
FQ | 参考:http://wiki.zandronum.com/Install_Zandronum_on_Ubuntu | ||
wget -c http://www.fmod.org/download/fmodex/api/Linux/fmodapi42416linux64.tar.gz | |||
make install | |||
mv /usr/local/lib/libfmodex64-4.24.16.so /usr/local/lib/libfmodex64.so | |||
问题4 解决 | /usr/bin/ld: cannot find -lwebsockets | ||
wget -c http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/snapshot/libwebsockets-1.3-chrome37-firefox30.tar.gz | |||
先要安装openssl | |||
sudo apt-get install openssl | |||
sudo apt-get install libssl-dev | |||
cd 源代码目录 | |||
mkdir build | |||
cd build | |||
cmake .. | |||
make | |||
cd lib | |||
vi /etc/ld.so.conf 添加/usr/local/lib ldconfig | |||
1 | cp libwebsockets.so.4.0.0 /usr/local/lib/libwebsockets.so 这个方法后报 问题5 | ||
问题5 解决 | Linking CXX executable ../../bin/cpp-empty-test/cpp-empty-test | ||
../../lib/libcocos2d.a(CCImage.cpp.o): In function `WebPIDecGetYUV': | |||
/home/melos1305/project/cocos2dx/cocos2d-x-3.1/external/webp/include/linux/decode.h:322: undefined reference to `WebPIDecGetYUVA' | |||
collect2: 错误:ld 返回 1 | |||
make[2]: *** [bin/cpp-empty-test/cpp-empty-test] Error 1 | |||
make[2]: Target `tests/cpp-empty-test/CMakeFiles/cpp-empty-test.dir/build' not remade because of errors. | |||
make[1]: *** [tests/cpp-empty-test/CMakeFiles/cpp-empty-test.dir/all] Error 2 | |||
[ 72%] Built target cpp-empty-test_CORE_PRE_BUILD | |||
cpp-empty-test_PRE_BUILD ... | |||
可能是sudo apt-get install libwebp-dev安装的版本对不上,sudo apt-get remove libwebp-dev | |||
后面自然好,在/external/webp/prebuilt/linux/64-bit/libwebp.a 转换成 libweb.so ar -x libwebp.a;gcc -shared *.o -o libwebp.so | |||
一开始还是错的, mv libwebp.so libwebp.so111 删了libwebp.so编译过了 | |||
计划去下载webp":"0.2.1的源代码编译 | |||
wget -c https://chromium.googlesource.com/webm/libwebp/+archive/74fefc8ce8d83946b763345575d6d2c608ba212a.tar.gz | |||
问题6 解决 | melos1305@melos1305-B85M-DS3H:~/project/cocos2dx/cocos2d-x-3.1/build/linux-build/bin/cpp-empty-test$ ./cpp-empty-test | ||
./cpp-empty-test: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by ./cpp-empty-test) | |||
1. vi /etc/ld.so.conf 添加/usr/local/gcc-4.8.3/lib64/libstdc++.so.6 ldconfig 失败 | |||
2. ln -si /usr/local/gcc-4.8.3/lib64/libstdc++.so.6.0.19 libstdc++.so.6 | |||
ok 只能挂链接,服务端的ubuntu是64位,所以lib64/libstd++.so.6的默认版本不够,需要支持到GLIBCXX_3.4.18以上, | |||
查看GLIBCXX信息 strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX | |||
strings /usr/local/gcc-4.8.3/lib64/libstdc++.so.6.0.19 | grep GLIBCXX |