-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the best way to use this on a system with node install but not rust #35
Comments
I'd like to do something similar and create an extension for Python Markdown, which would simply spawn svgbob in a subprocess. I think the easiest thing to do would be to package the binaries together with the python distribution. If those were available to download for the various platforms then I could use those. Alternatively I might look into cross compilation. In the meantime I'll just try and work with my local file |
I took a short look at cross compiling, but I'm really new to the rust ecosystem and feel like I'm wasting my time. If there are any Rustaceans out there who already know how to produce static binaries for these targets, I would greatly appreciate some pointers.
|
@mbarkhau I'm not sure how are you installing svgbob. Right now, you can easily install svgbob using cargo. If you are using a linux machine, the |
@ivanceras I did |
Apart from libc and possibly some other system libraries all executables created hy rustc don't link to any library. Because of this it is enough to copy executables to another machine to be able to run them. If you want to create a completely statically linked executable you can compile for |
That's good to know. |
I was able to cross compile for windows at least. I initially ran $ cd svgbob/;
$ docker run --userns host \
--rm \
--user 1000:1000 \
-e CARGO_HOME=/cargo \
-e CARGO_TARGET_DIR=/target \
-e USER=$USER \
-e XARGO_HOME=/xargo \
-v $HOME/.xargo:/xargo \
-v $HOME/.cargo:/cargo \
-v $PWD/svgbob:/svgbob:ro \
-v $PWD/svgbob_cli:/svgbob_cli:ro \
-v $HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/rust:ro \
-v $PWD/svgbob_cli/target:/target \
-w /svgbob_cli \
-it japaric/x86_64-pc-windows-gnu:v0.1.14 \
sh -c 'PATH=$PATH:/rust/bin "cargo" "build" "--target" "x86_64-pc-windows-gnu" "--release" "--verbose"' Output from wine
|
I think I have a binary for At least superficially it seems to be the right stuff
|
Binaries are available here if anybody is brave enough to try: https://gitlab.com/mbarkhau/markdown-svgbob/tree/master/src/markdown_svgbob/bin |
I was able to start a MacOS VM and indeed the Darwin binary appears to work. |
Here's the package markdown-svgbob on pypi. This library uses the "Solution 1" approach suggested by @tychota. |
FYI, in Foremark, I successfully took Solution 2 to render diagrams on web browsers (example). It works by compiling a facade crate (which is linked to Svgbob) into WebAssembly and hooking things up using When the host application runs in a JavaScript environment, it seems like the most seamless, streamlined option because WebAssembly is architecture/platform-independent and doesn’t require IPC and subprocess management. It could be made into a single, standalone NPM package like they did with |
@mbarkhau thanks for the binary releases you provide in your repo. @ivanceras It would be great and highly appreciated, if you could provide statically linked release binaries for the common platforms (e.g. linux, windows, macos). |
Since this issue was opened, I think the situation with GitHub actions has become much better. I'm sure a PR would be welcome. |
https://github.com/agoose77/svgbob-wasm has make wasm api for javascript, It can be embedded in any web page. |
Context
I'm building my blog on netlify. Netlify have no support of Rust yet.
Blog example: https://blog.tycoach.me/breaking-the-circular-deps-1
Compared the ugly looking diagram to my local version:
For sure, I will try to persuade netlify to support rust so i can cargo install, or at least let me use my own docker image for build. Else i can migrate from netlify to something else.
(As an hack i just extracted the svg from the diagram: tychota/blog@7b40f1c)
That being said, increasing the reach by supporting Node env seems an ok concern for me.
If not, please close the issue.
Ideas
Solution 1: svgbob on npm as childprocess
x86_64-unknown-linux-musl
and launch child processQuestion:
Solution 2: svgbob on npm as webassembly
Given rust awesome of webassembly, maybe it is possible to build svgbob as webassembly
Question:
The text was updated successfully, but these errors were encountered: