Re: em_asm blocks interacting with json.parse somehow?

2020-10-05 Thread r0l...@freemail.hu
Headbang: I had a typo in all the magic as e.ports[0] is the right way to 
access the port.

Sorry for the noise...

r0l...@freemail.hu a következőt írta (2020. október 5., hétfő, 19:29:07 
UTC+2):

>
> Hi All,
>
> I'm experimenting with a relatively tricky scenario:
>
>
> https://stackoverflow.com/questions/41753104/how-do-you-use-webmessageport-as-an-alternative-to-addjavascriptinterface
>
> or its github source:
>
> https://github.com/commonsguy/cw-omnibus/tree/master/WebKit/SensorPort
>
> It works fine with normal html+js pages but I decided to do the same with 
> a qt/qml app compiled as webassembly. Seems to work till the point when the 
> EM_ASM block gets called where the global (window) onmessage function gets 
> registered:
>
> EM_ASM(
>   var port;
>   onmessage=function(e){
> port=e.port[0]
>   }
> );
>
> That onmessage gets called from java via webview postWebMessage(...) fine 
> but it seems that the parameter that is passed into postWebMessage(...) 
> goes through a JSON.parse and what I get in the incoming 'e' event is just 
> an:
>
> {isTrusted: true} 
>
> So the function fails with not being able to access property 0 of 
> undefined.
>
> Does anyone know why the event object does not arrive as expected?
>
> Thanks,
> r0ller
>

-- 
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, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/783b5493-d843-47c0-9548-b054fdf177fcn%40googlegroups.com.


em_asm blocks interacting with json.parse somehow?

2020-10-05 Thread r0l...@freemail.hu

Hi All,

I'm experimenting with a relatively tricky scenario:

https://stackoverflow.com/questions/41753104/how-do-you-use-webmessageport-as-an-alternative-to-addjavascriptinterface

or its github source:

https://github.com/commonsguy/cw-omnibus/tree/master/WebKit/SensorPort

It works fine with normal html+js pages but I decided to do the same with a 
qt/qml app compiled as webassembly. Seems to work till the point when the 
EM_ASM block gets called where the global (window) onmessage function gets 
registered:

EM_ASM(
  var port;
  onmessage=function(e){
port=e.port[0]
  }
);

That onmessage gets called from java via webview postWebMessage(...) fine 
but it seems that the parameter that is passed into postWebMessage(...) 
goes through a JSON.parse and what I get in the incoming 'e' event is just 
an:

{isTrusted: true} 

So the function fails with not being able to access property 0 of undefined.

Does anyone know why the event object does not arrive as expected?

Thanks,
r0ller

-- 
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, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/18da617f-7334-4aa4-87a6-01c359f5781cn%40googlegroups.com.


Re: .emscripten config not picked up

2020-08-28 Thread r0l...@freemail.hu
Already posted a few times but all of them gets deleted automatically. 
Testing if this one will remain...

s...@google.com a következőt írta (2020. augusztus 27., csütörtök, 21:23:05 
UTC+2):

> This is because emsdk doesn't read the config file at all, it only writes 
> it during `activate`.
>
> I think that is doing on is that emsdk is not aware that you have 
> installed binaryen or llvm so it doesn't think those tool are part of the 
> config. Tools have to be "activate"d before emsdk will consider them part 
> of the config I believe.
>
> If you are building your own tools and writing your own `.emscripten` file 
> I suggest you put the config file in the `emscripten` directory itself.
> This is the first place emscripten will look for the config file (alongside 
> emcc).
>
> Then you should be able to simply add the emscripten directory to your 
> PATH and avoid emsdk_env completely. (since you are not really using the 
> emsdk at this point).
>
> Should we look into the reasons why "it unfortunately cannot be built from 
> source"?  Is it a netbsd specific thing?   
>
> cheers,
> sam
>
>
>
> On Wed, Aug 26, 2020 at 8:55 AM r0l...@freemail.hu  
> wrote:
>
>>
>> Hi All,
>>
>> I've just installed and activated emsdk 1.39.8 on my NetBSD box and as it 
>> unfortunately cannot be built from source I built binaryen and fastcomp 
>> separately so that I can simply set up my .emscripten config so that 
>> LLVM_ROOT and BINARYEN_ROOT point to those directories. So the relevant 
>> paths look like this in emsdk/.emscripten:
>>
>> LLVM_ROOT = '/home/r0ller/fastcomp/emscripten-fastcomp/build'
>> BINARYEN_ROOT = ' /home/r0ller/binaryen'
>> EMSCRIPTEN_ROOT = emsdk_path + '/upstream/emscripten'
>>
>> However, no matter what I set up for LLVM_ROOT or BINARYEN_ROOT (paths 
>> ending in /bin or not as above), when issuing 'source emsdk_env.sh', it 
>> spits out only one environment variable that gets set up:
>>
>> EMSDK = /home/r0ller/emsdk
>>
>> What am I doing wrong? By the way, is there any way to build 1.39.8 from 
>> source like certain tagged versions?
>>
>> Thanks,
>> r0ller
>>
>> -- 
>> 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, send an 
>> email to emscripten-disc...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/emscripten-discuss/c5e813b3-37f7-4b30-9bd0-9e4fbac1cdecn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/emscripten-discuss/c5e813b3-37f7-4b30-9bd0-9e4fbac1cdecn%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/9e2709fb-01da-4682-b529-484a6c7c7bb1n%40googlegroups.com.


