wavedrom / cli

CLI for WaveDrom
https://wavedrom.com
MIT License
61 stars 12 forks source link

Error when trying to run `wavedrom` CLI #11

Closed kaushalmodi closed 5 years ago

kaushalmodi commented 5 years ago

Hello,

I ended up discovering this CLI form of wavedrom from this issue: https://github.com/wavedrom/wavedrom/issues/161.

I did npm i -g wavedrom-cli --save-dev and it installed fine.

My npm version is 6.1.0.

When I typed just wavedrom, I got this error:

/home/kmodi/stowed/bin/wavedrom: line 1: /adlib: is a directory
/home/kmodi/stowed/bin/wavedrom: line 2: use strict: command not found
/home/kmodi/stowed/bin/wavedrom: line 4: syntax error near unexpected token `('
/home/kmodi/stowed/bin/wavedrom: line 4: `var fs = require('fs'),'`

Typing wavedrom -h, wavedrom --help gave the same error.

drom commented 5 years ago

Please try v2.0.0

kaushalmodi commented 5 years ago

I just updated.. now I cannot use wavedrom-cli at all :(

I am on RHEL 6.8 (glibc v2.12), and wavedrom-cli depends on 2.14.

module.js:681
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /home/kmodi/stow/pkgs/node/8.11.1/lib/node_modules/wavedrom-cli/node_modules/canvas/build/Release/canvas.node)
    at Object.Module._extensions..node (module.js:681:18)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/kmodi/stow/pkgs/node/8.11.1/lib/node_modules/wavedrom-cli/node_modules/canvas/lib/bindings.js:3:18)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)

Is it possible to reduce the glibc dependency?

drom commented 5 years ago

Oh. great. I depend on this package: https://github.com/Automattic/node-canvas They seem to have troubles with RHEL6,7 and you have to recompile canvas:

https://github.com/Automattic/node-canvas/wiki/Installation%3A-Fedora-and-other-RPM-based-distributions

could you try:

npm i wavedrom-cli --build-from-source=canvas
kaushalmodi commented 5 years ago

I tried:

npm i -g wavedrom-cli --save-dev --build-from-source=canvas

It's failing with:

../src/Image.h:18:10: fatal error: gif_lib.h: No such file or directory
   18 | #include <gif_lib.h>
      |          ^~~~~~~~~~~
compilation terminated.

I know that this is out of wavedrom territory, so will close this issue now.

drom commented 5 years ago
sudo yum install gcc-c++ cairo-devel libjpeg-turbo-devel pango-devel giflib-devel
drom commented 5 years ago

Let me know if you are able to solve it. I am really interested in making wavedrom-cli run in RHEL6

kaushalmodi commented 5 years ago

@drom I don't have sudo access on this machine. I do have giflib installed (It's used by my emacs installation). I am not familiar with node toolchain.. so not sure how to specify the LDFLAGS and CPPFLAGS like I do in C based projects.

drom commented 5 years ago

Do you need PNGs or SVGs are fine? Canvas required only for the generation of PNGs. I can try loading Canvas only when the user asks for PNGs.

kaushalmodi commented 5 years ago

Ooh! SVG are great! I actually prefer SVG over PNG because I don't like pixelated images :)

kaushalmodi commented 5 years ago

I can try loading Canvas only when the user asks for PNGs.

:+1:

drom commented 5 years ago

please try wavedrom-cli v2.1.0

kaushalmodi commented 5 years ago

Now this works!

wavedrom-cli -i input.json -s output.svg

image

🎉

Thank you!!

kaushalmodi commented 5 years ago

Minor note.. if I do wavedrom-cli -i input.json, nothing happens (may be it should error out or create input.svg by default?)

drom commented 5 years ago

Will STDOUT printing out SVG be good?

kaushalmodi commented 5 years ago

Yes, that will be nice.. then I could do wavedrom-cli input.json > output.svg.

drom commented 5 years ago

Try v2.1.1

kaushalmodi commented 5 years ago

Thank you for the prompt turn arounds. I'm away from the computer now. I'll try out the update the first thing tomorrow.

kaushalmodi commented 5 years ago

@drom I confirm the update in v2.1.1. Thanks again.