[proton-c] Seeking feedback on an updated emscripten build

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

[proton-c] Seeking feedback on an updated emscripten build

Roddie Kieley
Hi folks. Recently I had a need for an emscripten build of proton-c and the
existing implementation was a little dusty, so I made a small update for my
needs over at github [1]. In particular it was based on some MIT licensed
work by Andre Weissflog also at github here [2] and here [3], but updated
to work with 'latest' emscripten rather than 'incoming' which you need to
clone and build.

It's been tested mainly on Fedora 25, with some basic testing OS X 10.11.3,
and while I've also run it on Windows and emscripten gets installed in both
cygwin and regular command line environments there's almost certainly work
left to do on Windows in particular.

If you clone [1] you should be able to do something like:

cmake -G "Unix Makefiles" ../qpid-proton

And end up with a functional emscripten javascript cross-compile of just
proton-c, not including the c++ binding. You should be able to test via:

From one shell:

node recv-async.js amqp://

and from another

node send-async.js -a amqp:// 'Message1'

and see something like:

[rkieley@i5t450s messenger]$ PN_TRACE_FRM=1 node recv-async.js amqp://
exit(0) implicitly called by end of main(), but noExitRuntime, so not
exiting the runtime (you can use emscripten_force_exit, if you want to
force a true shutdown)
Address: amqp://
Subject: (no subject)
Content: "Message1"

[rkieley@i5t450s messenger]$

Note that PN_TRACE_FRM=1 doesn't work for me so any ideas there are

Testing utilizes the Qpid Dispatch router with a listener configured with
http: true. I've tested against Dispatch master recently, utilizing
libwebsockets 2.2.0 I think.

I don't quite have a full demo to share unfortunately, however, I do have a
project at [4] that'll run up the send-async and recv-async in the browser
as per [5].

I also have been using it to receive data from the HVAC system in my house
which runs a BACnet protocol over a RS-458 serial link which I've connected
to a Raspberry PI for which you can see the original protocol buffer
payload version here [6] and the straight string version here [7].

Not sure how much use this is in general given the problematic debugging
environment that this presents. However the same CMAKE_TOOLCHAIN_FILE
method can also be used to build for  iOS which I've done recently and in
theory the Android NDK which I have not yet done.

Either way comments and feedback appreciated at this point.

[1] -
[2] -
[3] - https://github.com/floooh/fips/blob/master/mod/emscripten.py
[4] - https://github.com/RoddieKieley/fips-hello-dep-proton
[5] - https://twitter.com/RoddieKieley/status/886409881540071424
[6] - https://twitter.com/RoddieKieley/status/888956458775326720
[7] - https://twitter.com/RoddieKieley/status/891124547549790208
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Re: [proton-c] Seeking feedback on an updated emscripten build

Roddie Kieley
Forgot one important part, before running cmake as mentioned with -DCMAKE_TOOLCHAIN_FILE  you'll want to use the included python setup.py script in the bin directory as per:

[rkieley@i5t450s qpid-proton]$ python bin/setup.py emscripten
script_dir is /home/rkieley/LocalProjects/usx/research/qpid-proton/bin
=== setup emscripten SDK:
downloading 'emsdk-portable.tar.gz'...

That will download and setup the latest emscripten under qpid-proton/sdks which is then referenced by the emscripten.toolchain.cmake file during the build.