Latest emscripten doesnt work on examples

if i remember well 1.38.5

hmm that didnt do it for me

Hi all–

Just getting started today with OF but I’m running into this same problem-- I haven’t managed a successful Emscripten build yet. Figured I’d add my attempts in case it helps. In each case, I followed the great instructions from dylanmach.

(Running on OS X 10.13.6 with Xcode 10A255)

(1) embuilder.py build ALL run before emmake make (no change – suggested in an old thread about missing deps)
(2) building with single-threaded make (no change – suggested in a very old Emscripten thread)
(3) also copying the config.make from the template dir (no change)
(4) allowing the undef’d symbols, with adding -s ERROR_ON_UNDEFINED_SYMBOLS=0 to linker flags in config.make (it builds, but then errs out in javascript console “missing function: _ZnwjRKSt9nothrow_t”)
(5) cleared cache in ~/.emscripten_cache to force std libs to rebuild (no change)

I also tried the using a couple older versions of Emscripten sdk (emsdk-1.34.1 and -1.27.0).

Tried latest emsdk with openFrameworks from git (cf08ca38, head of branch patch-release) and of_v0.10.0_osx_release from the download link on the website.

I’m guessing this has something to do with my local configuration-- any ideas or suggestions most welcome!

Thanks!

Details of the v0.10 / 1.38.15 attempt:

/Users/vector/dev/third_party/emsdk-portable/emscripten/1.38.15/em++ -o bin/3DPrimitivesExample.html -O3 -s OUTLINING_LIMIT=100000 -s TOTAL_MEMORY=134217728 --memory-init-file 1 obj/emscripten/Release/src/ofApp.o obj/emscripten/Release/src/main.o /Users/vector/dev/third_party/of_v0.10.0_osx_release/addons/obj/emscripten/Release/ofxEmscripten/src/ofxEmscriptenSoundStream.o /Users/vector/dev/third_party/of_v0.10.0_osx_release/addons/obj/emscripten/Release/ofxEmscripten/src/ofxEmscriptenVideoPlayer.o /Users/vector/dev/third_party/of_v0.10.0_osx_release/addons/obj/emscripten/Release/ofxEmscripten/src/ofxEmscriptenSoundPlayer.o /Users/vector/dev/third_party/of_v0.10.0_osx_release/addons/obj/emscripten/Release/ofxEmscripten/src/ofxEmscriptenVideoGrabber.o /Users/vector/dev/third_party/of_v0.10.0_osx_release/addons/obj/emscripten/Release/ofxEmscripten/src/ofxEmscriptenURLFileLoader.o /Users/vector/dev/third_party/of_v0.10.0_osx_release/addons/obj/emscripten/Release/ofxEmscripten/src/ofxAppEmscriptenWindow.o  /Users/vector/dev/third_party/of_v0.10.0_osx_release/libs/openFrameworksCompiled/lib/emscripten/libopenFrameworks.bc   -Wl,--as-needed -Wl,--gc-sections --preload-file bin/data@data --emrun --js-library /Users/vector/dev/third_party/of_v0.10.0_osx_release/addons/ofxEmscripten/libs/html5video/lib/emscripten/library_html5video.js --js-library /Users/vector/dev/third_party/of_v0.10.0_osx_release/addons/ofxEmscripten/libs/html5audio/lib/emscripten/library_html5audio.js --shell-file /Users/vector/dev/third_party/of_v0.10.0_osx_release/libs/openFrameworksCompiled/project/emscripten/template.html /Users/vector/dev/third_party/of_v0.10.0_osx_release/libs/FreeImage/lib/emscripten/libfreeimage.a /Users/vector/dev/third_party/of_v0.10.0_osx_release/libs/boost/lib/emscripten/libboost_system.a /Users/vector/dev/third_party/of_v0.10.0_osx_release/libs/boost/lib/emscripten/libboost_filesystem.a /Users/vector/dev/third_party/of_v0.10.0_osx_release/libs/freetype/lib/emscripten/libfreetype.bc /Users/vector/dev/third_party/of_v0.10.0_osx_release/libs/pugixml/lib/emscripten/libpugixml.bc /Users/vector/dev/third_party/of_v0.10.0_osx_release/libs/tess2/lib/emscripten/libtess2.a /Users/vector/dev/third_party/of_v0.10.0_osx_release/libs/uriparser/lib/emscripten/liburiparser.a
WARNING:root:for wasm there is usually no need to set OUTLINING_LIMIT, as VMs can handle large functions well anyhow
error: undefined symbol: _ZN15ofURLFileLoaderC1Ev
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: _ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5rfindEcj
error: undefined symbol: _ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEjjPKcj
error: undefined symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5eraseEjj
error: undefined symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcj
error: undefined symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcjj
error: undefined symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKcj
error: undefined symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEjc
error: undefined symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEjc
error: undefined symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjPKcj
error: undefined symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEj
error: undefined symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEjjjjjj
error: undefined symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_jjRKS4_
error: undefined symbol: _ZNSt3__213basic_ostreamIcNS_11char_traitsIcEEE5writeEPKci
error: undefined symbol: _Znaj
error: undefined symbol: _ZnajRKSt9nothrow_t
error: undefined symbol: _Znwj
error: undefined symbol: _ZnwjRKSt9nothrow_t
Error: Aborting compilation due to previous errors
ERROR:root:'/Users/vector/dev/third_party/emsdk-portable/node/8.9.1_64bit/bin/node /Users/vector/dev/third_party/emsdk-portable/emscripten/1.38.15/src/compiler.js /tmp/tmpYXV38v.txt /Users/vector/dev/third_party/of_v0.10.0_osx_release/addons/ofxEmscripten/libs/html5video/lib/emscripten/library_html5video.js /Users/vector/dev/third_party/of_v0.10.0_osx_release/addons/ofxEmscripten/libs/html5audio/lib/emscripten/library_html5audio.js /Users/vector/dev/third_party/emsdk-portable/emscripten/1.38.15/src/library_pthread_stub.js' failed (1)
make[1]: *** [bin/3DPrimitivesExample.html] Error 1
make: *** [Release] Error 2