Re: .emscripten config not picked up

2020-08-28 Thread r0l...@freemail.hu
Hi Sam,

Thanks for the explanation. Actually, that's what I concluded myself so I 
just wrote my own .emscripten config (LLVM_ROOT path above was actually not 
correct as I had to point it to the directory where the package manager 
installed llvm) and copied it to my home and to the emsdk directory as well 
which kicked the whole stuff in but as you mentioned I don't need to use 
emsdk_env.sh at all. Now even my QtCreator recognises emscripten and can 
compile qt programs to wasm :)

Concerning source compilation of emscripten on netbsd: it's definitely 
easier to install emscripten that way since one does not need to build 
binaryen (or fastcomp) separately. So usually I use emscripten versions 
which emsdk can install from source but now I wanted to use it with Qt 
which is bound to a certain version e.g. qt5.15 is bound to emscripten 
1.39.8, see:

https://doc.qt.io/qt-5/wasm.html

However, 1.39.8 cannot be installed from source via emsdk so that's where 
my whole story began... Though it worked out in the end fine, it would have 
been easier to simply issue an emsdk install command instead of cloning and 
compiling binaryen separately. Nevertheless, most stuff can be installed 
via the netbsd package manager like llvm, lld, node, etc. so it was only 
binaryen that added an extra turn to the screw.

Thanks again for your answer!

Best regards,
r0ller
s...@google.com a következőt írta (2020. augusztus 27., csütörtök, 21:23:05 
UTC+2):

> This is because emsdk doesn't read the config file at all, it only writes 
> it during `activate`.
>
> I think that is doing on is that emsdk is not aware that you have 
> installed binaryen or llvm so it doesn't think those tool are part of the 
> config. Tools have to be "activate"d before emsdk will consider them part 
> of the config I believe.
>
> If you are building your own tools and writing your own `.emscripten` file 
> I suggest you put the config file in the `emscripten` directory itself.
> This is the first place emscripten will look for the config file (alongside 
> emcc).
>
> Then you should be able to simply add the emscripten directory to your 
> PATH and avoid emsdk_env completely. (since you are not really using the 
> emsdk at this point).
>
> Should we look into the reasons why "it unfortunately cannot be built from 
> source"?  Is it a netbsd specific thing?   
>
> cheers,
> sam
>
>
>
> On Wed, Aug 26, 2020 at 8:55 AM r0l...@freemail.hu  
> wrote:
>
>>
>> Hi All,
>>
>> I've just installed and activated emsdk 1.39.8 on my NetBSD box and as it 
>> unfortunately cannot be built from source I built binaryen and fastcomp 
>> separately so that I can simply set up my .emscripten config so that 
>> LLVM_ROOT and BINARYEN_ROOT point to those directories. So the relevant 
>> paths look like this in emsdk/.emscripten:
>>
>> LLVM_ROOT = '/home/r0ller/fastcomp/emscripten-fastcomp/build'
>> BINARYEN_ROOT = ' /home/r0ller/binaryen'
>> EMSCRIPTEN_ROOT = emsdk_path + '/upstream/emscripten'
>>
>> However, no matter what I set up for LLVM_ROOT or BINARYEN_ROOT (paths 
>> ending in /bin or not as above), when issuing 'source emsdk_env.sh', it 
>> spits out only one environment variable that gets set up:
>>
>> EMSDK = /home/r0ller/emsdk
>>
>> What am I doing wrong? By the way, is there any way to build 1.39.8 from 
>> source like certain tagged versions?
>>
>> Thanks,
>> r0ller
>>
>> -- 
>> 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, send an 
>> email to emscripten-disc...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/emscripten-discuss/c5e813b3-37f7-4b30-9bd0-9e4fbac1cdecn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/emscripten-discuss/c5e813b3-37f7-4b30-9bd0-9e4fbac1cdecn%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/fb0f4607-a889-4288-a157-083f34863a11n%40googlegroups.com.


