Latest emscripten doesnt work on examples

@stephanschulz Did you also delete the emscripten folder of the guiExample? Normally the changes should take effect if it runs at all. Regarding your own example: Is it possible that you use some addons or functions that are not compatible with Emscripten? There seems something wrong with a .txt file…

@Jona thanks for pointing this out. I only now notice that running emmake creates a folder called obj with an Emscripten folder inside.

@Theo as mentioned earlier I am now able to compile and run guiExample. BUT as soon as I add gui.loadFromFile(“settings.xml”); to setup() the app will not run successfully in the browser. I guess Emscripten apps do not like loading and writing to disk?

@stephanschulz I think you can not read files from disk easily/the used way with Emscripten.
But you can read files that are in the Data folder of the Emscripten project.
This could be a start for reading files from disk, I do not understand it by myself:
and here @kokawa2003 managed to save an image to disk with Emscripten: I want to save image

settings.xml is in my data folder.
and usually calling

retrieves this xml file from the data folder. but maybe with Emscripten I need to change the file path?

@stephanschulz Then it is something else. I do not think that you need to change the file path.

files in data are packed in a special format and served as a file system emulation when you use emmake make run so it should work. if you compile the aplication in debug you should get a proper stack trace when the app crashes which will give you a clue of what might be going on.

I tried to emmake make Debug and got this result, both using gui.loadFromFile("settings.xml"); and without this line.
Debug make:

in order to do a sanity check I called emmake make on the same project in the same terminal window.
Without gui.loadFromFile("settings.xml"); the example runs in the browser.
But with gui.loadFromFile("settings.xml"); I get this error again:
Normale Make:

@Jona and anyone else on non macOS builds.
Does this work for you for 0.11.0?

git clone
cd emsdk
./emsdk install latest-fastcomp
./emsdk activate latest-fastcomp
source ./

Followed by:

  • Deleting the contents of libs/openFrameworksCompiled/lib/emscripten/
  • emmake make clean in the example folder you want to test
  • emmake make in the example folder
  • emrun bin/myExample.html

I did not test latest-fastcomp yet. What is the advantage of it?
But the install steps from above:

git clone
cd emsdk
./emsdk install sdk-incoming-64bit binaryen-master-64bit
./emsdk activate sdk-incoming-64bit binaryen-master-64bit
source ./

Do also work with Open Frameworks 0.11.0 and Ubuntu 18.04.

Thanks @Jona

It is mostly because I think sdk-incoming-64bit is a bit less stable than latest.
So I was trying to find something that could work and wouldn’t be as unstable.

The other advantage of latest-fastcomp is it is precompiled, so it saves about 30 mins of compiling that sdk-incoming-64bit needs to do ( at least on macOS ).

I think I am going to make the latest-fastcomp be the default, and mention install sdk-incoming-64bit as an option if people have any issues.

Btw, on macOS I only needed:

./emsdk install sdk-incoming-64bit 
./emsdk activate sdk-incoming-64bit 

@theo I can confirm that:

git clone
cd emsdk
./emsdk install latest-fastcomp
./emsdk activate latest-fastcomp
source ./

Is working with Open Frameworks 0.11.0 and Ubuntu 18.04. And it is much faster to install.
But I get these warnings, that I think I did not get before:

/home/jonathan/Schreibtisch/of_v20191206_linux64gcc6_release/addons/ofxEmscripten/src/ofxAppEmscriptenWindow.cpp:260:2: warning: 
      'emscripten_set_canvas_size' is deprecated: This variant does not allow
      specifying the target canvas [-Wdeprecated-declarations]
        Use emscripten_set_canvas_element_size() instead
/home/jonathan/emsdk/fastcomp/emscripten/system/include/emscripten/emscripten.h:139:71: note: 
      'emscripten_set_canvas_size' has been explicitly marked deprecated here
