Computing: Free Pascal Programming

Installing Lazarus/Free Pascal on PCLinuxOS.


The OS version used in this tutorial is PCLinuxOS 2022 (64bit, with xfce desktop), but the installation procedure described should apply to other versions, too.
The installation of Lazarus/Free Pascal on PCLinuxOS is really simple: They have a Lazarus package in their repository and it may be installed using the (GUI based) Synaptic package manager. Run Synaptic and use the Find command to search for "lazarus". The package manager will find one package, called "lazarus", build for the x86_64 platform and normally corresponding to the latest release of the IDE (Lazarus 2.2.0 in July 2022). Select the package 2.2.0-1pclos20 and choose Package > Mark for installation.
Installing Lazarus on PCLinuxOS: Selecting the 'lazarus' package in Synaptic
Push the Apply button. A window pops up to ask you if you want to also mark additional required changes. These include dependencies like the FPC compiler, the Free Pascal sources and the GDB debugger; there are also other new packages to be installed or installed packages that have to be upgraded or replaced.
Installing Lazarus on PCLinuxOS: Confirming the install of the 'lazarus' dependencies
From this point on, all proceeds automatically: all packages needed are downloaded and installed (some 1.5 GB of disk space needed). When done, the "lazarus" package will be marked with a green square in Synaptic, what means this package is actually installed and may be used. Using the xfce desktop, you'll find the shortcut for the Lazarus IDE by opening Applications and looking under Development. Launching the IDE will open the Configure Lazarus IDE window. And a problem here (at least on my system): the Fppkg configuration file has not been found! This may easily be resolved: Push the Restore the Fppkg configuration button and in the opening Generate new Fppkg configuration files window, choose /usr as prefix of the Free Pascal Compiler installation, then push the Write new configuration files button. The red exclamation mark in front of Fppkg disappears; the newly written configuration file being saved to /home/{user-name}/.config/fppkg.cfg.
Installing Lazarus on PCLinuxOS: 'Configure Lazarus IDE' window - Fppkg configuration file error
Installing Lazarus on PCLinuxOS: 'Generate new Fppkg configuration files' window
You can now push the Start IDE button. Lazarus starts up properly. The re-arrangement of the IDE windows is easier to do as what I experienced on Ubuntu 20.04. There seems to be a problem on VMware, however: When switching the VM to full screen mode, the Lazarus IDE windows do not change size accordingly. At least, on my system, where that is the case. Anyway, there is always the possibility to install the anchordockingdsgn package, included in the Lazarus package (but not automatically installed), that allows you to run Lazarus in single window layout. The screenshot below shows the IDE with the default windows re-arranged and the Messages window displayed. I just succeeded the build of my BlackJack application. Succeeded, because there was no linking failure, the executable was created and run properly...
Installing Lazarus on PCLinuxOS: Build with crtbeginS.o and crtendS.o warnings
That linking didn't fail and my application built correctly is not a reason to simply ignore the warnings that crtbeginS.o and crtendS.o are not found. In fact, with some other application the built might effectively fail. The problem is actually due to an incorrect path setting to gcclib in the FPC configuration file (a missing update of this file for the 2022 version of PCLinuxOS; to note that this problem is reported for several other Linux distributions). fpc.cfg is located in the /etc directory. Trying to use Open with Mousepad as Root did not work on my system, thus I opened it (readonly) as regular user. The paths actually set were /usr/lib/gcc/x86_64-mandriva-linux-gnu/11.2.0 and /usr/lib/gcc/x86_64-mandriva-linux-gnu/11.2.0/32. Looking in /usr/lib/gcc/x86_64-mandriva-linux-gnu/, I found several subfolders, the last one being 12.1.0 and looking in this folder, I found the files crtbeginS.o and crtendS.o. Thus, the fpc.cfg file has to be changed as follows:
    # path to the gcclib
    #ifdef cpui386
        -Fl/usr/lib/gcc/x86_64-mandriva-linux-gnu/12.1.0/32
    #endif
    #ifdef cpux86_64
        -Fl/usr/lib/gcc/x86_64-mandriva-linux-gnu/12.1.0
    #endif
Save fpc.cfg to your home directory. Open a terminal and enter su to become the superuser. cd to the directory where you saved the configuration file and copy it to /etc: cp fpc.cfg /etc/fpc.cfg. Rebuilding my BlackJack application really succeeds this time: no warnings about whatever files not found...

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