Latest emscripten doesnt work on examples

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)
  • clang-e1.38.9-64bit
  • node-8.9.1-64bit
  • emscripten-1.38.9
  • sdk-1.38.9-64bit
3 Likes

I’m having the same issue with the latest version of Emscripten + OF masters.

Can anyone confirm this?

1 Like

Yes, tried it today and got the missing function: _ZnwjRKSt9nothrow_t error

Did you try the steps listed here @cjniven?

It might be helpful to also try the nightly build from the bottom of: https://openframeworks.cc/download/

with emscripten 1.38.9

2 Likes

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 :slight_smile:

version 1.38.9 worked for me also. My setup order is as follows;

./emsdk install emscripten-1.38.9
./emsdk install sdk-1.38.9-64bit
./emsdk install binaryen-tag-1.38.9-64bit
./emsdk install clang-e1.38.9-64bit

./emsdk activate emscripten-1.38.9
./emsdk activate sdk-1.38.9-64bit
./emsdk activate binaryen-tag-1.38.9-64bit
./emsdk activate clang-e1.38.9-64bit

source emsdk_env.sh
1 Like

Thanks @alp - I opened an issue for it for updating the setup guide:

for me also 1.39.2 does work on ubuntu 18.04 with these setup steps:

git clone https://github.com/juj/emsdk.git
cd emsdk
./emsdk install sdk-incoming-64bit binaryen-master-64bit
./emsdk activate sdk-incoming-64bit binaryen-master-64bit
source ./emsdk_env.sh

following @alp instructions enables a successful compile.
but running the guiExample does not work in the browser.

https://gist.github.com/stephanschulz/2e9d46693e71d36a11369641e4401239

@theo :+1:
@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…

Thanks for the reply.

I tried your second suggestions since I am not yet quite sure how to follow the server setup instruction.

Uploading the two projects I tested produces the same results on my hosting service server.
http://stephanschulz.ca/TypeAct/gui/guiExample.html
http://stephanschulz.ca/TypeAct/bin/TypeAct.html

Here is the guiExample project:

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.

  1. I open a terminal:
    cd /Users/myUser/Documents/emsdk
  2. then I run:
    source ./emsdk_env.sh
  3. run:
    cd /Users/myUser/Documents/openFrameworks/examples/gui
  4. create project with PG with emscripten template.
  5. run:
    emmake make emrun --browser chrome bin/guiExample.html

I used the same @alp guide.

These steps worked for me on macOS 10.14
It took forever to build emsdk but once it was done.

I could build examples with:
emmake make
emrun --browser chrome bin/3DPrimitivesExample.html

Worked beautifully.
I’ll update the setup guide accordingly ( the git url now points to https://github.com/emscripten-core/emsdk )

Note: Might be good to remove old installs of emsdk and any .emscripten files in your home folder before installing/building emsdk as above.

Thanks @theo,
but I followed your steps here in 10.13 but do not worked. Getting this final error when compiling an example:

error: undefined symbol: _ZN5boost10filesystem4path25m_path_iterator_incrementERNS1_8iteratorE
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: _ZN5boost10filesystem4pathdVEPKc
error: undefined symbol: _ZN5boost10filesystem4pathdVERKS1_
error: undefined symbol: _ZN5boost10filesystem6detail12current_pathEPNS_6system10error_codeE
error: undefined symbol: _ZN5boost10filesystem6detail16create_directoryERKNS0_4pathEPNS_6system10error_codeE
error: undefined symbol: _ZN5boost10filesystem6detail18create_directoriesERKNS0_4pathEPNS_6system10error_codeE
error: undefined symbol: 

_ZN5boost10filesystem6detail6statusERKNS0_4pathEPNS_6system10error_codeE
error: undefined symbol: _ZN5boost10filesystem6detail9canonicalERKNS0_4pathES4_PNS_6system10error_codeE
error: undefined symbol: _ZN5boost10filesystem8absoluteERKNS0_4pathES3_
error: undefined symbol: _ZN5boost6system15system_categoryEv
error: undefined symbol: _ZN5boost6system16generic_categoryEv
error: undefined symbol: _ZNK5boost10filesystem4path11parent_pathEv
error: undefined symbol: _ZNK5boost10filesystem4path14root_directoryEv
error: undefined symbol: _ZNK5boost10filesystem4path3endEv
error: undefined symbol: _ZNK5boost10filesystem4path5beginEv
error: undefined symbol: _ZNK5boost10filesystem4path7compareERKS1_
error: undefined symbol: _ZNK5boost10filesystem4path9extensionEv
Error: Aborting compilation due to previous errors
shared:ERROR: '/Users/myUser/emsdk/node/12.9.1_64bit/bin/node /Users/myUser/emsdk/emscripten/incoming/src/compiler.js /var/folders/v9/y47_kxhs2xlfxtywq5mzj3x40000gn/T/tmpqdyxpS.txt' failed (1)
make[1]: *** [bin/guiFromParametersExample.html] Error 1
make: *** [Release] Error 2

ok. sorry @theo . it worked!
I forget to run the script for libs again:

/openFrameworks/scripts/emscripten/download_libs.sh

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

  1. how can we add the profile to the system to avoid running source ‘./emsdk_env.sh’ every session?
  2. there’s any way to made it run in Safari? What are the main limitations of Emscripten vs native app?

done that.

then followed the same steps as @Jona

git clone https://github.com/juj/emsdk.git
cd emsdk
./emsdk install sdk-incoming-64bit binaryen-master-64bit
./emsdk activate sdk-incoming-64bit binaryen-master-64bit
source ./emsdk_env.sh

Then use PG to create guiExample with Emscripten template:

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:

this is /openFrameworks/scripts/emscripten
download_libs.sh.zip (260 Bytes)

this is /openFrameworks/dev folder, maybe there’s more files required, sorry…
dev.zip (23.0 KB)

I think this assumes the GitHub version of OF. not the nightly build? since I do not have a ./dev/download_libs.sh

I am using GitHub version… Refresh this post, I added /dev too… just in case it makes it simpler…

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…

You can list and choose the browser with:

emrun --list_browsers
emrun --browser safari

https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html

1 Like