The problem here is the call to glutExtensionSupported("GL_EXT_abgr"). The
glut functions aren't part of OpenGL, but of the GLUT framework. Emscripten
emulates most GLUT calls, but it looks like glutExtensionSupported() isn't
among the emulated functions. And even if it would be there, WebGL doesn't
have the GL_EXT_abgr extension. So the demo you picked isn't very portable,
and wouldn't run on WebGL anyway.
It is actually not that easy to find a GL demo that simply compiles in
emscripten, you should start with a simple hello-world, and explore more
complex things from there, e.g. this is what I do on OSX to find out
whether an emscripten installation is working:
> cat >hello.c
#include <stdio.h>
int main() {
printf("Hello World!\n");
}
[Ctrl-C]
> emcc hello.c hello.html
> ls
hello.c hello.html hello.js
> open hello.html
...the last command should open the default web-browser with the emscripten
shell page and a "Hello World!" in a HTML text field.
-Floh,
Am Freitag, 22. April 2016 14:24:38 UTC+2 schrieb Shyamal Chandra:
>
> Hi Floh and others,
>
> Thanks for your advice in the previous email!
>
> I brew uninstall emscripten, installed and activated emsdk, and then I
> ran the emsdk with the source ./emsdk_env.sh and then I got the following
> C code from the examples for OpenGL...
>
>
> https://www.opengl.org/archives/resources/code/samples/glut_examples/examples/abgr.c
>
> and this is the error I got after emcc abgr.c -o abgr.html and opening
> the abgr.html file generated using Emscripten...
>
> abgr.html:1249 missing function: glutExtensionSupportedModule.printErr @
> abgr.html:1249
> abgr.html:1237 -1
>
> Uncaught abort(-1) at Error
> at jsStackTrace
> (file:///Users/iMe2/turingbrain/emscripten/abgr.js:1173:13)
> at stackTrace
> (file:///Users/iMe2/turingbrain/emscripten/abgr.js:1190:22)
> at abort (file:///Users/iMe2/turingbrain/emscripten/abgr.js:14356:44)
> at _glutExtensionSupported
> (file:///Users/iMe2/turingbrain/emscripten/abgr.js:6353:67)
> at _main (file:///Users/iMe2/turingbrain/emscripten/abgr.js:6673:9)
> at Object.asm._main
> (file:///Users/iMe2/turingbrain/emscripten/abgr.js:14107:19)
> at Object.callMain
> (file:///Users/iMe2/turingbrain/emscripten/abgr.js:14221:30)
> at doRun (file:///Users/iMe2/turingbrain/emscripten/abgr.js:14279:60)
> at file:///Users/iMe2/turingbrain/emscripten/abgr.js:14290:7
>
> What should I do to fix this problem? Does Emscripten fully support
> OpenGL and what flavors?
>
> Thanks!
>
> Shyamal Chandra
> [email protected] <javascript:>
>
>
> On Fri, Apr 22, 2016 at 6:14 AM, Floh <[email protected] <javascript:>>
> wrote:
>
>> It looks like you're still running the emscripten version that was
>> installed by brew:
>>
>>
>>
>> *File "/usr/local/Cellar/emscripten/1.35.23/libexec/emscripten.py", line
>> 259, in ...*That path /usr/local/Cellar/... is a brew thing. You should
>> really make sure that there is no trace of the previously installed
>> emscripten version left on your system.
>>
>> Cheers,
>> -Floh.
>>
>> Am Freitag, 22. April 2016 12:36:29 UTC+2 schrieb Shyamal Chandra:
>>>
>>> Hi Floh and others,
>>>
>>> First of all, thanks for the solution to the previous problem.
>>>
>>> I fixed that previous problem by downloading the Emscripten SDK and
>>> installing and activating it. However, now I have another problem. When I
>>> run with the -o flag (output below) and have an html file as its argument,
>>> it has a problem. What should I do?
>>>
>>> From the help file, it says the following:
>>>
>>> *"-o <target>"*
>>>
>>> * The "target" file name extension defines the output type to be*
>>>
>>> * generated:*
>>>
>>>
>>> * * <name> **.js** : JavaScript.*
>>>
>>>
>>> * * <name> **.html** : HTML + separate JavaScript file*
>>>
>>> * (**<name>.js**). Having the separate JavaScript file improves*
>>>
>>> * page load time.*
>>>
>>>
>>> * * <name> **.bc** : LLVM bitcode (default).*
>>>
>>>
>>> * * <name> **.o** : LLVM bitcode (same as .bc).*
>>>
>>>
>>> * Note: If "--memory-init-file" is used, a **.mem** file will be*
>>>
>>> * created in addition to the generated **.js** and/or **.html***
>>>
>>> * file.*
>>>
>>> Please let me know your diagnosis and solution to this problem.
>>>
>>> Thanks in advance!
>>>
>>> Shyamal Chandra
>>>
>>> [email protected]
>>>
>>> Output below:
>>>
>>> *iMe2 (master *) emscripten $ em++ main.cpp -o main.html*
>>>
>>> *Traceback (most recent call last):*
>>>
>>> * File "/usr/local/Cellar/emscripten/1.35.23/libexec/emcc", line 13, in
>>> <module>*
>>>
>>> * emcc.run()*
>>>
>>> * File "/usr/local/Cellar/emscripten/1.35.23/libexec/emcc.py", line
>>> 1379, in run*
>>>
>>> * final = shared.Building.emscripten(final, append_ext=False,
>>> extra_args=extra_args)*
>>>
>>> * File "/usr/local/Cellar/emscripten/1.35.23/libexec/tools/shared.py",
>>> line 1588, in emscripten*
>>>
>>> * call_emscripten(cmdline)*
>>>
>>> * File "/usr/local/Cellar/emscripten/1.35.23/libexec/emscripten.py",
>>> line 1657, in _main*
>>>
>>> * temp_files.run_and_clean(lambda: main(*
>>>
>>> * File
>>> "/usr/local/Cellar/emscripten/1.35.23/libexec/tools/tempfiles.py", line 64,
>>> in run_and_clean*
>>>
>>> * return func()*
>>>
>>> * File "/usr/local/Cellar/emscripten/1.35.23/libexec/emscripten.py",
>>> line 1663, in <lambda>*
>>>
>>> * DEBUG_CACHE=DEBUG_CACHE,*
>>>
>>> * File "/usr/local/Cellar/emscripten/1.35.23/libexec/emscripten.py",
>>> line 1560, in main*
>>>
>>> * temp_files=temp_files, DEBUG=DEBUG, DEBUG_CACHE=DEBUG_CACHE)*
>>>
>>> * File "/usr/local/Cellar/emscripten/1.35.23/libexec/emscripten.py",
>>> line 259, in emscript*
>>>
>>> * staticbump = metadata['staticBump']*
>>>
>>> *KeyError: 'staticBump'*
>>>
>>> *FAIL: Running the generated program failed!*
>>>
>>> On Fri, Apr 22, 2016 at 5:00 AM, Floh <[email protected]> wrote:
>>>
>>>> Looks like emscripten is picking up the wrong C/C++ compiler instead of
>>>> emscripten's own version.
>>>>
>>>> The error message gives a hint what to do ('check the paths in
>>>> |/.emscripten'):
>>>>
>>>> *CRITICAL:root:Cannot find /usr/local/bin/clang++, check the paths in
>>>> ~/.emscripten*
>>>>
>>>>
>>>> But it's probably better to restart from scratch, remove all traces of
>>>> your current emscripten install and go with a proper SDK installation as
>>>> described here:
>>>>
>>>>
>>>> https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html
>>>>
>>>> I'm not sure how up-to-date and maintained the brew emscripten SDK is.
>>>>
>>>> Cheers,
>>>> -Floh.
>>>>
>>>>
>>>> Am Freitag, 22. April 2016 02:25:26 UTC+2 schrieb Shyamal Chandra:
>>>>
>>>>> Hi,
>>>>>
>>>>> I am getting the following when I run em++ main.cpp with my Emscripten
>>>>> code:
>>>>>
>>>>> *iMe2 (master *) emscripten $ em++ main.cpp*
>>>>>
>>>>> *WARNING:root:Could not verify LLVM version: [Errno 2] No such file or
>>>>> directory*
>>>>>
>>>>> *CRITICAL:root:fastcomp in use, but LLVM has not been built with the
>>>>> JavaScript backend as a target, llc reports:*
>>>>>
>>>>>
>>>>> *===========================================================================*
>>>>>
>>>>> *LLVM (http://llvm.org/ <http://llvm.org/>):*
>>>>>
>>>>> * LLVM version 3.7.0svn*
>>>>>
>>>>> * DEBUG build with assertions.*
>>>>>
>>>>> * Built Mar 9 2015 (16:06:44).*
>>>>>
>>>>> * Default target: x86_64-apple-darwin15.5.0*
>>>>>
>>>>> * Host CPU: core-avx2*
>>>>>
>>>>>
>>>>> * Registered Targets:*
>>>>>
>>>>> * aarch64 - AArch64 (little endian)*
>>>>>
>>>>> * aarch64_be - AArch64 (big endian)*
>>>>>
>>>>> * amdgcn - AMD GCN GPUs*
>>>>>
>>>>> * arm - ARM*
>>>>>
>>>>> * arm64 - ARM64 (little endian)*
>>>>>
>>>>> * armeb - ARM (big endian)*
>>>>>
>>>>> * cpp - C++ backend*
>>>>>
>>>>> * hexagon - Hexagon*
>>>>>
>>>>> * mips - Mips*
>>>>>
>>>>> * mips64 - Mips64 [experimental]*
>>>>>
>>>>> * mips64el - Mips64el [experimental]*
>>>>>
>>>>> * mipsel - Mipsel*
>>>>>
>>>>> * msp430 - MSP430 [experimental]*
>>>>>
>>>>> * nvptx - NVIDIA PTX 32-bit*
>>>>>
>>>>> * nvptx64 - NVIDIA PTX 64-bit*
>>>>>
>>>>> * ppc32 - PowerPC 32*
>>>>>
>>>>> * ppc64 - PowerPC 64*
>>>>>
>>>>> * ppc64le - PowerPC 64 LE*
>>>>>
>>>>> * r600 - AMD GPUs HD2XXX-HD6XXX*
>>>>>
>>>>> * sparc - Sparc*
>>>>>
>>>>> * sparcv9 - Sparc V9*
>>>>>
>>>>> * systemz - SystemZ*
>>>>>
>>>>> * thumb - Thumb*
>>>>>
>>>>> * thumbeb - Thumb (big endian)*
>>>>>
>>>>> * x86 - 32-bit X86: Pentium-Pro and above*
>>>>>
>>>>> * x86-64 - 64-bit X86: EM64T and AMD64*
>>>>>
>>>>> * xcore - XCore*
>>>>>
>>>>>
>>>>> *===========================================================================*
>>>>>
>>>>> *CRITICAL:root:you can fall back to the older (pre-fastcomp) compiler
>>>>> core, although that is not recommended, see
>>>>> http://kripken.github.io/emscripten-site/docs/building_from_source/LLVM-Backend.html
>>>>>
>>>>> <http://kripken.github.io/emscripten-site/docs/building_from_source/LLVM-Backend.html>*
>>>>>
>>>>> *INFO:root:(Emscripten: Running sanity checks)*
>>>>>
>>>>> *CRITICAL:root:Cannot find /usr/local/bin/clang++, check the paths in
>>>>> ~/.emscripten*
>>>>>
>>>>>
>>>>> How can I solve the problem? I install Emscripten through homebrew
>>>>> for OSX 10.11 but somehow, em++ is having issues. What to do?
>>>>>
>>>>>
>>>>> Thanks in advance!
>>>>>
>>>>>
>>>>> Sincerely,
>>>>>
>>>>>
>>>>> Shyamal Chandra
>>>>>
>>>>> [email protected]
>>>>>
>>>> --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "emscripten-discuss" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/emscripten-discuss/PSOiynPIgs8/unsubscribe
>>>> .
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "emscripten-discuss" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/emscripten-discuss/PSOiynPIgs8/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.