Emscripten errors when used with a React App

2017-08-09 Thread Lubo Astinov
Hi everyone, I'm new to Emscripten and I'm running into a problem which probably has a simple solution, yet I'm unable to find it. I create a basic React JS app with create-react-app. I then want to use a very simple .cpp file (just a noop at this point really, returning a constant) which I

beginner emscripten issue:emscripten_fetch on a background thread is failing

2017-08-09 Thread Scott Watson
I am having trouble porting our application to asm.js. We have a class that handles HTTP GETs for us, that I am trying to port using the emscripten_fetch api. I can only get the asynchronous fetch to work, and only when called on the main thread. I can't get synchronous to work at all.

Re: About vanilla wasm and emcc SIDE_MODULE

2017-08-09 Thread Alon Zakai
__post_instantiate is a way to run code when the module is loaded. For example it could run global constructors, which languages like C++ have. This is necessary not just for dynamic linking but also a single file by itself. (wasm modules also have an optional start(), but that isn't good enough

Re: About vanilla wasm and emcc SIDE_MODULE

2017-08-09 Thread Jean Valjean
Also, do you recommend the use of emscripten for "vanilla wasm" output or should I stick with the original LLVM distrib ? -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it,

Re: About vanilla wasm and emcc SIDE_MODULE

2017-08-09 Thread Jean Valjean
Thanks for the detailed answer, I appreciate your help :) I have some questions about that: 1) Are the global destructors called ? 2) Also, "__post_instantiate" seems to allocate the stack but the Vanilla LLVM doesn't do that. Doesn't Wasm have its own default stack ? And more : 3) How can I

Re: asm.js very slow compile time

2017-08-09 Thread Александр Гурьянов
Update on compile time: -O2 - ~60 sec -O3 - ~7 sec Also I try to build project with WASM=1, and it built successfully, but I can't run it due this error: failed to asynchronously prepare wasm: LinkError: import object field '__ZN6Editor10s_instanceE' is not a Number testing.html:161:40

Re: "error: invalid input constraint 're' in asm"

2017-08-09 Thread Jukka Jylänki
Passing "-I /usr/local/include/" to emcc is definitely not correct. Compiling to the web is a process of cross compilation, and the headers you have in /usr/local/include/ refer to x86/x64 libraries, and not WebAssembly targeted libraries. Not sure if that is the cause of the error, though you

Re: Emscripten test suite

2017-08-09 Thread Илья Галашко
Thank you!! 2017-08-08 18:13 GMT+03:00 Jukka Jylänki : > If you want to run tests in a browser, you can use the emrun tool that > is bundled to Emscripten (upstream at https://github.com/juj/emrun) to > automate runs of a web page in a browser. Emrun is a browser drive > that

Re: asm.js very slow compile time

2017-08-09 Thread Jukka Jylänki
This looks like a performance bug in the browser. It may be possible to reduce the compilation time, but without a test case it's not possible to know what might be wrong. Is the project public somewhere? One known source of slow compilation times is if one has very large switch-case statements

Run web worker inside static library

2017-08-09 Thread ilia . galashko
Hi, in my code there are several static libraries which were written by me. I want to use web workers inside this libraries. Is there any chance to do this ? When I instantiate object from static lib in my main file and pass it to web worker everything is ok, but when I do this inside static

Re: asm.js very slow compile time

2017-08-09 Thread Александр Гурьянов
The source is not public, but I think I can share result js if it's useful. I will try to build WebAssembly and check. 2017-08-09 19:04 GMT+07:00 Jukka Jylänki : > This looks like a performance bug in the browser. It may be possible > to reduce the compilation time, but without

Re: "error: invalid input constraint 're' in asm"

2017-08-09 Thread Eduardo Sorribas
Hey folks! Thanks for your replies, I figured it out. It was related to some inline assembly in the library as Alon suggested. Thanks again :). On Tuesday, August 8, 2017 at 6:53:20 PM UTC+2, Eduardo Sorribas wrote: > > Hey folks! > > I'm trying to compile some parts of GNU MP to webassembly

Re: beginner emscripten issue:emscripten_fetch on a background thread is failing

2017-08-09 Thread Scott Watson
First, thank you for the assistance! -s NO_EXIT_RUNTIME=1 had no effect. Actually, I think you get that automatically with -s USE_PTHREADS=1 don't you? I switched to using pthreads directly with no effect either. On Wednesday, August 9, 2017 at 12:35:20 PM UTC-7, jj wrote: > > First thing is

Re: Emscripten errors when used with a React App

2017-08-09 Thread Jukka Jylänki
Hmm, most of these should be present in the compiled code file? Also, `importScripts` is a web built-in in Web Worker's global scope: https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts, I wonder if React's linter needs to be taught that the app is run in a Web Worker.

Re: beginner emscripten issue:emscripten_fetch on a background thread is failing

2017-08-09 Thread Jukka Jylänki
Hmm, can you try specifying the following attributes for the download? attr.attributes = EMSCRIPTEN_FETCH_LOAD_TO_MEMORY | EMSCRIPTEN_FETCH_SYNCHRONOUS | EMSCRIPTEN_FETCH_REPLACE; Also there is a linker flag -s FETCH_DEBUG=1 that can show more information. 2017-08-09 22:45 GMT+03:00 Scott

Re: beginner emscripten issue:emscripten_fetch on a background thread is failing

2017-08-09 Thread Scott Watson
Ok, that’s interesting. The synchronous download worked on the background thread. This works now with -s NO_EXIT_RUNTIME=1. It had no effect on the asynchronous download on a background thread. I still get a call to downloadFailed with a status of 0. > On Aug 9, 2017, at 1:06 PM, Jukka

Re: Emscripten errors when used with a React App

2017-08-09 Thread Lubo Astinov
Have you ever been successfull in getting something compiled with Emscripten to pass the React linter? I'm wondering if I'm just doing something like not passing in the correct flag or something. On Wednesday, August 9, 2017 at 12:39:51 PM UTC-7, jj wrote: > > Hmm, most of these should be

About vanilla wasm and emcc SIDE_MODULE

2017-08-09 Thread Jean Valjean
Hello there, Sorry for my approximate english. It is now possible to make a standalone WebAssembly file. I'm gladly to see that is possible now with Emscripten, thanks. I can now make my own HTML source content, with my own way to load the WebAssembly bytecode. But I don't understand why the

Re: Run web worker inside static library

2017-08-09 Thread ilia . galashko
I create worker with emscripten_create_worker inside C++ code. It is not an special error. When I try to get access to string member of class after passing to web worker. I just get TypeError: str is undefined. It happens only if I pass member of class in static library. If I pass class work

Re: Run web worker inside static library

2017-08-09 Thread Jukka Jylänki
It should be fine to create web workers with JS "new Worker(url);" inside any code, be it main application code or statically linked libraries. I have not heard of a "broken object" error before. What is that message? 2017-08-09 15:22 GMT+03:00 : > Hi, in my code there