WuJiayiSH / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools used by millions of developers all over the world.
https://wujiayish.github.io/cocos2d-x-examples/
47 stars 17 forks source link

compile error #1

Open basstal opened 2 years ago

basstal commented 2 years ago

hello, I hava follow the windows guide for this repo, but got this error when run '''cocos compile -p emscripten -m release''' , any help will be thankful.

wasm-ld: error: --shared-memory is disallowed by png.c.o because it was not compiled with 'atomics' or 'bulk-memory' features.

FAILED: bin/MyGame/MyGame.html cmd.exe /C "cd . && E:\emsdk\upstream\emscripten\em++.bat -s USE_PTHREADS -s FORCE_FILESYSTEM=1 -s FETCH=1 -s USE_GLFW=3 -s VERBOSE=1 -s USE_LIBJPEG=1 -s USE_LIBPNG=1 -s USE_ZLIB=1 -s USE_FREETYPE=1 -O3 -DNDEBUG -lidbfs.js -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s INITIAL_MEMORY=512MB --shell-file E:/MyGame/index.html --use-preload-cache --preload-file E:/MyGame/res/@/res --preload-file E:/MyGame/src/@/src -sEXPORTED_FUNCTIONS=[_cocos_ccdirector_pause,_cocos_ccdirector_resume,_cocos_ccdirector_step,_cocos_ccnode_select,_main] -sEXPORTED_RUNTIME_METHODS=[ccall,cwrap] CMakeFiles/MyGame.dir/frameworks/runtime-src/Classes/AppDelegate.cpp.o CMakeFiles/MyGame.dir/frameworks/runtime-src/proj.emscripten/main.cpp.o -o bin\MyGame\MyGame.html lib/libluacocos2d.a lib/libcocos2d.a lib/libexternal.a ../frameworks/cocos2d-x/external/Box2D/prebuilt/emscripten/libbox2d.a ../frameworks/cocos2d-x/external/chipmunk/prebuilt/emscripten/libchipmunk.a lib/libext_recast.a ../frameworks/cocos2d-x/external/bullet/prebuilt/emscripten/libLinearMath.a ../frameworks/cocos2d-x/external/bullet/prebuilt/emscripten/libBulletDynamics.a ../frameworks/cocos2d-x/external/bullet/prebuilt/emscripten/libBulletCollision.a ../frameworks/cocos2d-x/external/bullet/prebuilt/emscripten/libLinearMath.a ../frameworks/cocos2d-x/external/bullet/prebuilt/emscripten/libBulletMultiThreaded.a ../frameworks/cocos2d-x/external/bullet/prebuilt/emscripten/libMiniCL.a lib/libext_tinyxml2.a lib/libext_xxhash.a lib/libext_xxtea.a lib/libext_clipper.a lib/libext_edtaa3func.a lib/libext_convertUTF.a lib/libext_poly2tri.a lib/libext_md5.a lib/libext_unzip.a ../frameworks/cocos2d-x/external/lua/luajit/prebuilt/emscripten/liblua.a lib/libext_tolua.a lib/libext_luasocket.a && cd ." em++: error: 'E:/emsdk/upstream/bin\wasm-ld.exe -o bin\MyGame\MyGame.wasm CMakeFiles/MyGame.dir/frameworks/runtime-src/Classes/AppDelegate.cpp.o CMakeFiles/MyGame.dir/frameworks/runtime-src/proj.emscripten/main.cpp.o lib/libluacocos2d.a lib/libcocos2d.a lib/libexternal.a ../frameworks/cocos2d-x/external/Box2D/prebuilt/emscripten/libbox2d.a ../frameworks/cocos2d-x/external/chipmunk/prebuilt/emscripten/libchipmunk.a lib/libext_recast.a ../frameworks/cocos2d-x/external/bullet/prebuilt/emscripten/libLinearMath.a ../frameworks/cocos2d-x/external/bullet/prebuilt/emscripten/libBulletDynamics.a ../frameworks/cocos2d-x/external/bullet/prebuilt/emscripten/libBulletCollision.a ../frameworks/cocos2d-x/external/bullet/prebuilt/emscripten/libLinearMath.a ../frameworks/cocos2d-x/external/bullet/prebuilt/emscripten/libBulletMultiThreaded.a ../frameworks/cocos2d-x/external/bullet/prebuilt/emscripten/libMiniCL.a lib/libext_tinyxml2.a lib/libext_xxhash.a lib/libext_xxtea.a lib/libext_clipper.a lib/libext_edtaa3func.a lib/libext_convertUTF.a lib/libext_poly2tri.a lib/libext_md5.a lib/libext_unzip.a ../frameworks/cocos2d-x/external/lua/luajit/prebuilt/emscripten/liblua.a lib/libext_tolua.a lib/libext_luasocket.a -LE:\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten E:\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libfreetype.a E:\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libpng.a E:\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libjpeg.a E:\emsume --export-if-defined=cocos_ccdirector_step --export-if-defined=cocos_ccnode_select --export-if-defined=main --export-if-defined=_emscripten_thread_init --export-if-defined=_emscripten_thread_exit --export-if-defined=_emscripten_thread_crashed --export-if-defined=emscripten_tls_init --export-if-defined=pthread_self --export-if-defined=start_em_asm --export-if-defined=st-export=memcpy --export=saveSetjmp --export=setThrew --export=htonl --export-table -z stack-size=5242880 --initial-memory=536870912 --no-entry --max-memory=536870912 --global-base=1024' failed (returned 1)

IronnMan commented 2 years ago

You can try to install emsdk 3.1.0 version

./emsdk install 3.1.0
WuJiayiSH commented 2 years ago

like suggested, give a try to some older emsdk

or, remove "-s USE_PTHREADS" from CMakeLists.txt in your project root if you want to start quickly, I mostly work without pthread

emsdk is evolving fast and I might not be able to catch up with the latest. It's not a bad idea to stick to some fixed version.