dangrie158 / opencushion

A c++ driver and a node binding for the HX711 Load Cell Amp
MIT License
14 stars 17 forks source link

hx711.node: undefined symbol: wiringPiSetup #5

Open carlberg74 opened 6 years ago

carlberg74 commented 6 years ago

Hi,

Found your nodejs lib for hx711, but I keep getting error: missing symbol. (I am new at nodejs) node: symbol lookup error: /home/ubuntu/test-nodejs/node_modules/hx711/build/Release/hx711.node: undefined symbol: wiringPiSetup

Get this when running code below:

var hx711 = require('hx711'); const SCLK = 5; const DATA = 6; var sensor = hx711(SCLK, DATA); << error.

Found the wiringPi/wiringPi/wiringPi.h in the src of wiringPi from git, and it seem to contain wiringPiSetup etc, but I don't know where to put it..or how to fix this.

Please advice.

Cheers

dangrie158 commented 6 years ago

Hi,

wiringPi is a dependency of the driver. For installation instructions visit: http://wiringpi.com/download-and-install/

carlberg74 commented 6 years ago

Yes, I have installed wiringPi, gpio -v works and I can even use the WiringPi-Node lib with node without getting any runtime error. I installed this node hx711 lib using: npm install hx711 --save, is there something missing in the package?

dangrie158 commented 6 years ago

Hi, how did you install wiringPi? Check if you have a libWiringPi in your LD_LIBRARY_PATH or modify the binding.gyp file to reference the .so object using an absolute path and recompile the library.

Hope this helps.

carlberg74 commented 6 years ago

I solved it using the binding.gyp adding "libraries": [ "/usr/local/lib/libwiringPi.so" ] comment out -ldflags and then ran node-gyp build..

Maybe it also worked if I just set the LD_LIBRARY_PATH and then ran node.gyb build... i don't know.

thanks.

dangrie158 commented 6 years ago

Thanks for letting me know.

Would be great if you could make a pull request as it seems that this is the more compatible way of doing things. Otherwise it would be great if you could just post your updated gyp file so I can edit it in.

Thanks Daniel