Re: .emscripten config not picked up

2020-08-28 Thread r0l...@freemail.hu
I realized in the meantime that LLVM_ROOT was not set correctly as it 
should point to the package bin directory of llvm but it does not help as 
the config file is simply ignored. So I decided to create my own script 
that sets the environment variables via exports and that worked out.

r0l...@freemail.hu a következőt írta (2020. augusztus 26., szerda, 17:55:49 
UTC+2):

>
> Hi All,
>
> I've just installed and activated emsdk 1.39.8 on my NetBSD box and as it 
> unfortunately cannot be built from source I built binaryen and fastcomp 
> separately so that I can simply set up my .emscripten config so that 
> LLVM_ROOT and BINARYEN_ROOT point to those directories. So the relevant 
> paths look like this in emsdk/.emscripten:
>
> LLVM_ROOT = '/home/r0ller/fastcomp/emscripten-fastcomp/build'
> BINARYEN_ROOT = ' /home/r0ller/binaryen'
> EMSCRIPTEN_ROOT = emsdk_path + '/upstream/emscripten'
>
> However, no matter what I set up for LLVM_ROOT or BINARYEN_ROOT (paths 
> ending in /bin or not as above), when issuing 'source emsdk_env.sh', it 
> spits out only one environment variable that gets set up:
>
> EMSDK = /home/r0ller/emsdk
>
> What am I doing wrong? By the way, is there any way to build 1.39.8 from 
> source like certain tagged versions?
>
> Thanks,
> r0ller
>

-- 
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, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/7952b879-7806-4b17-ac9f-e517500b7506n%40googlegroups.com.


.emscripten config not picked up

2020-08-26 Thread r0l...@freemail.hu

Hi All,

I've just installed and activated emsdk 1.39.8 on my NetBSD box and as it 
unfortunately cannot be built from source I built binaryen and fastcomp 
separately so that I can simply set up my .emscripten config so that 
LLVM_ROOT and BINARYEN_ROOT point to those directories. So the relevant 
paths look like this in emsdk/.emscripten:

LLVM_ROOT = '/home/r0ller/fastcomp/emscripten-fastcomp/build'
BINARYEN_ROOT = ' /home/r0ller/binaryen'
EMSCRIPTEN_ROOT = emsdk_path + '/upstream/emscripten'

However, no matter what I set up for LLVM_ROOT or BINARYEN_ROOT (paths 
ending in /bin or not as above), when issuing 'source emsdk_env.sh', it 
spits out only one environment variable that gets set up:

EMSDK = /home/r0ller/emsdk

What am I doing wrong? By the way, is there any way to build 1.39.8 from 
source like certain tagged versions?

Thanks,
r0ller

-- 
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, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/c5e813b3-37f7-4b30-9bd0-9e4fbac1cdecn%40googlegroups.com.


how to disable binaryen in .emscripten config file

2020-08-26 Thread r0l...@freemail.hu

Hi All,

I'm trying to crosscompile qt5 (5.15) with emscripten and they require 
emscripten 1.39.8 with fastcomp backend. However, that version cannot be 
built from source (which is a pity since prebuilt linux binary won't work 
on my NetBSD box). So I built fastcomp manually and pointed LLVM_ROOT to 
it. It works fine until qt stops during crosscompiling and I can see from 
the config.log that it's missing stuff from binaryen (like wasm-opt) which 
I guess is due to the fact that it compiles with WASM=1. Indeed, in the 
.emscripten config file BINARYEN_ROOT is also set since 1.39.8 is not 
fastcomp specific.

So is it possible to set an environment variable in .emscripten that 
disables binaryen and results as if my emscripten installation has only 
fastcomp backend?

Thanks,
r0ller

-- 
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, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/ad6b5d54-8a6c-4a0e-a8df-321d19c5a33an%40googlegroups.com.