Installing Lazurus on a Raspberry Pi 3

I recently got back to playing around in my home workshop again.  I pulled my Raspberry Pi 3 out of the box and out of the bag — never touched up until this point.

I decided I would use it as my “computer” for in the workshop as it seems to get the job done as well as one would hope, without taking up much space.  So as part of the setup, I looked around for an IDE that I could setup and use for some of my development.

I won’t say I’m completely sold on Delphi/Pascal.  I haven’t written a single line of Pascal code in the 20+ years I’ve been in this business, but I digress…

I was excited to find a newly updated tutorial for setting up Lazurus on the RPi @ http://michellcomputing.co.uk/blog/2016/11/raspberry-pi-lazarus-revisited/

The tutorial is very, very good and I give credit to Paul Michell.  I believe I was tripped up because I used some of Paul’s pre-compiled options instead of going through the entire step-by-step from the start.

When I got to the final step, Building Lazarus, I would get some errors in the compilation.  They looked like:

/usr/bin/ld: cannot find -lgdk-x11-2.0
/usr/bin/ld: cannot find -lX11
/usr/bin/ld: cannot find -lgdk_pixbuf-2.0
/usr/bin/ld: cannot find -lgtk-x11-2.0
/usr/bin/ld: cannot find -lgobject-2.0
/usr/bin/ld: cannot find -lglib-2.0
/usr/bin/ld: cannot find -lgthread-2.0
/usr/bin/ld: cannot find -lgmodule-2.0
/usr/bin/ld: cannot find -lpango-1.0
/usr/bin/ld: cannot find -lcairo
/usr/bin/ld: cannot find -latk-1.0

So I set out to install the dependencies that weren’t being met.  My first stab at installing a few packages proved to show progress.  I did the following:

sudo apt-get install gir1.2-atk-1.0
sudo apt-get install libpango-1.0-0
sudo apt-get install libcairo2
sudo apt-get install mingw32-binutils
sudo apt-get install libg3d-plugin-gdkpixbuf

But even after this, I still showed four libraries not able to be loaded by the linker.

/usr/bin/ld: cannot find -lgdk-x11-2.0
/usr/bin/ld: cannot find -lgtk-x11-2.0
/usr/bin/ld: cannot find -lpango-1.0
/usr/bin/ld: cannot find -latk-1.0

Oddly, pango, a package I installed, was still showing as missing.  After some poking around, I discovered that all four missing libraries were actually present on the system.  I just needed to make a generic link so the shared object instead since the system only has physical files that had a .0 extension appended.

So the final steps were:

sudo ln -s /usr/lib/arm-linux-gnueabihf/libgdk-x11-2.0.so.0 /usr/lib/arm-linux-gnueabihf/libgdk-x11-2.0.so
sudo ln -s /usr/lib/arm-linux-gnueabihf/libatk-1.0.so.0 /usr/lib/arm-linux-gnueabihf/libatk-1.0.so
sudo ln -s /usr/lib/arm-linux-gnueabihf/libgtk-x11-2.0.so.0 /usr/lib/arm-linux-gnueabihf/libgtk-x11-2.0.so
sudo ln -s /usr/lib/arm-linux-gnueabihf/libpango-1.0.so.0 /usr/lib/arm-linux-gnueabihf/libpango-1.0.so

NOTE:  I didn’t actually start keeping track of my commands until I was quite a ways through this.  I had to look through my shell history and try piecing things together.  If you find that another command was necessary, please comment and I will update this.

After this, the compilation succeeded and I’m ready to rock! Things look intriguing.  It reminds me of yesteryear when I was firing up the VB3 IDE for the first time.

Hope this helps anyone having trouble getting to the finish line with Lazarus on the Raspberry Pi 3.

December 9th, 2016 by