Latest emscripten doesnt work on examples

@theo I can confirm that:

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

Is working with Open Frameworks 0.11.0 and Ubuntu 18.04. And it is much faster to install.
But I get these warnings, that I think I did not get before:

/home/jonathan/Schreibtisch/of_v20191206_linux64gcc6_release/addons/ofxEmscripten/src/ofxAppEmscriptenWindow.cpp:260:2: warning: 
      'emscripten_set_canvas_size' is deprecated: This variant does not allow
      specifying the target canvas [-Wdeprecated-declarations]
        emscripten_set_canvas_size(w,h);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~
        Use emscripten_set_canvas_element_size() instead
/home/jonathan/emsdk/fastcomp/emscripten/system/include/emscripten/emscripten.h:139:71: note: 
      'emscripten_set_canvas_size' has been explicitly marked deprecated here
void emscripten_set_canvas_size(int width, int height) __attribute__((depreca...
                                                                      ^
/home/jonathan/Schreibtisch/of_v20191206_linux64gcc6_release/addons/ofxEmscripten/src/ofxAppEmscriptenWindow.cpp:274:2: warning: 
      'emscripten_get_canvas_size' is deprecated: This variant does not allow
      specifying the target canvas [-Wdeprecated-declarations]
  ...emscripten_get_canvas_size( &width, &height, &isFullscreen );
     ^~~~~~~~~~~~~~~~~~~~~~~~~~
     Use emscripten_get_canvas_element_size() and emscripten_get_fullscreen_status() instead
/home/jonathan/emsdk/fastcomp/emscripten/system/include/emscripten/emscripten.h:140:92: note: 
      'emscripten_get_canvas_size' has been explicitly marked deprecated here
  ...*width, int *height, int *isFullscreen) __attribute__((deprecated("This ...
                                                            ^
2 warnings generated.

Those functions seem to be deprecated since Emscripten 1.37.20 (the current version is 1.39.3):
https://www.mail-archive.com/emscripten-discuss@googlegroups.com/msg06581.html

Thanks @Jona
Should be easy to fix those deprecations - I’ll add it to 0.11.1

1 Like

Hi,

I manage to build 3DPrimitivesExample within an ubuntu docker container on Windows 10 Pro host with latest Docker Desktop.

I have done the following steps:

Start Ubuntu Docker

docker run -ti ubuntu

uname -a in container gives:
Linux d45c73dd3911 4.9.184-linuxkit #1 SMP Tue Jul 2 22:58:16 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Inside container, Install needed packages

apt isntall dev-essential
apt install cmake
apt install python
apt install wget

Setup emdsk

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

Install OF and build example

wget https://openframeworks.cc/versions/v0.11.0/of_v0.11.0_linux64gcc6_release.tar.gz
tar -xvzf of_v0.11.0_linux64gcc6_release.tar.gz
cd of_v0.11.0_linux64gcc6_release/examples/3d/3DPrilitivesExample
./emmake make

Then I copy the result back to the host from an other shell:

docker cp <container_name>:/home/dev/of_v0.11.0_linux64gcc6_release/examples/3d/3DPrimitivesExample/bin .

Then I load the html file in Firefox, after having disable the CORS security see this article. This allow browser to load local files (security issue).

And here the results, looks like bellow, some faces are “transparents”.

Now I plane to build a project from scratch. And then figure out how to develop in Windows and build in docker or linux.

Thank’s for all work done on OF !

2 Likes

Thanks for checking!

The depth issue you mentioned will be fixed in 0.11.1.

You can see a fix for it here though:

Thanks!
Theo

Welcome,

I’ll also would like to try using WSL and Visual Studio capacity to use make files.
Because emsdk need make files to compile.

Yes, I’d also like to use emscripten with my Visual Studio built oF projects.

I can confirm that I’ve successfully installed the Linux version of emscripten in the WSL. With it I was able to start an emmake build for one of the example sketches from the Linux distribution of openFrameworks. (Linux oF sketches include Makefiles for their own build process.)

The build process ran well for a few minutes, but then wasm-ld failed due to machine type must be wasm32 errors.

The newest version 1.39.4 does not seem to work with ubuntu for me.
So I use

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

instead.

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

works again but i had to change config.emscripten.default.mk
Here is the edited file: https://github.com/Jonathhhan/ofxOfelia/blob/master/scripts/Emscripten/updateOF/config.emscripten.default.mk

can you send a pull request with the changes?

@arturo I will , hope my changes do not break anything that was working before :wink:
But so far it seems to work fine.

Mainly I needed to set DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0.
Could that mean that I could use DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 if the Emscripten .html template gets updated according to the changelog?

From the Emscripten Changelog 1.39.5:

  • Default DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR to 1. See #9895.
    With this change the old deprecated HTML5 API event target lookup behavior is
    disabled. There is no “Module.canvas” object, no magic “null” default handling,
    and DOM element ‘target’ parameters are taken to refer to CSS selectors, instead
    of referring to DOM IDs. For more information see:
    https://groups.google.com/forum/#!msg/emscripten-discuss/xScZ_LRIByk/_gEy67utDgAJ

https://emscripten.org/docs/introducing_emscripten/release_notes.html

yes it seems they’ve changed the way to handle events so changing the template would allow it to work without enabling this flag. that would be of course better but if you are not sure on how to update the template, sending a PR with this flag and opening an issue explaining this would be also super useful

1 Like

Hi Arturo, I made a pull request: https://github.com/openframeworks/openFrameworks/pull/6536
but “some checks were not successful”. Yes, it seems I am not sure how to update the template.html, but I am also not sure how to make a PR without submitting some code :wink:

Hello again,

I manage to build a Docker image running Ubuntu with OF and emsdk. This image allow me to compile OF project in webAssembly, but also under Windows. A folder on Windows is shared with the docker image. When I create a new project, I ask projectGenerator to build project for Visual Studio and linux q-creator.

I put everything in GitHub

It comes with a quick start. This should be reproductible with WSL.

I had to build against version 1.39.4-fastcomp sdk of emscripten, not latest. There is issues with 1.39.5 related to how events are passed between js and WEBASM I think. Like noted in previous post of this thread.

I have an issue with fullscreen button that throw an error, also due to event handling I think.

I hope to get time to look at that.

4 Likes

I also wanted to mention that I had to use this work around to make use of ofFbo with Emscripten: https://github.com/openframeworks/openFrameworks/issues/5663

1 Like

Hey,

I’m having trouble running emscripten apps (but seem to be compiling without errors). Wondering if these PRs and instructions are still valid? cc @theo

Thanks!

2 Likes

Hello, I am following your guide on git hub. When I run the command “./build.ps1” in PowerShell, It runs fine, but then it freezes when it asks for my location. I can not input my geographical area when it prompts me to. Any suggestions?

Hi all, wanted to chime in here saying the 3DPrimitivesExample no longer builds with emsdk activate latest. Error log: https://gist.github.com/tarngerine/b1ff7994a35de592783fd3ac70067ebe

It builds with latestfastcomp, but the site errors out:

Also it seems the fastcomp version is deprecated, lots of warnings when trying to use it: em++: warning: the fastomp compiler is deprecated. Please switch to the upstream llvm backend as soon as possible and open issues if you have trouble doing so [-Wfastcomp]

The recommended alternative emsdk is no longer available, either Error: No tool or SDK found by name 'sdk-incoming-64bit'.

I’m getting following errors which are a bit different from above. Running emcc -v gives 1.40.1, on ubuntu 20.04, and OF 0.11.0.

Have tried re-installing, and done (I think) most of the Linux-relevant suggestions before and am able to compile super-simple stuff (‘hello world’) from the emscripten documentation, but seemingly nothing using OF.

Any suggestions welcome!
Thank you

Output:
make: make
Compiling OF library for Release
make[1]: Entering directory ‘/home/ukc/of_v0.11.0_linux64gcc6_release/libs/openFrameworksCompiled/project’
Done!
make[1]: Leaving directory ‘/home/ukc/of_v0.11.0_linux64gcc6_release/libs/openFrameworksCompiled/project’

Compiling 3DPrimitivesExample for Release
make[1]: Entering directory ‘/home/ukc/of_v0.11.0_linux64gcc6_release/examples/3d/3DPrimitivesExample’
make[2]: Entering directory ‘/home/ukc/of_v0.11.0_linux64gcc6_release/examples/3d/3DPrimitivesExample’

 compiling done
 to launch the application on the default browser, run:

 emrun bin/3DPrimitivesExample.html
 
 some browsers, like safari, don't support webgl

make[2]: *** [/home/ukc/of_v0.11.0_linux64gcc6_release/libs/openFrameworksCompiled/project/emscripten/config.emscripten.default.mk:283: afterplatform] Error 127
make[2]: Leaving directory ‘/home/ukc/of_v0.11.0_linux64gcc6_release/examples/3d/3DPrimitivesExample’
make[1]: *** [/home/ukc/of_v0.11.0_linux64gcc6_release/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:169: ReleaseABI] Error 2
make[1]: Leaving directory ‘/home/ukc/of_v0.11.0_linux64gcc6_release/examples/3d/3DPrimitivesExample’
make: *** [/home/ukc/of_v0.11.0_linux64gcc6_release/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:129: Release] Error 2

Sorry the actual error is when I start a Firefox (or Chrome) browser, I get an error and no image, even though I have a local server running. The error I get is: ‘[notice ] ofxAppEmscriptenWindow: Got 1 display configs’

Same here (Ubuntu and OSX), did you find any solution?