Updating Free Pascal and Lazarus with fpcupdeluxe on Ubuntu 17.10
February 20, 2018
-- Installing Free Pascal and Lazarus with fpcupdeluxe on Ubuntu 18.04->

When I updated to Ubuntu 17.10, back in October or November of last year, I reinstalled Free Pascal and Lazarus using the codebot script that can be found at getlazarus as I had done before. The whole operation is very simple and it installed the following IDE and compiler versions.

Lazarus 1.7
FPC 3.1.1
svn #51308

Since I was too busy playing around with Arduino, Python and so on, I did not use Pascal until just recently when looking at weather APIs. I found that there were problems with the delete and backspace keys in the edit controls including those found in the IDE itself. There were bug reports in the lazarus bugtracker (23131 and 30596) that describe the symptoms accurately. Encouragingly, developer Juha Manninen reported on the 5th of October that the bug had been removed.

It was time to update my working copy of Free Pascal and Lazarus. While looking into how to go about doing this, I came across two projects, fpcup and, its "comfortable successor", fpcupdeluxe. I used the latter which is Free Pascal/Lazarus install tool resembling the one from Code Typhon in that it will install cross-compilation toolchains.

In the past I have worked with Code Typhon. For the most part I found that the installation went reasonably well. The IDE configuration was also good. Best of all, it contained a truly massive collection of 3rd party packages and example projects. It seemed like everything had been scraped from the Internet, although not everything worked.

Two things bothered me. There was hardly any, if any, mention of the original Free Pascal / Lazarus project which was at the base of the derivative Code Typhon. I don't understand this, the work done is impressive enough to garner praise so why not give credit where it is due? Along the same line, many packages were renamed. This felt like a deliberate attempt at obfuscating the origin of some packages. Perhaps I am being unfair as there were undoubtedly name conflicts given the sheer number of packages in the project.

I may yet install the whole project again, if only to get all those example files. When I look at this possibility later on, I will study a utility by Zeljko Avramovic called ct2laz which can

can convert CodeTyphon projects and component packages to Lazarus, and Lazarus projects and component packages to CodeTyphon. It can also download zillion component packages and project examples from CodeTyphon web site and execute needed source file transformations to make them compatible with Lazarus. You can use CodeTyphon local files instead of downloaded ones if you prefer that way.

I decided to compile the fpcupdeluxe code obtained from the github repository. It can be cloned or a zip file can be downloaded and everything extracted. After loading the project file, fpcupdeluxe.lpr into the Lazarus IDE, I discovered that it would not compile. A few lines of fpcutil.pas had to be removed or made into comments:

Line 2127: {$IF FPC_FULLVERSION > 30100} //md FUnZipper.Flat:=Flat; {$ENDIF} Lines 2478 to 2481: {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION > 30000)} {//md Proxy.Host:=FHTTPProxyHost; Proxy.Port:=FHTTPProxyPort; Proxy.UserName:=FHTTPProxyUser; Proxy.Password:=FHTTPProxyPassword; } {$ENDIF}

The utility would then compile and I was able to install the compiler, IDE and the component library in a separate directory independently of the previous installation. The binary is in the deluxebin directory.

A Chicken and Egg Problem

I used a working if not perfect distribution of the compiler and IDE to create the fpcupdeluxe binary which I then used to install the compiler and IDE. If you are setting up Free Pascal and Lazarus for the first time, this approach will not work. The creators of fpcupdeluxe anticipated this problem and provide binaries for many platforms. Look here:

Initially, I tested the latest svn trunk:

Lazarus 1.9.0
FPC 3.1.1
svn #57337
and observed that the backspace and delete keys worked correctly in the IDE and in TEdit controls. Then I verified that this was also the case with the latest patched stable release:
Lazarus 1.8.0
FPC 3.0.4
svn 57344M

Being satisfied, I decided to remove all these versions of FPC/Lazarus and I installed the latest patched stable version along with the help file and a couple of modules in the directory that I preferred. Since the Debian/Ubuntu package management system had not been used by the getlazarus script nor by the fpcupdeluxe utility, removing an installation was just a matter of deleting a single directory that contained everything except for a .desktop file.

I repeated the above steps and installed FPC and Lazarus where I wanted it. Beside changing the installation directory (click on the Set InstallDir button; see 1 on the image below), the only other non-standard thing I did was to check Include Help in the Advanced settings window. It is displayed by clicking on the Setup+ button on the left. Of course it was necessary to click on the OK button in the Advanced settings window before clicking on the Fixes button at the bottom. This will fetch the latest stable version and add all available patches. The process did not take all that long.

The only other change that I did was to copy the .desktop file which was created on my desktop to the local applications directory erasing the old one that was still there.

michel@hp:~$ cp Bureau/fpcup-Lazarus_fpl.desktop .local/share/applications

Of course Bureau depends on the locale of the system and such as Desktop for en-XX locales. This means that I can launch the Lazarus IDE by clicking on the icon on the task bar as before.

When started, the IDE displayed everything in the classic way in separate windows.

I do not particularly like this layout, so I used fpcupdeluxe to add the anchordockin module. I also installed with synapse, bgrabitmap and bgracontrols. This must be done one module at a time.

As far as I can tell, AnchorDockingDsg 0.5 which docks most windows in a non-overlapping mosaic and sparta_dockedformeditor 0.0 which places any form associated with a unit in a tab sheet "behind" the code editor. Unfortunately, the form editor is broken in QT2 (the Linux widget set used on my system). So I removed the form editor.

  1. Click on the Package IDE menu
  2. Install/Uninstall Packages...
  3. Select sparta_dockedformeditor in the left panel of the Install/Uninstall Packages window
  4. Click on the Uninstall selection button under the left panel. The package name will be removed from the left panel and added to rhe right panel with a little red "x" over the icon.
  5. Click on the Save and rebuild IDE. It will take a while to recompile the whole IDE and it will disappear from the screen for a few seconds.

This is how the IDE appeared after. The form editor is on a floating window which will be hidden behind the rest of the IDE as soon as any element of it is focused. Having access to the form by pressing a tab at the bottom of the edit window was of value; hopefully, the sparta form editor will be fixed soon.

On the other hand, I have two monitors, so I can see both the form window and the docked windows code at the same time. In the end, I may prefer this approach, but all this is a matter of personal preferences. It is possible to tailor the look of the docked windows. Display other windows by clicking on View and selecting them. They can be added to the mosaic by docking them where desired. Click on the title bar of the window and drag it to where you want to anchor it. It may be worthwhile to display the Project Inspector window. Find it in the Project menu. You can also hide the window headers using the context menu Options / Docking/Anchordocking but do that only at the end. Here is what my IDE looks like right now.

The Project Inspector and Code Explorer are in a tab behind the Componentspanel. The tabs are at the bottom of the panel. As you can see, I am sticking to the old Turbo/Borland Pascal colouring scheme for the code editor. As I said, this is all a matter of personal preferences.

As I mentioned above, the utility can also be used to add cross-compilation toolchains. It is a simple matter of choosing the target CPU and operating system and then clicking on the Install cross-compiler button.

I managed to install the cross-compiler to 64 bit Windows (CPU = x8664, OS = Windows) without problems and did compile an (exe) executable although I did not test it. For some reason, I could not manage to get the 32 bit Windows cross-compiler working. I could not install OS = darwin (ie. Mac OSX) but that was not surprising since the fpcupdeluxe documentation does say that this requires the trunk branch of the Free Pascal / Lazarus repository.

-- Installing Free Pascal and Lazarus with fpcupdeluxe on Ubuntu 18.04->