void emscripten_set_canvas_size(int width, int height) __attribute__((depreca...
/home/jonathan/Schreibtisch/of_v20191206_linux64gcc6_release/addons/ofxEmscripten/src/ofxAppEmscriptenWindow.cpp:274:2: warning: 
      'emscripten_get_canvas_size' is deprecated: This variant does not allow
      specifying the target canvas [-Wdeprecated-declarations]
  ...emscripten_get_canvas_size( &width, &height, &isFullscreen );
     Use emscripten_get_canvas_element_size() and emscripten_get_fullscreen_status() instead
/home/jonathan/emsdk/fastcomp/emscripten/system/include/emscripten/emscripten.h:140:92: note: 
      'emscripten_get_canvas_size' has been explicitly marked deprecated here
  ...*width, int *height, int *isFullscreen) __attribute__((deprecated("This ...
2 warnings generated.

Those functions seem to be deprecated since Emscripten 1.37.20 (the current version is 1.39.3):

Thanks @Jona
Should be easy to fix those deprecations - I’ll add it to 0.11.1

1 Like


I manage to build 3DPrimitivesExample within an ubuntu docker container on Windows 10 Pro host with latest Docker Desktop.

I have done the following steps:

Start Ubuntu Docker

docker run -ti ubuntu

uname -a in container gives:
Linux d45c73dd3911 4.9.184-linuxkit #1 SMP Tue Jul 2 22:58:16 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Inside container, Install needed packages

apt isntall dev-essential
apt install cmake
apt install python
apt install wget

Setup emdsk

git clone
cd emsdk
./emsdk install latest-fastcomp
./emsdk activate latest-fastcomp
source ./

Install OF and build example

tar -xvzf of_v0.11.0_linux64gcc6_release.tar.gz
cd of_v0.11.0_linux64gcc6_release/examples/3d/3DPrilitivesExample
./emmake make

Then I copy the result back to the host from an other shell:

docker cp <container_name>:/home/dev/of_v0.11.0_linux64gcc6_release/examples/3d/3DPrimitivesExample/bin .

Then I load the html file in Firefox, after having disable the CORS security see this article. This allow browser to load local files (security issue).

And here the results, looks like bellow, some faces are “transparents”.

Now I plane to build a project from scratch. And then figure out how to develop in Windows and build in docker or linux.

Thank’s for all work done on OF !


Thanks for checking!

The depth issue you mentioned will be fixed in 0.11.1.

You can see a fix for it here though:



I’ll also would like to try using WSL and Visual Studio capacity to use make files.
Because emsdk need make files to compile.

Yes, I’d also like to use emscripten with my Visual Studio built oF projects.

I can confirm that I’ve successfully installed the Linux version of emscripten in the WSL. With it I was able to start an emmake build for one of the example sketches from the Linux distribution of openFrameworks. (Linux oF sketches include Makefiles for their own build process.)

The build process ran well for a few minutes, but then wasm-ld failed due to machine type must be wasm32 errors.

The newest version 1.39.4 does not seem to work with ubuntu for me.
So I use

git clone
cd emsdk
./emsdk install 1.39.3-fastcomp
./emsdk activate 1.39.3-fastcomp
source ./


git clone
cd emsdk
./emsdk install latest-fastcomp
./emsdk activate latest-fastcomp
source ./

works again but i had to change
Here is the edited file:

can you send a pull request with the changes?

@arturo I will , hope my changes do not break anything that was working before :wink:
But so far it seems to work fine.

Could that mean that I could use DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 if the Emscripten .html template gets updated according to the changelog?

From the Emscripten Changelog 1.39.5:

    With this change the old deprecated HTML5 API event target lookup behavior is
    disabled. There is no “Module.canvas” object, no magic “null” default handling,
    and DOM element ‘target’ parameters are taken to refer to CSS selectors, instead
    of referring to DOM IDs. For more information see:!msg/emscripten-discuss/xScZ_LRIByk/_gEy67utDgAJ