"Exception thrown" after loading emscripten html (compiling ok)

508 views
Skip to first unread message

thp...@googlemail.com

unread,
Apr 2, 2016, 5:59:25 AM4/2/16
to emscripten-discuss
Hello,

I am new to emscripten and excited about the capabilities seen so far.

I have successfully compiled the hello world example from the tutorial, which ran well in FF (> v38).

I have proceeded to my own code (C++), which uses SDL2 and runs without errors as standalone executable.

I have compiled this using em++, including the "-s USE_SDL2=1" both during compilation and linking.

When I call this in the browser, I get the "Downloading" and "Running" phase shortly displaying, then "Exception thrown, see JavaScript console".

The console only shows "5". What does this mean?

Further questions:

Who is writing the console output? Is it browser code or is it emscripten (js?) code?

Can I increase the verboseness of the output? (Probably "set EMCC_DEBUG=1" I see.)

Is there a list of error codes? I googled, but no success.


~Tom



thp...@googlemail.com

unread,
Apr 2, 2016, 6:07:33 AM4/2/16
to emscripten-discuss

Can I increase the verboseness of the output? (Probably "set EMCC_DEBUG=1" I see.)




I tested the compilation with the EMCC_DEBUG=1. Unfortunately the console output does not show more than the "5".

~Tom

Christopher Forgeron

unread,
Apr 4, 2016, 10:27:13 AM4/4/16
to emscripten-discuss
I don't think '5' means anything - You'll have to step through your code with the Javascript debugger in your browser to find out.

Interestingly, I was getting a similar situation where it printed '1973' and nothing else, and as far as I could tell, it wasn't in my C code - That was early in my debugging setup, so I can't point to any direct path to resolve it.

Alon Zakai

unread,
Apr 4, 2016, 1:39:20 PM4/4/16
to emscripten-discuss
EMCC_DEBUG adds compiler logging. For more runtime logging and debugging, see http://kripken.github.io/emscripten-site/docs/porting/Debugging.html#debugging-compilation-settings


--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alon Zakai

unread,
Apr 4, 2016, 1:41:13 PM4/4/16
to emscripten-discuss
Also, the thrown '5' should have a stack trace that you can view in the JS console. Might be easiest in the debugger as Christopher suggested, but depending on the browser, the stack trace should be available in the plain console too.

Charles Vaughn

unread,
Apr 4, 2016, 2:08:16 PM4/4/16
to emscripten-discuss
I've seen cases with short numeric message exceptions when I fail to update my .mem file.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.

Christopher Forgeron

unread,
Apr 4, 2016, 5:59:47 PM4/4/16
to emscripten-discuss
Just ran in to my '1945' error - For me, it's when I have EMULATE_FUNCTION_POINTER_CASTS not set to 1, in a project that needs it.

Looking in the JS Console, you'll see the real error, but if you just look at the browser, you end up with just a number. 

thp...@googlemail.com

unread,
Apr 5, 2016, 8:08:09 AM4/5/16
to emscripten-discuss
This is yet unsolved, but need to be suspended. EMCC_DEBUG did not produce results at my place. ~Tom

thp...@googlemail.com

unread,
Apr 10, 2016, 3:40:49 PM4/10/16
to emscripten-discuss


On Tuesday, April 5, 2016 at 2:08:09 PM UTC+2, thp...@googlemail.com wrote:
This is yet unsolved, but need to be suspended. EMCC_DEBUG did not produce results at my place. ~Tom

So, continuing this, indeed there is a JS console output after using EMCC_DEBUG=1. It reads

I: SDL_CreateWindow() successful." test_emscripten1.html:1237:12
Error: WebGL: Refused to create ANGLE OpenGL context because of blacklisting. test_emscripten1.js:1:61165
Error: WebGL: Refused to create native OpenGL context because of blacklisting. test_emscripten1.js:1:61165
Error: WebGL: WebGL creation failed. test_emscripten1.js:1:61165
Error: WebGL: Refused to create ANGLE OpenGL context because of blacklisting. test_emscripten1.js:1:61216
Error: WebGL: Refused to create native OpenGL context because of blacklisting. test_emscripten1.js:1:61216
Error: WebGL: WebGL creation failed. test_emscripten1.js:1:61216
"Could not create canvas: ?,:(,{"antialias":true,"alpha":false,"depth":true,"stencil":true,"majorVersion":1,"minorVersion":0}" test_emscripten1.html:1237:12
E: SDL_CreateRenderer Error: Couldn't find matching render driver" test_emscripten1.html:1237:12

The first and last line are my own "std::cout" output (also sent to console). So clearly SDL_CreateRenderer failed, and this because some ANGLE OpenGL context could not be created because of blacklisting.

Some googling showed that happens in FF due to deliberate deactivating older graphics drivers.


Checking the version number (Device Manager), everything looked fine. But then, using "about:support", in the "Graphics" section

"Direct2D Enabled Blocked for your graphics driver version. Try updating your graphics driver to version Nvidia driver > 8.17.12.6901 or newer. 
WebGL Renderer Blocked for your graphics driver version. Try updating your graphics driver to version Nvidia driver > 8.17.12.6901 or newer."

while available 8.17.12.6754.

...

thp...@googlemail.com

unread,
Apr 20, 2016, 5:51:59 PM4/20/16
to emscripten-discuss
The dependency on a newer graphics driver version may be overriden by about:config -> webgl.force-enable


juj j

unread,
Apr 24, 2016, 4:23:50 AM4/24/16
to emscripte...@googlegroups.com
Sounds like this was a graphics driver issue. Though to second Alon's voice, the thrown exceptions that are just numbers generally come from C++ throw statements inside asm.js code. Build with -O0, or with -g2, --profiling or --profiling-funcs to get the browser report a good callstack, and check the stack trace of the exception message.

Sometimes I have noticed that the trace presented in the exception message is not very good, and it refers to a catch() {} block that has captured the exception and e.g. rethrown or printed it. In that case, I generally just comment out that try {} catch{} to let the exception raise up to browser completely uncaught, which does seem to give better callstacks to point out exactly where the throw statement occurred.

2016-04-21 0:51 GMT+03:00 thp069 via emscripten-discuss <emscripte...@googlegroups.com>:
The dependency on a newer graphics driver version may be overriden by about:config -> webgl.force-enable


--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages