md
Installing Free Pascal and Lazarus with fpcupdeluxe on Ubuntu 18.04
August 17, 2018
<-Updating Free Pascal and Lazarus with fpcupdeluxe on Ubuntu 17.10 --
This post is incomplete. Please read the recent page entitled Installing Free Pascal et Lazarus on Linux with FPCUPdeluxe. The orginal page, show below, remains available as an example of what not to do and also for the extra information about cross compiling.

My apologies for any wasted time or other problems caused by this error on my part.

October 30, 2018

Back in February, I updated an installation of the Free Pascal compiler and the Lazarus IDE done with the codebot script from getlazarus running on Ubuntu 17.10. Lately, I installed Free Pascal / Lazarus from scratch with the fpcupdeluxe tool. It was a bit more complicated to install instead of updating with that package as explained below.

Things went horribly wrong and I ended up destroying Ubuntu and I had a devil of a time in reinstalling version 18.04 which I discussed in the updated French language post Installing Ubuntu 18.04.1. I want to stress here that the problems had nothing to do with fpcupdeluxe and Free Pascal / Lazarus. Somehow, I screwed things up trying to ascertain which OpenGL library needed to be installed.

Table of Contents

  1. Lazarus Installer: fpcedeluxe
  2. Lazarus IDE Layout
  3. Open GL Library
  4. Cross Compilers

  1. Lazarus Installer: fpcedeluxe
  2. When I updated to Ubuntu 17.10, back in November of last year, I reinstalled Free Pascal and Lazarus compiling fpcupdeluxe code obtained from the github repository. However when it was time to install Free Pascal and Lazarus on a fresh copy of Ubuntu 18.04.1, I had to use a compiled binary fpcupdeluxe-x86_64-linux (version v1.6.1g). As a bug fix will soon be available, check for the latest version: https://github.com/newpascal/fpcupdeluxe/releases.

    My first attempt at using the application failed because of missing libraries. I installed those suggested by the application.

    michel@hp:~$ sudo apt-get install libx11-dev libgtk2.0-dev libcairo2-dev libpango1.0-dev libxtst-dev libgdk-pixbuf2.0-dev libatk1.0-dev libghc-x11-dev Lecture des listes de paquets... Fait ... 0 mis à jour, 99 nouvellement installés, 0 à enlever et 3 non mis à jour. Il est nécessaire de prendre 74,2 Mo dans les archives. Après cette opération, 708 Mo d'espace disque supplémentaires seront utilisés. Souhaitez-vous continuer ? [O/n] o (y for yes in English systems)

    That was quite a large addition, but it was not complete as will be seen. I then proceeded to install FPC and Lazarus where I wanted it. Beside changing the installation directory (click on the Set InstallDir button), the only other thing I did was to press on the Trunk button as shown on the image below.

    That successfully installed the Free Pascal compiler (version 3.1.1) and the Lazarus IDE (version 1.9.0). The only other change that I did was to copy the .desktop file which was created on my desktop to the local applications directory.

    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. I then clicked on the Apps button at the bottom of the laucher and searched for "Lazarus". The actual name will be "Lazarus_dir" where dir is the directory in which Lazarus was installed. I clicked on the icon with the right mouse button and then on the Add to Favorites option. That way, the Lazarus IDE can be started by clicking on the icon in the launcher.

  3. Lazarus IDE Layout
  4. 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.

    The image below shows the appearance of the IDE after installing that component and some modification of the options. The form editor is behind the code editor. Tabs at the bottom of these editort are used to select them.

  5. Open GL Library
  6. I also wanted to install synapse and bgrabitmap in the same way (this must be done one module at a time). However bgrabitmap would not install. Indeed, after that I could not get Lazarus to rebuild the IDE (menu: Tools/Build Lazarus with Profile: Normal IDE). After looking at the Install/Uninstall Packages (menu: Package) and realized that the lazopenglcontext package was marked for installation but was not installed. Clearly there was a problem with OpenGL. The fpcupdeluxe output window was showing that the GL library could not be found when linking.

    (9015) Linking ../lazarus /usr/bin/ld: cannot find -lGL make[1]: *** [idepkg] Error 2 make: *** [idepkg] Error 2 /home/michel/ED/fpl/lazarus/ide/lazarus.pp(167,1) Error: (9013) Error while linking /home/michel/ED/fpl/lazarus/ide/lazarus.pp(167,1) Fatal: (10026) There were 1 errors compiling module, stopping Fatal: (1018) Compilation aborted Error: /home/michel/ED/fpl/fpc/bin/x86_64-linux/ppcx64 returned an error exitcode

    It is reported in a number of posts in Lazarus forum, that the libgl-dev library had to be installed. Actually, that rang a bell, but the library is no longer available in Ubuntu.

    michel@hp:~$ sudo apt-cache policy libgl-dev libgl-dev: Installé : (aucun) Candidat : (aucun) Table de version :

    Looking about the Web, I found a reference (which I can no longer find) suggesting that the libgl1-mesa-dev library would work. Indeed, Synaptic suggest just as much. So I installed that library.

    michel@hp:~$ sudo apt install libgl1-mesa-dev ...Après cette opération, 6 600 ko d'espace disque supplémentaires seront utilisés. Souhaitez-vous continuer ? [O/n] o

    I was able to compile and install the lazopenglcontext.lpk. Once that was done, the OpenGL package could be installed and the OpenGL tab with the TOpenGLControl component was added to the components palette. It was also possible to install the bgrabitmap module with fpcupdeluxe.

    WARNING

    Trying to find the missing reference mentionned in the above, I found a askubuntu forum topic, /usr/bin/x86_64-linux-gnu-ld: cannot find -lGL, which suggested that the installation of the libgl1 package would have been sufficient. Accordingly, I removed libgl1-mesa-dev and installed libgl1 using Synaptic. It was possible to recompile the Lazarus IDE.

    Then I tried to cleanup the distribution with the sudo apt autoremove command.

    ALL THIS WAS A BIG MISTAKE!

    This completely broke the fresh Ubuntu 18.04.1 installation. I was not able to recover and had to delete the OS and install everything once again.

    Before installing libgl1-mesa-dev the second time around, I checked and found that libgl1 package was already installed by default in the distribution (or else got installed along with another package). So libgl1 was not sufficient to install the OpenGL context package and libgl1-mesa-dev was needed.

  7. Cross Compilers
  8. As I mentioned above, the fpcupdeluxe 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.

    The first time around, I managed to install the cross-compiler to 64 bit Windows (CPU = x8664, OS = Windows) without problems and did compile an (exe) executable and did test it.


    Linux (GTK2) application


    Windows 10 application

    Installing the Darwin (MacOS) cross-compiler proved too daunting.

    Cross-compilers were not installed the second time around. Since I have a dual boot system, I really should get on with cleaning up my Windows 10 partition and then the latest Free Pascal / Lazarus should be added.