Cannot run 3DPrimitivesExample with emscripten on macOS


#1

I ran the following scripts with no errors but the example fails with ‘Error: imported global env:__ZNSt3__14cerrE must be a number’. I have tried running other examples and they have failed with the same errors.

The console shows the following errors:

Executing open -a Safari http://localhost:6931/3DPrimitivesExample.html
Error: imported global env:__ZNSt3__14cerrE must be a number
failed to asynchronously prepare wasm: Error: imported global env:__ZNSt3__14cerrE must be a number
Error: imported global env:__ZNSt3__14cerrE must be a number

Here’s the steps I followed:

curl -LO https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz && tar xvf emsdk-portable.tar.gz
cd emsdk-portable
./emsdk update
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
git clone --depth=1 https://github.com/openFrameworks/openFrameworks.git
cd openFrameworks
scripts/emscripten/./download_libs.sh
cd examples/3d/3DPrimitivesExample
cp ../../../scripts/templates/emscripten/Makefile .
emmake make
emrun bin/3DPrimitivesExample.html

Is anyone able to reproduce this?

I should also mention that I get the following warnings when compiling:

warning: unresolved symbol: _ZN15ofURLFileLoaderC1Ev
warning: unresolved symbol: _ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5rfindEcj
warning: unresolved symbol: _ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEjjPKcj
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5eraseEjj
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKcj
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEjc
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEjc
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjPKcj
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEj
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEjjjjjj
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_jjRKS4_
warning: unresolved symbol: _ZNSt3__213basic_ostreamIcNS_11char_traitsIcEEE5writeEPKci
warning: unresolved symbol: _Znaj
warning: unresolved symbol: _ZnajRKSt9nothrow_t
warning: unresolved symbol: _Znwj
warning: unresolved symbol: _ZnwjRKSt9nothrow_t
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)

#2

just tested and this is working for me without problem. The only thing i see is that you are downloading emscripten from a weird server that doesn’t seem to be the official.

Can you try installing emscripten using the official instructions:

https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html


#3

Made the following changes and I’m getting the following warnings again:

I followed the instructions from the site and got the following errors

warning: unresolved symbol: _ZN15ofURLFileLoaderC1Ev
warning: unresolved symbol: _ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5rfindEcj
warning: unresolved symbol: _ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEjjPKcj
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5eraseEjj
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKcj
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEjc
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEjc
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjPKcj
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEj
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEjjjjjj
warning: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_jjRKS4_
warning: unresolved symbol: _ZNSt3__213basic_ostreamIcNS_11char_traitsIcEEE5writeEPKci
warning: unresolved symbol: _Znaj
warning: unresolved symbol: _ZnajRKSt9nothrow_t
warning: unresolved symbol: _Znwj
warning: unresolved symbol: _ZnwjRKSt9nothrow_t

Here’s a link to the CI build


#4

2 things, you need to also copy config.make to your project folder in order to build a project correctly, the makefile system will try to guess defaults if it’s not there but that hasn’t been maintained in a while so there might be some problems if you don’t copy config.make as well

the github from where you are downloading emscripten is still not the official one, follow the instructions in my previous post to install emscripten correctly


#5


These were the directions i was following. Where are the instructions you were referring to?


#6

oh yeah sorry. they might have changed the repo recently and i wasn’t recognizing the address.

it’s really strange it works for me without problem but some other people have reported that using an older version of emscripten instead of the very latest works fine


#7

I have followed the same exact steps and several iterations and get the exact same results as @amilajack
is there any indication of what we can do
OR
any pointers on which older version of what combined will work!?

all attempts result in this:
missing function: _Znwj


#8

@arturo are you able to compile this inside docker? If so can you please share instructions for doing so. Thanks!