Installing/uninstalling local graphviz with application

Hello,

I am interested in shipping graphviz as part of an Electron app installation targeting Windows, MacOS and Linux. The requirements are:

  • Install/uninstall independently of any other graphviz installations.
  • Run programmatically from the Electron app.

I was hoping to simply put all executables and libraries in a single folder (different for each OS) but I’m not having success. Running ./dot results in this message:

-rwxrwx--- 1 xyz xyz 33968 Oct  1 03:33 dot
xyz@graphviz:~/graphviz$ ./dot
./dot: error while loading shared libraries: libgvc.so.6: cannot open shared object file: No such file or directory
xyz@graphviz:~/graphviz$ 
borglet9@graphviz:~/graphviz$ ls -al libgvc*
-rwxrwx--- 1 xyz xyz    1091 Oct  1 03:33 libgvc.la
-rwxrwx--- 1 xyz xyz     250 Oct  1 03:33 libgvc.pc
lrwxrwxrwx 1 xyz xyz      15 Oct  3 08:14 libgvc.so -> libgvc.so.6.0.0
lrwxrwxrwx 1 xyz xyz      15 Oct  3 08:14 libgvc.so.6 -> libgvc.so.6.0.0
-rwxrwx--- 1 xyz xyz 2914736 Oct  1 03:33 libgvc.so.6.0.0

I am not a linux expert so not sure why dot can’t find a library that is in the same directory.

Please LMK if this just isn’t possible or what I need to do to make this work.

Thanks!

1 Like

On Linux, the way to do this is with the LD_LIBRARY_PATH environment variable. macOS is the same, but uses DYLD_LIBRARY_PATH instead.

Alternatively (and maybe cleaner), you can build a statically linked version of dot and then no shared libraries need to be looked up at runtime.

Awesome - thanks!

If its an Electron app, you might find it easier to simply use a JavaScript/Wasm version?

This is the one I maintain: @hpcc-js/wasm - npm (npmjs.com)

2 Likes

This is looking very promising! Thank you!

Thanks very much for putting that out there. It is working beautifully and will make cross platform distribution so much easier.

Best,

Mark

1 Like