Lile .wasm static lib
I noticed, it is possible to compile to wasm Compiling mgclient for wasm requires the Emscripten sdk. This is automated in the following steps:
mkdir build && cd build cmake .. -DWASM=ON make
Is it possible to do same but create a static lib. By the same I mean without OpenSsl. Per my understanding wasm target means absence OpenSsl
I'm not sure. Tried to built mgconsole by statically linking everything under https://github.com/memgraph/mgconsole/pull/56, but failed because statically linking OpenSSL and its deps was hard (I quit at a certain point because of time, not sure if it's even possible)...
Could you explain what's your end goal? Because mgclient depends on OpenSSL to offer encrypted communication, "trivial" solution (in quotes because that's some amount of work) would be to totally get rid of OpenSSL dependency at compile time. At that point, OpenSSL wouldn't be a concern at all.
Long questions short:
- Do you need encrypted communication at all?
- If you do, what alternatives do you have in mind?
Hi @gitbuda, I want to call it from CloudFlare worker. We are using Rust for this. I checked rsmgclient, which also are bindings for C lib. And this rust client doesn't support wasm target. I tried to use wasm compiled version, but Cloud Flare blocks thirdparty .wasm. Then for me is only way to have statically compiled C library and create Rust Bindings by my own. I see there are projects, calling .wasm from js: https://github.com/memgraph/jsmgclient Also it is possible to compile directly into .wasm I tried to build static lib from *.c.o files and from wasm, which have been produced by wasm compilation, but also fails. Decided to ask for any way to do it.
Is server-client encryption needed (I guess yes)?
But in any case, this is helpful, I can also try to make the client code work from the CloudFlare worker in Rust 🦀 🔨 I'll give it a try in the following days 💪
In the meantime, maybe one of the native Neo4j drivers works in the CloudFlare context (Memgraph is almost 100% compatible because of the compatibility with the underlying Bolt protocol, if you make one of these drivers work under CloudFlare, it's 99.99% you will be able to connect to Memgraph 🤔 👀
I'm randomly doing some other work on pymgclient (the python client) and HERE we are actually statically linking openssl 👀 -> that should also be possible here 🤔
PR to follow https://github.com/memgraph/rsmgclient/pull/56 (nothing yet works)
@aviplayer quick update and more questions.
I haven't managed to make much progress under https://github.com/memgraph/rsmgclient/pull/56 because a basic CloudFlare project/template for some reason doesn't work... I'll try to investigate (but not an expert with CF workers + wasm -> it might take time...)
On the other hand, I've managed to statically link OpenSSL under https://github.com/memgraph/rsmgclient/pull/57 (it's just an example, I plan to add a proper compile-time option). So, this might be close to enable "Then for me is only way to have statically compiled C library and create Rust Bindings by my own."?
- dynamic
- static
I suggest we jump on max 30mins call to deep dive into options? If that makes sense, please pick a time under https://calendar.app.google/EPGybdXCiF8Uc86K8. I'm also open for an "on-line" hackathon to make this work 👀💪