Computing: Free Pascal Programming

Installing Lazarus/Free Pascal on BSD based systems.


If you are a regular visitor of my site, you probably know that I'm not a professional computer scientist, and that during my whole life I am using Microsoft Windows as operating system. Thus, my knowledge of other OS, in particular FreeBSD and derivatives, is limited. This tutorial is not more (but also not less) than my personal experiences when trying to install Lazarus/Free Pascal on BSD based systems. Thus, important to note:

Operating systems overview.

The following table gives an overview of the operating systems, that I tested, with their version, the version of Lazarus that was (or should have been) installed and an indication if I succeeded or failed. For details, please, have a look at the OS specific paragraph below.

Operating systemVersionPlatformLazarusNotes
FreeBSD13.164-bit2.2.2/2.0.10Installation/build problems.
GhostBSD22.06.1864-bit2.2.6Error messages, but finally successful builds.
FuryBSD12.464-bit2.2.6Installation problems.

Lazarus/FPC on FreeBSD.

As I describe in my tutorial Setting up a FreeBSD workstation (on VMware), my experiences with FreeBSD are really bad; spending hours of time with a result of more or less nothing. In fact, after having a running workstation with KDE desktop, I did not succeed to install/run any additional software.

I first tried the installation using the package manager, running the following command as super user:
    pkg install editors/lazarus

This installed the package lazarus-gtk2, version 2.2.2_1 and as you can see on the screenshot, the installation succeeded.

Installing Lazarus on FreeBSD: Successful installation using 'pkg'

However, after rebooting the system, the desktop didn't show up anymore. No idea, why this happens. And, it does not only happen with Lazarus, but with any other software that I try to install using pkg.

So, I tried the installation, using the ports. Command:
    cd /usr/ports/editors/lazarus && make install clean

The installation requires a lot of user intervention, as the user is asked for confirmation for a whole bunch of packages and components, such as gmake, gbd, fpc-mysql, fpc-odbc, fpc-x11, etc. Mostly, I just accepted the defaults, installing those that were selected, and ignoring those that weren't. The screenshot shows the confirmation dialog box for Python 3.7.

Installing Lazarus on FreeBSD: User confirmation for package 'Python 3.7'

This Python package will cause the failure of the installation. Error message: make[6] stopped in /usr/ports/lang/python37/work/python-3.7.9.

Installing Lazarus on FreeBSD: Installation failure due to Python 3.7

I redid the installation using the ports, this time unchecking the "Python bindings and support" when asked for the components of gbd. This leads to another make error and an abortion of the installation.

Installing Lazarus on FreeBSD: Trying the installation without the gbd Python bindings

Relaunching the installation, it seemed to continue where it abnormally terminated before and succeeded. No problem with the desktop after reboot and a "Lazarus" launcher appeared under "Development" in the "Start menu". As always when Lazarus is started for the first time, the Configure Lazarus IDE window showed up. All ok, except that the FPC sources weren't found.

Installing Lazarus on FreeBSD: Configuration of the IDE - fpc sources not found

This is not a real problem, because the sources have been installed and you can browse to the correct directory setting this way the correct path in Configure Lazarus IDE. The path on my FreeBSD 13.1 with Lazarus 2.0.10 actually is /usr/local/share/fpc-source-3.2.0.

Installing Lazarus on FreeBSD: Configuration of the IDE - Setting the correct path to fpc-source

The IDE started up. However, not possible to build applications. Builds failed with the error message Util/bin/ld.bfd not found; switching to external linking. I tried several ways to fix the problem and finally gave up. FreeBSD and myself, obviously we are not made for each other!

Installing Lazarus on FreeBSD: Build error - Util/bin/ld.bfd not found

Lazarus/FPC on GhostBSD.

My problem with GhostBSD is that I don't arrive to set a screen resolution of more than 1024×768 pixels. It's not a big deal, just remembering that at the times of Windows 98 and 2000, this was the standard size of a computer monitor; also, even if it's not really big, it's big enough to work somewhat comfortably. It's just a pity, because on FreeBSD and FuryBSD I have the resolution that I want, and on the only FreeBSD derivation (so far), where I succeed to build Lazarus applications, I don't.

GhostBSD has its own package management application, called Software Station. If you search for "lazarus", you will find two packages: lazarus-gtk2 (on GhostBSD 22.06.18, version 2.2.6), and lazarus-qt5 (on GhostBSD 22.06.18, version 2.2.6_1).

Installing Lazarus on GhostBSD: Software Station - Installing the 'lazarus-gtk2' package

The screenshot below shows the dependencies that will be installed together with the lazarus-gtk2 package. I think that everything is included, but I'm not sure anymore if, maybe, I had to install fpc-source separately. Just check the dependencies listed, and if fpc-source isn't among them, install it after the installation of the lazarus-gtk2 package is finished.

Installing Lazarus on GhostBSD: Software Station - lazarus-gtk2 dependancies

When launching Lazarus, the Configure Lazarus IDE window shows up. Two problems to be solved: First, the FPC sources have not been found, and second, there is something wrong with Fppkg.

Installing Lazarus on GhostBSD: Configuration of the IDE - fpc sources not found and Fppkg problem

To solve the first problem, we must indicate the correct path to the fpc-source folder. Use the Browse button in the FPC sources tab to navigate to /usr/local/share and select the folder fpc-source-3.2.2 (that's what the path is on my GhostBSD 22.06.18).

The second problem is rather common, when installing Lazarus; I encountered it on several Linux distributions. It's easy to solve it: In the Fppkg tab, push the Restore Fppkg configuration button (screenshot on the left), and in the opening window, accept the displayed directory-prefix and push Write new configuration files (screenshot on the right).

Installing Lazarus on GhostBSD: Configuration of the IDE - Restoring the Fppkg configuration [1]
Installing Lazarus on GhostBSD: Configuration of the IDE - Restoring the Fppkg configuration [1]

Building my BlackJack2 application, I got a rather bizarre message: Compile project. Target BlackJack2: Success. Errors: 2. How can the build succeed if there have been errors? Are these perhaps only warnings? No idea, and no importance, I guess. The application has been correctly build and the executable for FreeBSD based systems created.

Installing Lazarus on GhostBSD: Successful build of a GUI application

And running the application is also ok, as you can see on the screenshot below.

Installing Lazarus on GhostBSD: Running a Lazarus/FPC GUI application

Lazarus/FPC on FuryBSD.

A complete failure. Using the package manager pkg, the installation of Lazarus seemed to succeed, but after rebooting the system, just as with FreeBSD, the desktop didn't show up anymore. And using the ports, no possibility to install, because there is no lazarus package. Maybe it's not in the editors directory, or it has a different name (lazarus-gtk2, for example)? I did not try to find out. Just not ready to lose more time with FreeBSD and derivatives...


If you find this text helpful, please, support me and this website by signing my guestbook.