An update on libpigpio

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:

  1. Download the zip file from here.
  2. Copy the zip file to the Raspberry Pi and extract the files to a folder
  3. Open a terminal window and use the 'cd' command to change directory to where you extracted the files
  4. Now type these commands (press enter after each line):
    gcc -c -fpic libpigpio.c
    gcc -shared -o libpigpio.o
    sudo cp /lib
  5. That will have compiled and installed the library into /lib
  6. I have also included a test program which you could try, like this...
  7. In the same terminal window enter these commands
    (note the spelling of -lpigpio is important):
    gcc -Wall -o test main.c -lpigpio
    sudo ./test
  8. 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...

Comments are closed