Linux Online
[ Register ]

[ Applications ]
[ Documentation ]
[ Distributions ]
[ Download Info ]
[ General Info ]
[ Book Store ]
[ Courses ]
[ News ]
[ People ]
[ Hardware ]
[ Vendors ]
[ Projects ]
[ Events ]
[ User Groups ]
[ User Area ]

Building Embedded Linux Systems

[ About Us ]
[ Home Page ]
[ Advertise ]

Linux Online: Reviews

Lazarus: Pascal and Delphi Rise Again

Michael J. Jordan, Linux Online Staff

May 11, 2007

What is Lazarus?

Lazarus is a RAD tool, or Rapid Application Development tool that runs on the three major platforms (Linux, Windows and Mac OS). It is very similar to Delphi, a popular RAD developed by Borland. And like Delphi, it uses a variant of Pascal for its underlying programming language. In Lazarus' case, it's Free Pascal.

In the days when I used Windows, I used to develop applications with Delphi. The last year I used Windows with any regularity was 1999 - dual booting, mostly in order to use Delphi. In 2001, Borland came out with Kylix, a version of Delphi for Linux. Due to a few issues I had with Kylix, I didn't really take to it and never developed anything with it. Borland eventually stopped development of Kylix altogether.

Since I had switched to development of web based applications, I never really had any interest in returning to Pascal based programming. Recently, however, I reviewed some of the code for a foreign language learning application I had created with Delphi. I was not able to duplicate its functionality exactly using a web-based approach, so I needed to return to a Delphi-like environment to re-create the app. Luckily, I found Lazarus. Like me, if you're in a situation where a web-based approach just isn't right and contemplating programming in C/C++ makes you break out in a cold sweat, Lazarus may be what you're looking for.

Installation

Installation in Ubuntu (Feisty) wasn't glitch-free, though I didn't end up in dependency hell either. From Sourceforge, I downloaded a tarball that includes all of the Free Pascal packages you need. Along with that file, I got the Lazarus .deb package. First, I tried to install the Free Pascal packages with 'dpkg -i'. I got an error installing one of the packages - the win32 cross compiler. My system was lacking libc6-dev. I installed via apt-get and then installed the final package.

When I went to install the Lazarus package, I got a few more dependency errors, despite the package actually installing (partially). It told me that I was missing libgdk-pixbuf-dev and libgtk1.2-dev. When I went to install them, I got a message about conflicts and that I needed to run 'apt-get -f install' to fix them. I did that and then Lazarus ran fine.

Installation on my Fedora machine was a bit easier. I downloaded the RPMs from the same site and those installed without any problem. I didn't have any dependency problems, though that may be because my Fedora machine is so chock full of stuff, I doubt I'd be missing much of anything.

Working with Lazarus

If you've worked with Delphi or any other RAD, then Lazarus will be very familiar to you.

lazarus IDE

Lazarus, like any RAD environment, works on the concept that you choose items from an inventory of GUI components, like text fields, buttons, menus and other common graphical items and then choose predetermined events to control how they work. You add code to these events to customize the workings of your application. As designed, Lazarus does an excellent job at this.

Lazarus, like Delphi, is mainly aimed at programmers who want to provide a GUI to manipulate data. And like Delphi, Lazarus also does this very well and perhaps better, since it is able to manipulate data using more database engines - both open source and proprietary. These include, MySQL, PostgreSQL, SQLite, Firebird and even MSSQL. There is even the possibility of using dBase and FoxPro tables. There is extensive documentation at the Free Pascal website on how to use each of these database formats.

As far as coding your application goes, Lazarus makes this fairly easy to do. For me, Object Pascal was a language that was easy to handle and treated programmers like me (without a lot of natural talent) fairly kindly. I am happy to report that the same holds true for the Pascal variant found here. I found myself pulling some of my old Delphi books off the shelf and consulting my old notes as I tried to revive the foreign language learning application project. It was like getting up on a bicycle again. Despite many years without riding, you never forget how to do it. There wasn't much I had to modify, even though my projects are going on 10 years old. The database end of it was the big exception, but the documentation on the Free Pascal site helped a great deal. There are also tools to convert whole Delphi projects to Lazarus, though this isn't achieved "automagically". There was some hand coding required, at least in my case.

One of the main selling points (if you can say that about free software), is that Lazarus works on the three major platforms, Windows, Linux/Unix and Mac OS. In fact, Lazarus' catch phrase is 'Write Once, Compile Everywhere'. And it is true, as far as 32 bit Windows goes at least - which I have tried. An application written under Linux compiled nicely in the Windows version of Lazarus. There are also tools for compiling 32 bit Windows applications under Linux/Unix so you don't have to boot into Windows and use the win32 version of Lazarus. But I found the process somewhat complicated and despite my reluctance to use Microsoft products, it was easier for me to just do it on Windows.

Even more importantly to me than Windows support, my Linux application binary ran well on various other versions of Linux. I remember having serious deployment problems with Kylix when I tried it out some years ago. Again, there is excellent documentation at the Free Pascal website on deploying applications on Linux, Windows and Mac OS.

Lazarus has filled a void

Though the pundits may pine about Web 2.0 and how static applications are on the way out, businesses both large and small around the world still cling to the desktop apps that get the job done. So it's safe to say that the demand for these apps won't disappear overnight. There was a real need for a robust and reliable RAD for Linux to create these kinds of applications and Lazarus has filled this void. Now we have a real RAD environment and an excellent one at that. I really haven't even begun to scratch the surface as to the real potential of this free development suite, but what I have seen has convinced me that Lazarus can be added to the list of "killer apps" of the Linux world and should be a part any open source developer's tool kit.

You can find more information at the Lazarus home page

Michael J. Jordan is the managing editor of Linux Online. He can be reached at Michael.Jordan**AT**linux.org




Comments: feedback (at) linux.org
Advertising: banners (at) linux.org
Copyright Linux Online Inc.
Compilation ©1994-2008 Linux Online, Inc.
All rights reserved.