free pascal / lazarus


109 posts   Page 1 of 5   1, 2, 3, 4, 5
by zog » Mon Jun 04, 2012 6:48 am
Hi I want to get free Pascal / Lazarus running on the pi. I need to know how to make the free Pascal compiler for an arm processor or get a pre compiled binary. Has any one managed to do this yet ?

Jack
Posts: 96
Joined: Sun Nov 20, 2011 5:43 pm
by HeadCase » Mon Jun 04, 2012 9:02 am
Using the standard debian distribution you can install an older (2.4.0) version of FPC using apt-get.

This works with the old-fashioned "fp" UI which can just be started from a terminal. It works like TurboPascal - which is actually OK once you get used to it. Very retro. FP will also create a nice asm listing with the pascal source embedded in it if you select that option. For someone learning to program, seeing the arm code generated by a for loop could be informative, and if they don't have to learn about make files to do it - even better.

Lazarus can not be installed from the standard repositories for squeeze. It isn't worth bothering with anyway as you need FPC 2.6.0 for proper arm support.

The latest FPC version is 2.6.0 which can be downloaded from here:-

http://sourceforge.net/projects/freepas ... nux/2.6.0/

and follow the instructions and it will install with no problems. This version has better ARM support including VFP for arm6 (although that doesn't seem to work at this stage). FPC 2.6.0 also supports objective pascal - they seem to be keen on moving into the iPAD and Android world.

Hopefully now the RPi is shipping in quantity a few Lazarus developers will get hold of some and get the remaining bugs out. With luck by the time Raspbian is mature it will include FPC 2.6 and Lazarus.

It is surprising how few people know about Lazarus and FPC. I don't think there is anything that can match it for RapidApplicationDevelopment and cross platform development. The Form designer is fantastic for prototyping UI layouts.
Posts: 32
Joined: Sat Sep 03, 2011 8:11 am
by zog » Tue Jun 05, 2012 9:23 pm
Thanks for the reply. I have managed to get a version of the fpc up and running on the pi.
I tried apt-get install fpc first which didn't work.

Then I did apt-get update which updated all the Debian packages then I repeated the apt-get install fpc command again and this time it worked.

However when I ran fp under startx I just ended up with a blank display. Quitting out of xwindows revealed that fp had been outputting its display to the root screen underneath xwindows. This does not happen when fp runs on a standard pc. It is possible to run fp without xwindows however this also presented some problems as fp didn't draw itself correctly if it was run as sudo fp.

I am very keen to adjust the boot screen resolution of the pi as the font is way to small to read comfortably. I don't know how to do this yet, but I think it will solve my fp drawing problems.

Jack
Posts: 96
Joined: Sun Nov 20, 2011 5:43 pm
by pbreneman » Thu Jun 07, 2012 1:13 pm
I already have a number of minimal distributions of Free Pascal that make it *very* easy to try things. See this message:
viewtopic.php?p=93971#p93971
Posts: 13
Joined: Thu Jun 07, 2012 12:31 pm
by zog » Tue Jun 12, 2012 10:08 pm
UPDATE

Thanks to darkbasic I now have Debian wheezy up and running on the pi. I have installed the LXDE desktop, fpc and Lazarus on my pi. This morning I wrote a simple program using Lazarus on the pi which compiled the code some what slowly, but it ran.

This is major progress - I will try to put an image of my disk some where up on my web site when I get chance, work allowing. Also fp works much better under wheezy.

Jack Taylor
Posts: 96
Joined: Sun Nov 20, 2011 5:43 pm
by HeadCase » Wed Jun 13, 2012 12:18 am
zog wrote:UPDATE

Thanks to darkbasic I now have Debian wheezy up and running on the pi. I have installed the LXDE desktop, fpc and Lazarus on my pi. This morning I wrote a simple program using Lazarus on the pi which compiled the code some what slowly, but it ran.

This is major progress - I will try to put an image of my disk some where up on my web site when I get chance, work allowing. Also fp works much better under wheezy.

Jack Taylor



What did you have to do to get it installed?

With the current Raspbian image apt-get install fpc will find and install fpc 2.6.0, however apt-get install lazarus fails due to unmet dependencies and complains about held broken packages.

Which version of lazarus did you install?
Posts: 32
Joined: Sat Sep 03, 2011 8:11 am
by zog » Wed Jun 13, 2012 11:48 am
Hi this is what I did

I downloaded darkbasics image of debian wheezy for the pi -

note - wheezy does not get security updates and you have to decide whether you want to trust darkbasics build or not down load at your own risk.

http://www.linuxsystems.it/2012/06/debi ... mal-image/

Follow darkbasics instructions on how to flash this to an SD card.

add a new user do

adduser jam
set up a new user

Plug pi into the internet

do apt-get update

then do apt-get install lxde

install lxde this will take a long time!

reboot pi LXDE desk top will load automatically to a GUI.

You can't login as root into the ide, but your should be able to login under the jam account.
or alternatively press Alt-Ctrl-F1 to login to a shell Alt-F7 to return - however the screens x-offset may well be misplaced on returning to a gui environment.

start a root shell

install free pascal first do
apt-get install fpc

then do apt-get install lazarus

if at any time things fail do apt-get update and then repeat the previous commands. I got a few errors, but I did manage to install Lazarus and create a basic program with a button on it that changed it's own label caption.

Alternatively you could try building lazarus from the latest source distro once you have fpc 2.6.0 installed on the system

Also fp works better and it draws itself correctly on debian wheezy with lxde.

I am trying to get blue tooth working on the pi now.

I hope this help :)
Posts: 96
Joined: Sun Nov 20, 2011 5:43 pm
by plugwash » Wed Jun 13, 2012 4:26 pm
HeadCase wrote:With the current Raspbian image apt-get install fpc will find and install fpc 2.6.0, however apt-get install lazarus fails due to unmet dependencies and complains about held broken packages.

