Posts: 74
Joined: Fri Dec 13, 2013 4:18 am

Re: free pascal / lazarus

Fri Dec 13, 2013 5:36 am


In my environment, an error always occurs at a start up of TOpenglControl.
Is anyone using OpenGL component ?

OpenglControl always rise a error "gdk_gl_context_share_new no visual found".
Error position is
File: GLGtkGlxContext.pas
Line: 471
Function: gdk_gl_context_share_new()

Version info
Lazarus: 1.0.6
FPC: 2.6.0
SVN: 40725

Since lazopenglcontext.lpk is missing in Lazarus( of rasbian repository,
it must be downloaded from github or others.

Posts: 214
Joined: Sun Nov 20, 2011 5:43 pm

Re: free pascal / lazarus

Wed Jan 29, 2014 11:47 pm

Hello Everyone,
I started working on a pi io unit ages ago and never really got round to finishing it off properly because I got distracted by other projects. Anyway I have decided to publish what I have done so far with GPIO on the pi as it may be of some help to other people. The program and pi_IOII unit access the hardware directly so there is no need for external libraries written in c. However remember to run all programs as root otherwise you will get exceptions.


you can download the source and the example program here.


download lazgpio.zip

The example program runs a few GertBoard demo programs in lazarus.

There is currently a button pushing demo program.
An LED strobing program.
A brushed motor controlling program using true pulse width modulation.

The other news I have is that I have got lazarus version 1.0.14 working on Jessie
I can access serial ports using 5dpo after it has been tweaked slightly to run on the pi.

I am sorry it has taken me so long to get round to publishing this code. I had hoped to create a an IO component suite, but I haven't got round to it yet, it's all a question of free time something I seem to be very short on these days.

Best Regards,

Jack Taylor aka zog.

Posts: 497
Joined: Wed Jun 27, 2012 2:29 pm

Re: free pascal / lazarus

Thu Jan 30, 2014 3:48 pm

Many thanks and congratulations. My having been away from regular active use of Raspi for development for over a year, meantime using such things as rikomagic's excellent MK802IV for Android and Windows7 for Lazarus, I needed a bit of a spur to try to bring my Raspis more up-to-date, and begin again. Your timely posting and work have done that.
If discrimination is not challenged then we are effectively in collusion with the perpetrators of such behaviour:-Oxford dictionaries

Posts: 214
Joined: Sun Nov 20, 2011 5:43 pm

Re: free pascal / lazarus

Sat Feb 01, 2014 10:59 pm

There is a mistake in the documentation on my web site. I put that I don't detect board revision numbers, when in fact I do. I will change my website.
Has anyone had a go at using the pi_IOII unit yet ?

Thanks for the positive comments Feverish. :D

Posts: 16
Joined: Thu Jun 06, 2013 11:42 pm

Re: free pascal / lazarus

Tue Apr 08, 2014 1:36 am


Zog - I have just got round to using FPC/Lazarus.

I used Turbo Pascal many moons ago - even had version 1 and probably still do have it somewhere, also dabbled with the ealy versions of Delpi before moving to VB.

I installed via apt-get FPC and Lazarus and I wrote a couple of small(ish) programs and was delighted with the results even though the compiles were a bit slow.

I then came across this post and decided to update to 1.06 from 0.9. Installed new Raspbian wheezy and did apt-get to install FPC. Then started your process to install 1.06 but got a fail stating that the dependency of fpc 2.0.6-7 was not met but that it did find fpc 2.0.6-9. I have looked for fpc 2.0.6-7 but cannot find it. Is it possible for me to modify your deb file (via hex editor maybe) to take this into account, or do I have to take the more difficult route that you and others have followed.


Posts: 214
Joined: Sun Nov 20, 2011 5:43 pm

Re: free pascal / lazarus

Tue Apr 08, 2014 7:01 am

It looks like a version of fpc is being shipped with a greater version number than the one than the one my package depends on, meaning that for the current raspian distro the package has been broken if that the one your using. I did definitely work under wheezy if that's the distro your using, if fpc has been updated under wheezy then it has broken my distro. I have not used the installer for a bit as I am using Lazarus version 1.14 with fpc 2.6.2 under Jessie. Thanks for bringing the problem to my attention. Has any one else had this problem recently ?
Unfortunately I have lost the SD card with the original source for the delphi package I built, so I would have to start from scratch to rebuild it to fix the problem, unless I can find it.


Posts: 174
Joined: Wed Mar 06, 2013 11:28 am

Re: free pascal / lazarus

Sat Apr 19, 2014 12:59 pm

If you want, I can also do weekly Lazarus builds from trunk.
At least 16 people are regularly using my trunk builds for fpc 2.7.1. Encouraging.

Posts: 214
Joined: Sun Nov 20, 2011 5:43 pm

Re: free pascal / lazarus

Sun Apr 20, 2014 7:13 pm

I have uploaded the fixed lazrpi.deb package to my skydrive account ( now called onedrive ). The package is identical to the last one except that I have set that the dependeny for fpc must be >= to version fpc 2.0.6-7. It should now work - sorry I took a long time to getting round to sorting this out. The easy installer package should now work again on wheezy. I have found the sd card with my source code on it so I am thinking of making a new package for jessie.

Jack Taylor ( aka zog )

Posts: 16
Joined: Thu Jun 06, 2013 11:42 pm

Re: free pascal / lazarus

Wed Apr 23, 2014 8:36 pm


Thanks for the update have now got v106 installed and have installed Inet so now I can get on with my project.
Tried jessie but had no luck with lnet, has anyone managed to get that combination to work?


Posts: 16
Joined: Sun Aug 21, 2016 7:44 pm

Re: free pascal / lazarus

Fri Aug 10, 2018 3:34 am

9 Aug 2018... a simple...

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install fpc
sudo apt-get install lazarus

... was all I needed to get a usable Lazarus 1.6.2 up and running on my RPi 3 b, with 16G SD card, Raspbian 9. An entry to launch Lazarus just appeared in the Programming category from the main menu.

Mastering accessing the GPIO has been... "interesting". The code sample for "Native Hardware Access", turn LED on and off, within http://wiki.freepascal.org/Lazarus_on_R ... are_access very nearly worked for me. All I had to do to get them to work was to add a sleep(1000); in the FormActivate code, just after the...

Code: Select all

    gReturnCode := fpwrite(fileDesc, PIN_17[0], 2);
Apparently, the

fileDesc := fpopen('/sys/class/gpio ... 17[0], 2);

... sets things up for working with pin 17.... and you have to cause a moment to pass, so set up can be completed, before USING what that code sets up. There may well be similar bits in the other code examples, e.g. the code to READ a pin.
New to Pi and Linux generally... old to computers. Using Raspbian 9 (Stretch) on a Pi 3 B (ver 1.2), apt-get update, apt-get upgrade at least as recently as 5 Aug 2018

Posts: 214
Joined: Sun Nov 20, 2011 5:43 pm

Re: free pascal / lazarus

Fri Aug 10, 2018 5:38 am

Hi this is a very old thread. The official repos are now the best way to install lazarus. There are gpio libraries available for fpc and lazarus for the rpi. I wrote a gpio library for lazarus but I haven't updated it for rpi3. If you want to do bare meta programming in pascal you might want to look at the Ultibo project as well.

Return to “Other programming languages”