New issue
 Projects > cocos2d-x > Issues > Bug #4567

Emscripten build C++ project crash in browser

Bug #4567 [New]
lord_of_darkness 2014-03-26 11:17 . Updated almost 10 years ago

Hi. I have a little problem, the solution of which I can not find in the network.

I installed emstsripten according to instructions . All Cpp projects was compiled successfully. But there is a problem that all test projects works only in Firefox browser. In other browsers, a black screen appears with errors or freezes in step "Downloading data". Errors as follows:

cocos2d-x debug info OpenGl error 0x0502 in ../shaders/CCShaderCache.cpp loaddefaultShader 311
cocos2d-x debug info OpenGl error 0x0502 in ../textures/CCTextureAtlas.cpp mapBuffers 306
cocos2d-x debug info OpenGl error 0x0502 in ../CCDirector.cpp setAlphaBlending 482

This error appears for plain HelloCpp project without any textures load, I commented all code for loading textures to CCSprite, button and labels on scene.

What you think about this? I suppose it related to loading textures and shaders from cache.

zhangxm 2014-03-27 02:37

Emscripten is developed and maintained by Mozilla, so Firefox supports it well is not strange. We will support it in v3.1, then we will checkout if it is possible to resolve it.

lord_of_darkness 2014-03-28 08:52

Hi, I just found why it heppen. Mozilla use their own renderer, but Chrome and Opera use WebKit WebGl. So in cocos2d-x library you try to fill each shader with all parameters(even if they don`t use) and Mozilla does not optimaze shaders code. When they try to get parameter by glGetUniformLocation() it return mistake(because a lot of variables optimazed and disappear).

lord_of_darkness 2014-04-01 17:02

Hi, I have a small question: are you try to load with emscripten .ccbi-files?
I have a strange error on linking my project with emscripten:
/clang+llvm-3.2-x86_64-apple-darwin11/bin/llvm-link: link error in '/tmp/tmpgVPjJ1/': Linking globals named 'deflate_copyright': symbol multiply defined!
Traceback (most recent call last):
File "/external/emscripten/emcc", line 1365, in <module>, in_temp(target_basename + '.bc'))
File "/external/emscripten/tools/", line 965, in link
assert os.path.exists(target) and (output is None or 'Could not open input file' not in output), 'Linking error: ' + output
AssertionError: Linking error

zhangxm 2014-04-02 05:57

We will support Emscripten in v3.1, and master is left for critical bugs fixed.

Atom PDF

Start date:2014-03-26
Due date:
% Done:


Target version:-