Lazarus will be in raspbian, I just don't want to put the package with armhf support in raspbian before I've put it in debian sid.
Forum Moderator
Forum Moderator
Posts: 2266
Joined: Wed Dec 28, 2011 11:45 pm
by HeadCase » Thu Jun 14, 2012 9:48 am
plugwash wrote:
HeadCase wrote:With the current Raspbian image apt-get install fpc will find and install fpc 2.6.0, however apt-get install lazarus fails due to unmet dependencies and complains about held broken packages.

Lazarus will be in raspbian, I just don't want to put the package with armhf support in raspbian before I've put it in debian sid.


Thanks for clearing that up - I'm sure lots of people will be keen on trying lazarus. There has been quite a lot of Delphi/Lazarus code written over the last 10-15 years which could potentially make a big difference to the RPi software pool. Some very well known tools like Protel (PCB/Schematic CAD) were written in Delphi.

Apart from the fact that it uses OpenGLES 1.x, http://zengl.org/ library would be great if it worked with lazarus/fpc on RPi. Its a HW accelerated 2D library with a track record for mobile games - and it has a stable mature development platform/IDE in FPC Lazarus. I know that Python is the preferred educational language for graphics programming, but having a few viable alternatives can't be a bad thing. With a bit of luck Andrey Kemka aka "Andru" will get his hands on a RPi board - OpenGL 2.0 3D support in ZenGL would be a nice outcome.
Posts: 32
Joined: Sat Sep 03, 2011 8:11 am
by plugwash » Sun Jun 17, 2012 11:17 pm
I just pushed the source and arch all packages for the armhf supporting version of the lazarus packages into the raspbian repo, an autobuilder is now building the arch specific packages soon.
Forum Moderator
Forum Moderator
Posts: 2266
Joined: Wed Dec 28, 2011 11:45 pm
by HeadCase » Tue Jun 19, 2012 11:20 am
Nice .. Lazarus now installs from apt-get install lazarus.

First time you try and build an empty form you will get an error about missing packages .. it seems that lazarus is allergic to lcl packages that arent compiled on the native hardware. The solution is to start up lazarus as root and rebuild the lcl packages - as described below. That fixes the problem. Don't try editing the project directory options - that is not the problem.

I found a few issues with errors using odd widgets, so I don't think the cross platform is 100% yet - but I'm sure the lazarus community will iron out the wrinkles. As far as I can tell most widgets and the graphics drawing stuff is all working well.

