darrylb123 / usbrelay

Control usb relay - based on hidapi
GNU General Public License v2.0
315 stars 98 forks source link

Compile Error #85

Closed ilikemyfto closed 2 years ago

ilikemyfto commented 2 years ago

Hi I started playing with a spare Raspberry Pi and a USBrelay from eBay, I've loaded this software before but I can't get it to compile now. I get this error after trying to compile this this command gcc -o usbrelay usbrelay.c -lhidapi-hidraw:-

usbrelay.c:31:10: fatal error: gitversion.h: No such file or directory 31 | #include "gitversion.h" | ^~~~~~

This is the build recipe I was given by a friend a few years ago, which used to work:- Plug in USB relay Boot Raspberry Pi Check that USB Relay is recognised lsusb Check logs for device name dmesg Change to home directory cd .. Make directorys mkdir usbrelay mkdir hidapi Change into usbrelay directory cd usbrelay Download usbrelay from github git init git clone https://github.com/darrylb123/usbrelay.git Go up a directory cd .. Change to hidapi directory cd hidapi Download hidapi and the extra libraries git init git clone https://github.com/signal11/hidapi.git sudo apt-get install libudev-dev libusb-1.0-0-dev libfox-1.6-dev autotools-dev autoconf automake libtool cd hidapi ./bootstrap ./configure make sudo make install Fix any errors missing libs do – sudo apt-get install .sh files not able to execute, set execute bit - chmod 777 bootstrap Return to home directory cd .. Compile usbrelay cd usbrelay cd usbrelay gcc -o usbrelay usbrelay.c -lhidapi-hidraw Fix any errors Check to see if usbrelay runs sudo ./usbrelay

I have also loaded git version 2.30.2 and my details are shown when I type git config --list

And yes I know the usbrelay program is in the Raspberry Pi "Add/Remove Software" but I've got the feeling that this issue will affect any other project I try to load from GITHUB.

Please can anyone help?

wentasah commented 2 years ago

Just running make should work. See https://github.com/darrylb123/usbrelay#building-the-code.

ilikemyfto commented 2 years ago

Thank you wentasah, it works ok now 👍 :-)