Latest emscripten doesnt work on examples

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

mh.
I placed your dev folder in the scripts folder.
now running download_libs.sh from the emscripten did start installing a bunch of stuff.

just to be sure I ran again:
./emsdk activate sdk-incoming-64bit binaryen-master-64bit
source ./emsdk_env.sh

still, emmake make produces same error.

I guess I will download the GitHub OF version and try it with that.

thanks again for your help

eureka. it works.

I downloaded the latest nightly build: of_v20191203_osx_nightly.zip

opened a new terminal window.
since I already followed the earlier install steps I just had to redo the last two steps.
cd emsdk
./emsdk activate sdk-incoming-64bit binaryen-master-64bit
source ./emsdk_env.sh

then in the same terminal window cd to the project folder.
then call emmake make
and the build worked :slight_smile:

I did not need to install via /openFrameworks/scripts/emscripten/download_libs.sh

thanks everyone

1 Like

I was just going to write I think the issue is that you should delete the contents of:
⁨libs⁩ ▸ ⁨openFrameworksCompiled⁩ ▸ ⁨lib⁩ ▸ ⁨emscripten⁩

When switching to different emsdk versions.
I think the reason the nightly worked is that it hadn’t compiled the OF project with a different emsdk.
( I ran into this yesterday )

I would guess if you downloaded a fresh zip of 0.11.0 to a different location and do the steps in your last post it would also work.

Thanks everyone for helping with this though.
Its fairly gnarly to debug.

And if anyone is feeling brave and wants to help figure out why this is happening - would be amazing:

:slight_smile:

/dev folder goes outside /scripts…
/openFrameworks/dev

thanks for this info.

the two examples worked fine.
but trying to compile my own project still produces errors.

warning: To disable errors for undefined symbols use -s ERROR_ON_UNDEFINED_SYMBOLS=0

Error: Aborting compilation due to previous errors

shared:ERROR: ‘/Users/stephanschulz/emsdk/node/12.9.1_64bit/bin/node /Users/stephanschulz/emsdk/emscripten/incoming/src/compiler.js /var/folders/q0/p6sww9k10816nqt8ldgg03c40000gp/T/tmpZzOWVM.txt’ failed (1)

make[1]: *** [bin/guiFromParametersExample.html] Error 1

make: *** [Release] Error 2

I tried to delete the Emscripten folder content as you suggested.
also started new terminal window and ran ./emsdk commands as mentioned earlier.

also noticed when making edits to the guiExample src and calling emmake, I did not see those code changes take effect.

@stephanschulz Did you also delete the emscripten folder of the guiExample? Normally the changes should take effect if it runs at all. Regarding your own example: Is it possible that you use some addons or functions that are not compatible with Emscripten? There seems something wrong with a .txt file…

@Jona thanks for pointing this out. I only now notice that running emmake creates a folder called obj with an Emscripten folder inside.

@Theo as mentioned earlier I am now able to compile and run guiExample. BUT as soon as I add gui.loadFromFile(“settings.xml”); to setup() the app will not run successfully in the browser. I guess Emscripten apps do not like loading and writing to disk?

@stephanschulz I think you can not read files from disk easily/the used way with Emscripten.
But you can read files that are in the Data folder of the Emscripten project.
This could be a start for reading files from disk, I do not understand it by myself: https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html
and here @kokawa2003 managed to save an image to disk with Emscripten: I want to save image

settings.xml is in my data folder.
and usually calling

retrieves this xml file from the data folder. but maybe with Emscripten I need to change the file path?

@stephanschulz Then it is something else. I do not think that you need to change the file path.

files in data are packed in a special format and served as a file system emulation when you use emmake make run so it should work. if you compile the aplication in debug you should get a proper stack trace when the app crashes which will give you a clue of what might be going on.

I tried to emmake make Debug and got this result, both using gui.loadFromFile("settings.xml"); and without this line.
Debug make:

in order to do a sanity check I called emmake make on the same project in the same terminal window.
Without gui.loadFromFile("settings.xml"); the example runs in the browser.
But with gui.loadFromFile("settings.xml"); I get this error again:
Normale Make:

@Jona and anyone else on non macOS builds.
Does this work for you for 0.11.0?

git clone https://github.com/emscripten-core/emsdk
cd emsdk
./emsdk install latest-fastcomp
./emsdk activate latest-fastcomp
source ./emsdk_env.sh

Followed by:

  • Deleting the contents of libs/openFrameworksCompiled/lib/emscripten/
  • emmake make clean in the example folder you want to test
  • emmake make in the example folder
  • emrun bin/myExample.html