When I try to compile a project, I get an error message "Cannot find Unit interfaces"
When I try to compile a project, I get an error message "Cannot find Unit interfaces". How can I solve this?
It means the compiler can not find the file 'interfaces.ppu' or the file was found, but it is wrong or outdated (the .ppu file date code is older than the date code of the compiler itself). Testing the compiler option settings can help debug these issues, via Project: Compiler Options... (use the Test button at the bottom of the dialog). This test will also verify that the {TargetCPU} and {TargetOS} variables are set properly.
This unit can be found in {LazarusDir}\lcl\units\{TargetCPU}-{TargetOS}\{LCLWidgetSet}\interfaces.ppu. For example: /home/username/lazarus/lcl/units/i386-linux/gtk/interfaces.ppu.
It is normal to have multiple versions of interfaces.ppu (in the proper directories) to allow compiling with different widgets.
If you selected a different widgetset for your project than was used to build Lazarus, you may need to build the LCL for the selected widgetset.
If the interface.ppu file is in the folder matching the OS and CPU you selected in the project preferences, and you get this error, you are using a different compiler / rtl for compiling your project than you used for compiling your Lazarus IDE, or if the libraries need to be recompiled to give the .ppu files newer compilation dates. You can do one of the following
Rebuild the LCL (or Lazarus completely) with the compiler selected in the Environmnent Options. You can do this with Tools -> Build Lazarus. Before doing this, check the current settings in Tools -> Configure Build Lazarus.
Change the compiler in the Environment Options to the one you used to compile Lazarus. Look carefully also in the Environment Options to see if you are using the correct paths for the Lazarus Directory and the FPC sources directory. Check that there is only one version of the compiler configuration file fpc.cfg - it should reside in /etc/ for Linux/Unix systems or in the same directory as the fpc compiler for Windows systems. Try to run "fpc -vt bogus" to check which fpc.cfg is being used in your system. Rogue copies often creep in if you have updated your compiler to a new version; they may be found in your home directory or in the same directory as the one in which you built your new compiler. DELETE THESE!
You may also try to change the widgetset currently selected for the project. For example, the sample project "objectinspector" that comes with Lazarus is set to gtk by default. Compiling this project will surely give you "Can't find unit interfaces" in Windows platform. Changing widgetset to default(Win32) in Project | Compiler Options... | LCL Widget Type (various) should fix this issue.
Posts: 32
Joined: Sat Sep 03, 2011 8:11 am
by HeadCase » Thu Jun 21, 2012 12:35 pm
Just a quick update .. I made a new SD card using the non-Raspbian wheezy and installed Lazarus. Apart from X hanging during the apt-get (install actually completed correctly, so I'm guessing that X windows was the culprit), lazarus came up perfectly. The issue with missing LCL units as mentioned above was not a problem, so I guess that is a wrinkle with the raspbian hard float.
Posts: 32
Joined: Sat Sep 03, 2011 8:11 am
by zog » Thu Jun 28, 2012 4:44 am
Hi again,
I want to try and write a video unit that will take full control of the pi's screen, I need to do this using fp so I can debug the program while I am working on the pi using an ssh client program such as putty from a remote computer. The problem is whilst debugging seems to be working in lazarus fp seems to have been compiled in a form without a debugging support. I have been trying to compile fp with debugging support but I am running into to trouble when fpc tries to link the libgdb libraries. My question is how do I compile the fp ide with debugger support on the pi ?

Thanks for any help anyone can offer here.
Posts: 96
Joined: Sun Nov 20, 2011 5:43 pm
by woodengineer » Fri Jun 29, 2012 1:55 pm
Hello,
I just got the precompiled fpc binaries from the freepascal website and then compiled Lazarus from source.
Have XFCE4, fpc 2.6 and Lazarus running on Archlinux.
Also wrote a wrapper class for Gordon Henderson's wiringPi C library which allows access to the GPIO pins
and PWM output from Freepascal / Lazarus (that is just too much fun!!!).
See my post on the Lazarus Forum (which includes the Lazarus unit and sample prg.).
http://www.lazarus.freepascal.org/index ... 404.0.html

Servus,
Alex
Posts: 5
Joined: Sat Jun 09, 2012 12:32 pm
by jwdietrich » Sat Dec 08, 2012 6:45 pm
Installing Lazarus on RPi is now quite easy in Raspbian Wheezy. I have written short instructions in the Lazarus Wiki at http://wiki.freepascal.org/Lazarus_on_Raspberry_Pi.

Please expand as required.
User avatar
Posts: 13
Joined: Wed Nov 30, 2011 11:52 am
by zog » Sun Dec 09, 2012 3:02 pm
Thanks for creating the wiki page. I would love to create a graphics library for free Pascal for the raspberry pi using the GPU . being able to remotely debug on the pi would also be very handy. Its all a question of time for me,with having and a full time job and a family to look after.
Posts: 96
Joined: Sun Nov 20, 2011 5:43 pm
by DavidS » Wed Jan 16, 2013 1:43 am
Has any one yet ported FPC to RISC OS? Beings that there are a good numberof RISC OS users that are using the RPi it would be nice. If it has not been done by the time I finish my projects in progress I may look into doing so.
ARM Assembly Language: For those that want: Simple, Powerful, Easy to learn, and Easy to debug.
User avatar
Posts: 1251
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
by dr_d_gee » Thu Jan 17, 2013 3:02 pm
Perhaps it's worth pointing out (particularly if you find Lazarus too slow) that Free Pascal has a text-mode IDE based on the old Turbo Pascal one--simply type fp (NOT fpc) at the shell prompt.
Posts: 79
Joined: Fri Jan 04, 2013 1:30 pm
by feverish » Thu Jan 17, 2013 4:25 pm
Yes, thank you for your interest. I need to do quite a bit of form design and in my ignorance rather depend on the visual graphics.
Posts: 299
Joined: Wed Jun 27, 2012 2:29 pm
by rj999 » Mon Feb 04, 2013 1:45 pm
Lovely to see the descendant of Turbo Pascal here. I cut my higher level programming teeth on the CP/M version of it when it first came out. Before then, I was strictly a machine language coder. Pascal is so much nicer than the C based languages and Basic. At last I have an excuse to order a Pi!!! And have just done so...
Posts: 29
Joined: Wed Feb 01, 2012 12:22 pm
by feverish » Mon Feb 04, 2013 3:30 pm
I am finding Lazarus on Raspi works fine, though it sometimes needs patience and wait a while to akkle. I began with Dartmouth Basic on a pdp8, then via Forth to compiled basic on Sinclairs and made my own 8085 CP/M machine for a rudimentary kit, thence through Delphi to Lazarus on Windows. I personally find Pascal more intuitive than most and as a geriatric I don't want to spend the rest of my life playing with learning new languages in preference to using them as tools
Nobody yet has come up with a Raspi package for the latest Lazarus release but several folks are living in hope some genius will soon oblige us all . . . . :D
Posts: 299
Joined: Wed Jun 27, 2012 2:29 pm
by rj999 » Sat Feb 09, 2013 2:32 pm
While I'm waiting for my 16GB SD card to arrive, I thought I'd play about and at least install VNC. Which was working fine until, encouraged by its success, I decided also to install nautilus and smb. The updates that auto installed during this process have broken tightvnc, just as they seem to have broken Lazarus for you. It seems that my view of unix and all its variants can remain unchanged even in 2013. It's primarily a device to ensure that systems people remain in salaried employment carrying out the continuous tweaks to hold it all together...
Posts: 29
Joined: Wed Feb 01, 2012 12:22 pm
by rj999 » Mon Feb 11, 2013 6:43 pm
/End Rant. There - switched off my old man rant in my previous post. Gave up on Nautilus, and am using the default file manager.
I've now installed my 16GB card and got vnc and wifi going with cifs access to my little Nasduo. Even better I've now got Delphi, I mean Lazarus going to the extent of a little Hello World program. And the Pi reboots cleanly still!!!

Now to remember how to do Delphi programming since it's more than 12 years since I last did any programming at all...

Thanks plugwash and others.
Posts: 29
Joined: Wed Feb 01, 2012 12:22 pm
by feverish » Sat Feb 16, 2013 8:00 pm
Don't get too excited about being able to use Lazarus. Between version 0.9.34.2 (?) currently available via apt-get install lazarus and the current up-to-date version (1.0.6?) advertised by the Lazarus experts there is a bit of a yawning gap which makes 'our' version unusable because of changes in fundamental Units, such as 'Interfaces', etc. A howl for help has gone out but those who know how to get around it and update for use on Raspi seem to be a bit too busy right now.
Posts: 299
Joined: Wed Jun 27, 2012 2:29 pm
by rj999 » Sun Feb 17, 2013 3:53 pm
All these open source products are subject to ongoing revision of course . But so far in my, admittedly restricted, experience it seems to work quite well on Rasbian. The only bug that's really struck me so far is its failure to mark source that's been changed sometimes, so the 'save all' item remains greyed out.
I can see hundreds of fixes in the change logs, but so far nothing significant that affects me. Is there something specific you've had a problem with?

Until I find something that doesn't work for me, I think I'm quite happy to go on developing its use and to be grateful for the activities of those who voluntarily carry out these updates. As a parallel, I have some hacked Android devices and people on the forums are always hankering for the latest and greatest version. But the changes between Android versions are pretty marginal so I'm content to stay with older versions of them too!
Posts: 29
Joined: Wed Feb 01, 2012 12:22 pm