and emsdk list:

 $ emsdk list

The following precompiled tool packages are available for download:
           clang-e1.30.0-64bit
           clang-e1.34.1-64bit
           clang-e1.35.0-64bit
           clang-e1.37.1-64bit
           clang-e1.38.14-64bit
     *     clang-e1.38.15-64bit     	INSTALLED
           node-4.1.1-64bit
     *     node-8.9.1-64bit         	INSTALLED
           spidermonkey-37.0.1-64bit
           spidermonkey-nightly-2015-04-12-64bit
           emscripten-1.30.0
           emscripten-1.34.1
           emscripten-1.35.0
           emscripten-1.37.1
           emscripten-1.38.14
     *     emscripten-1.38.15       	INSTALLED
           crunch-1.04

I also can’t make it work. I get this:

warning: unresolved symbol: _ZN13ofSoundBuffer8allocateEjj
warning: unresolved symbol: _ZN15ofURLFileLoaderC1Ev
warning: unresolved symbol: _ZN9ofPixels_IhE8allocateEjjj
warning: unresolved symbol: _ZNK8ofColor_IfEixEj
warning: unresolved symbol: _ZNK8ofColor_IhEixEj
warning: unresolved symbol: _ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4findEcm
warning: unresolved symbol: _ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEmmPKcm
warning: unresolved symbol: _ZNSt3__212__next_primeEm
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5eraseEmm
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKcm
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEmPKc
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEmPKcm
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEmc
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEmmPKcm
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_mmRKS4_
warning: unresolved symbol: _ZNSt3__213basic_istreamIcNS_11char_traitsIcEEE4readEPcl
warning: unresolved symbol: _ZNSt3__213basic_istreamIcNS_11char_traitsIcEEE6ignoreEli
warning: unresolved symbol: _ZNSt3__213basic_ostreamIcNS_11char_traitsIcEEE5writeEPKcl
warning: unresolved symbol: _ZNSt3__215basic_streambufIcNS_11char_traitsIcEEE6xsgetnEPcl
warning: unresolved symbol: _ZNSt3__215basic_streambufIcNS_11char_traitsIcEEE6xsputnEPKcl
warning: unresolved symbol: _Znam
warning: unresolved symbol: _Znwm
warning: Output contains some very large functions (4442 lines in __ZN6LibRaw15parse_makernoteEii), consider building source files with -Os or -Oz, and/or trying OUTLINING_LIMIT to break them up (see settings.js; note that the parameter there affects AST nodes, while we measure lines here, so the two may not match up)

I tried with 1.38.1, 1.38.5, 1.38.6, 1.38.16.

I made this script to switch between versions:

#!/bin/bash

echo "BEFORE:"
emsdk list --old | grep \*

echo ""
emsdk install emscripten-$1
emsdk install sdk-$1-64bit
emsdk install binaryen-tag-$1-64bit
emsdk install clang-e$1-64bit

emsdk activate emscripten-$1
emsdk activate sdk-$1-64bit
emsdk activate binaryen-tag-$1-64bit
emsdk activate clang-e$1-64bit

echo "AFTER:"
emsdk list --old | grep \*

echo "now run: source emsdk_env.sh"

And I run it like this

set_emsdk_version.sh 1.38.10

I’m not sure it’s necessary to change all emscripten, sdk, binaryen and clang.

Also, I notice I need to do

emmake make clean

before

emmake make

otherwise it compiles instantly (I assume it does nothing).

was getting the same compile errors above
error: undefined symbol: _ZnajRKSt9nothrow_t

on osx 10.13.6 with of_0.10.1.
running emscripten 1.38.10 and then 1.38.20
I ran the emscripten ‘hello world’ test build and that compiles file,
then used @hamoid s advice and script and now the 3DPrimitives example compiles, the errors for _ZnajRKSt9nothrow_t now just being warnings…
but throws error in the browser _
CORS (cross reference api error)
missing function: _ZnwjRKSt9nothrow_t

running the files from a webserver gets by the resource CORS error but still gives this as a browser console error…

printErr @ 3DPrimitivesExample.html:166
3DPrimitivesExample.html:166 falling back to ArrayBuffer instantiation
printErr @ 3DPrimitivesExample.html:166
3DPrimitivesExample.js:1 The Web Audio autoplay policy will be re-enabled in Chrome 70 (October 2018). Please check that your website is compatible with it. https://goo.gl/7K7WLu
_html5audio_context_create @ 3DPrimitivesExample.js:1
3DPrimitivesExample.html:166 missing function: _ZnwjRKSt9nothrow_t
printErr @ 3DPrimitivesExample.html:166
3DPrimitivesExample.html:154 -1
3DPrimitivesExample.html:166 -1
printErr @ 3DPrimitivesExample.html:166
3DPrimitivesExample.js:1 Uncaught abort(-1). Build with -s ASSERTIONS=1 for more info.

any advice ?

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?