Latest emscripten doesnt work on examples


#1

As mentioned in other threads following the latest Emscripten instructions for OF does not even work and has missing functions for examples/3d

Following several versions of these instructions with no luck:

Initialize emscripten.
./emsdk update
./emsdk install latest
./emsdk activate latest

Set up your environement.
source ./emsdk_env.sh

Get the latest version of openFrameworks.
git clone --depth=1 https://github.com/openFrameworks/openFrameworks.git
cd openFrameworks

Install openFrameworks libraries for emscripten.
scripts/emscripten/./download_libs.sh

Go to an example:
cd examples/3d/3DPrimitivesExample/

Copy a MAKEFILE into the example:
cp ../../../scripts/templates/emscripten/Makefile .

Build the project:
emmake make

Run the project.
emrun bin/3DPrimitivesExample.html

all attempts result in this:
missing function: _Znwj


#2

bump


#3

Some other people have reported this, not sure what’s going on since things work well on our test servers and my own machine. It’s probably related to some libraries not being compatible with the very latest release of emscripten so going back a couple of versions will probably work and some people have reported that it does


#4

@arturo understood and thanks for your response, do you have any indication of what version reported users rolled back to? I just tested 1.38.9 with no luck


#5

if i remember well 1.38.5


#6

hmm that didnt do it for me


#7

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

#8

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).


#9

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 ?