I also experienced this same problem, using ubuntu 18.10.
This comment by jariseon indicated that a change occurred with emscripten 1.38.10. So the latest version to use that solves this problem is 1.38.9.
The instructions (or script) posted by @hamoid above allow you to change the version of emscripten tool chain being used. Remember to open a new terminal window after changing the tool chain so the new paths are in effect. But the vital step is to remove the old openFrameworks emscripten library object files before attempting to re-compile. If you do not do this step, then you are still using some binaries compiled with your previous version of emscripten.
cd ./libs/openFrameworksCompiled/lib/emscripten
rm -r *
So my working configuration is:
Ubuntu 18.10
openFrameworks (installed from github, on branch patch-release)
Yes, that worked! I had to do a bit of trial and error though and I realized that I already had another installation of emscripten from brew, so I uninstalled it and then followed @hamoid’s example and it worked fine
@theo @stephanschulz, you should also setup a local server on bin folder in order to run the .html file. A basic server is OK. I’m using https://github.com/http-party/http-server
Or you can directly upload the files to your own hosting service…
hey @stephanschulz,
I am having the same problem.
I tried setting the http-server too, but it fails in the same way.
I am in High Sierra and OF GitHub branch.
I didn’t know how to setup this (from OF website):
(Maybe this can be the problem…)So I need to run source ./emsdk_env.sh every time…
type source ./emsdk_env.sh to set the system path to the active version of Emscripten. You can copy the output of this command and add it to your .profile file, in order to save this variables also for the next sessions.
I open a terminal: cd /Users/myUser/Documents/emsdk
then I run: source ./emsdk_env.sh
run: cd /Users/myUser/Documents/openFrameworks/examples/gui
create project with PG with emscripten template.
run: emmake make emrun --browser chrome bin/guiExample.html
so, @stephanschulz, you can try this way.
it’s working here fine. The local http server setup was not required when you run the app with emrun --browser chrome bin/advanced3dExample.html
because it seems ‘it runs his own server’
EDIT:
I noticed that when running the emscripten/download_libs.sh, macOS building stops working, so we can’t share the OF folder to both buildings.
QUESTIONS
how can we add the profile to the system to avoid running source ‘./emsdk_env.sh’ every session?
there’s any way to made it run in Safari? What are the main limitations of Emscripten vs native app?
then cd to:
/Applications/of_v20191201_osx_release/examples/gui/guiExample
then:
emmake make
and get this error:
shared:ERROR: fastcomp is not compatible with wasm object files:obj/emscripten/Release/src/ofApp.o
make[1]: *** [bin/guiExample.html] Error 1
make: *** [Release] Error 2
FYI my nightly build of_v20191201_osx_release does not have download_libs.sh:
Regarding your second question: ofxMidi, ofxOsc, ofSystemLoadDialog and some of the input_output examples do not work with Emscripten… but there are some workarounds: https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html exchanging integers / floats between open frameworks and java script is quite easy, but replacing something like ofSystemLoadDialog seems a bit complicated, at least for me. Another limitation is that you need to use GL ES instead of GL SL if you want to use shaders.
Thats what I found so far…