In the last couple of weeks, a few people have said that my libpigpio GPIO shared library for the Raspberry Pi only works if
they recompile it from source, like here for example.
(although a chap called Brendan mentioned it first, thanks Brendan).
So I thought that it was worth making people aware of that. Since I compiled the library on the initial Debian Squeeze
release, there’s probably some difference with other Debian distributions that have come out since.
However, compiling the library from source on your own Raspberry Pi seems to work, so at some point I’ll update the zip file
without the .so file, so that people can just compile their own version. In the meantime, the instructions are as follows:
- Download the zip file from here.
- Copy the zip file to the Raspberry Pi and extract the files to a folder
- Open a terminal window and use the 'cd' command to change directory to where you extracted the files
- Now type these commands (press enter after each line):
gcc -c -fpic libpigpio.c
gcc -shared -o libpigpio.so libpigpio.o
sudo cp libpigpio.so /lib
- That will have compiled and installed the library into /lib
- I have also included a test program which you could try, like this...
- In the same terminal window enter these commands
(note the spelling of -lpigpio is important):
gcc -Wall -o test main.c -lpigpio
- Now the GPIO pins 7 to 11 should be turning on an off
(use CTRL+C when you’re fed up)
I hope that helps...