Building fpc and lazarus from sources on Ubuntu lazarus / 1-Linux ---------------------------------------------------------------------- BosseB · 2020-04-10 19:50 I have installed the fpc/lazarus pair many times on Raspberry Pi from sources retrieved via svn. So I have a script to do the job for me on every new unit I build. But now I have a different Linux to handle since I have repurposed my old HP Laptop, which used to run Windows 7. I installed Ubuntu 18.04 LTS today and then I tried my hand at the following after reading this wiki info and installing the same support packages as I have done on Raspbian: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i #used wget to retrieve the seed compiler ppcx64 ver 3.0.0, thensudo apt install -y libx11-dev libgdk-pixbuf2.0-dev libcairo2-dev gir1.2-coglpango-1.0 libpangox-1.0-dev xorg-dev libgtk2.0-dev libpango1.0-dev freetds- devsudo apt install subversion mkdir -p ~/dev/fpcmkdir -p ~/dev/lazaruscd ~/dev/fpcsvn co https://svn.freepascal.org/svn/fpc/tags/release_3_0_4/ 3.0.4#Here I successfully compiled and installed fpc according to my notes from Raspbian installationscd ../lazarussvn co https://svn.freepascal.org/svn/lazarus/tags/lazarus_2_0_6/ 2.0.6cd 2.0.6make cleanmake bigide And now the problem: Almost immediately I get a fatal error saying (shorted): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i packager/registration/fcllaz.pas(11,3) Fatal: (10022) Can't find unit db used by fcllaz Fatal: (1018) [fcllaz.ppu] Error 1 Note that at first I had used apt to install fp-compiler but with that I reached the exact same end error when building lazarus. So contrary to what the wiki suggested there are dependencies not fixed by installing fpc via apt from the ubuntu repositories... So my question: What are the dependencies to install on this brand new out of the box Ubuntu 18.04 in order to make fpc able to build lazarus? I don't know why "unit db" is not found, is it not part of fpc/lazarus???? ---------------------------------------------------------------------- marcov · 2020-04-10 19:58 You didn't configure FPC, so there is no /etc/fpc.cfg or ~/.fpc.cfg  that holds the path to the compiled units. fpc.cfg can be generated with a script samplecfg, or with fpmkcfg, but I usually just manually put -vwih -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/* in it. Adjust path appropriately ---------------------------------------------------------------------- BosseB · 2020-04-10 22:03 Quote from: marcov on April 10, 2020, 09:58:52 pmYou didn't configure FPC, so there is no /etc/fpc.cfg or ~/.fpc.cfg  that holds the path to the compiled units. fpc.cfg can be generated with a script samplecfg, or with fpmkcfg, Well, I did not mention it but I actually did this step too... Code: [Select]~/lib/fpc/3.0.4/samplecfg "/home/user/lib/fpc/3.0.4" "/home/user"And the command ran successfully... Quotebut I usually just manually put Code: [Select]-vwih -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/* in it. Adjust path appropriately I don't know what -vWih does but the other line is already there in ~/fpc.cfg except it reads: Code: [Select]-Fu/home/user/lib/fpc/$fpcversion/units/$fpctarget/* Where is the unit db supposed to be located? Is it inside the Lazarus code tree or in the FPC code? I have no idea where to start looking... ---------------------------------------------------------------------- BosseB · 2020-04-10 22:35 OK now I found the problem solution: Turns out that the command for creation a new config file from the sample Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ~/lib/fpc/3.0.4/samplecfg "/home/user/lib/fpc/3.0.4" "/home/user"resulted in the creation of a file fpc.cfg in the home dir. When I looked at one of my Raspberries I noted that the file was named .fpc.cfg in that case and when I compared the content of the two files they were identical except for the architecture (arm vs intel x64). So I renamed fpc.cfg to .fpc.cfg in my home dir in ubuntu and now the make bigide ran for 2 minutes and resulted in a lazarus program being created. Now I just have left to set up the start menu item for Lazarus 2.0.6 and then test it out. But that will be for tomorrow, it is past midnight now.... ---------------------------------------------------------------------- dbannon · 2020-04-11 00:18 Bo, I am curious as to why you followed instructions for FBSD when you could have used Linux specific instructions.  https://wiki.freepascal.org/Installing_Lazarus_on_Linux  Those linux instructions were initially written for U18.04. If you are happy with FPC 3.0.4, then installing with apt creates that fpc.cfg file for you in /etc and in my experience thats all you need. The above mentioned page also details how to get the desktop file in place for your menu entry. Davo ---------------------------------------------------------------------- BosseB · 2020-04-11 06:36 Quote from: dbannon on April 11, 2020, 02:18:06 amBo, I am curious as to why you followed instructions for FBSD when you could have used Linux specific instructions.  https://wiki.freepascal.org/Installing_Lazarus_on_Linux  Those linux instructions were initially written for U18.04. SORRY! When writing this post I linked to the wrong page! I had searched in many places so I had them all in tabs. These two are very similar looking. But in fact I used the one you linked to to get general instructions... QuoteIf you are happy with FPC 3.0.4, then installing with apt creates that fpc.cfg file for you in /etc and in my experience that's all you need. The above mentioned page also details how to get the desktop file in place for your menu entry. Well I want to be able to switch fpc version if need and I also want to have everything installed below home so there is no need for sudo ever. Has worked for a very long time flawlessly on Raspbian. With fpc retrieved via apt I am in the hands of the distribution managers as to which version I may get... ---------------------------------------------------------------------- dbannon · 2020-04-11 08:36 Ah, makes sense. I recently tried FPC320 RC1, installing was petty easy using the pre made binaries in a tar. Each tar ball comes with a script that does a pretty good job, I installed under /home and you also need the src bundle.  Something like this - Code: [Select]sudo apt install binutils make gcc subversion vim libgtk2.0-dev  libx11-dev libqt5pas-dev wget ftp://ftp.freepascal.org/pub/fpc/beta/3.2.0-rc1/source/fpc- 3.2.0rc1.source.tar.gz wget ftp://ftp.freepascal.org/pub/fpc/beta/3.2.0-rc1/x86_64-linux/fpc- 3.2.0rc1.x86_64-linux.tar mkdir FPC I then untared the binary package into a temp dir and ran the script in there.  The same script alse creates an .fpc.cfg, (with the leading dot) in your home dir.  But you must insure that there is not a existing fpc.cfg in /etc as I think it has priority.   I also extracted the scr file to ~/FPC/fpcsrc Add ~FPC/fpc-3.2.0/bin to your path and away you go. Remarkably easy as it turned out ! I expect there are similar, ready to run binary tar balls for 3.0.4.  You can control which one you use with PATH but I manually swapped the fpc.cfg file. I suspect fpc.cfg from 3.2.0 may be OK to use with 3.0.4 but did not try. Davo ---------------------------------------------------------------------- BosseB · 2020-04-11 11:20 I am using pcp directories to separate the different versions. Then they can be side-by-side and depending on how I start Lazarus I get the version I want. On linux this is ~/.lazarus_2.0.6/ at the moment since it is the first install on this machine. But I plan for the future so I use pcp. ---------------------------------------------------------------------- marcov · 2020-04-11 11:34 Doing your own builds for FPC isn't that hard once you get over the first bumps. And it is indeed useful to circumvent distro trouble and multiple installation scenarios and live branch tracking. ---------------------------------------------------------------------- BosseB · 2020-04-12 21:29 I have found an issue I have not seen before with my installation on Ubuntu: - I have Lazarus open and the different windows arranged as I want. - Now I minimize the main window (withe the menus) and everything disappears. - Next I want to restore Lazarus so I click the Lazarus icon in the side bar. - What happens now is that a panel shows up with miniatures of the lazarus windows and if I click one it appears on the desktop, all alone! - This happens for all windows including the main window.... So to restore the environment I have to repeat the clicking for each and every Lazarus window. Is this by design or is ít Ubuntu 18 that is playing up here??? Or have I missed something? Some hidden setting... On every previous installation I have done there is a one-click restore that shows all of the Lazarus windows. ---------------------------------------------------------------------- dbannon · 2020-04-12 23:02 As a long time U18.04 user, I have experienced what you describe and don't quite understand it. Its particularly hard to manage in the Gnome desktop. So, I use Mate, and I always use Workspaces, I have four, Lazarus is always (except when I forget) started in workspace three (I run virtual box in four) and I don't, ever, minimise it. It is, apparently possible to 'dock' the various windows together, maybe that solves it ?  Don't know, I do prefer the floating window model. Just don't minimize. Ever ! Davo ---------------------------------------------------------------------- GAN · 2020-04-13 00:08 Quote from: BosseB on April 12, 2020, 11:29:23 pmI have found an issue I have not seen before with my installation on Ubuntu: - I have Lazarus open and the different windows arranged as I want. Save desktop and set it as default desktop, it is a easy trick. ---------------------------------------------------------------------- BosseB · 2020-04-13 06:36 Quote from: GAN on April 13, 2020, 02:08:17 amQuote from: BosseB on April 12, 2020, 11:29:23 pmI have found an issue I have not seen before with my installation on Ubuntu: - I have Lazarus open and the different windows arranged as I want. Save desktop and set it as default desktop, it is a easy trick. And how is that done? I cannot find any command to "save desktop" anywhere I have looked... The only close one is Tools/Desktops, but it seems only to make the desktop saving automatic, which is what I have checked anyway. When I close Lazarus and then open it I get all windows in the desktop back to where they were. But that is not my issue. What I was asking about is when I minimize Lazarus temporarily from the main window and then want to get it back up I have to do these extra clicks that were not needed in other environments. How to fix that if possible? ---------------------------------------------------------------------- howardpc · 2020-04-13 07:46 AFAIK this issue is related to the window manager you use rather than the particular Linux distro, or Lazarus itself. Some window managers simply do not respect window restore settings as expected. I think until there is more standardisation among the window managers, the best you can do is try different alternatives (Gnome/KDE/Mate) etc. until you find one that consistently "behaves". ---------------------------------------------------------------------- BosseB · 2020-04-13 08:19 Quote from: dbannon on April 13, 2020, 01:02:08 amAs a long time U18.04 user, I have experienced what you describe and don't quite understand it. Its particularly hard to manage in the Gnome desktop. So, I use Mate, and I always use Workspaces, I have four, Lazarus is always (except when I forget) started in workspace three (I run virtual box in four) and I don't, ever, minimise it. It is, apparently possible to 'dock' the various windows together, maybe that solves it ?  Don't know, I do prefer the floating window model. Just don't minimize. Ever ! Davo So I am not alone then!  Maybe I should change to Linux Mint Mate then and hope for the best... ---------------------------------------------------------------------- BosseB · 2020-04-13 08:23 Quote from: howardpc on April 13, 2020, 09:46:03 amAFAIK this issue is related to the window manager you use rather than the particular Linux distro, or Lazarus itself. Some window managers simply do not respect window restore settings as expected. I think until there is more standardisation among the window managers, the best you can do is try different alternatives (Gnome/KDE/Mate) etc. until you find one that consistently "behaves". Is there a way to "install" the Mate window manager in Ubuntu for testing so I don't have to do a full install again including fpc/Lazarus? I have tested the "Classic Shell" approach and it gave me the application menu back but did not solve the window restore problem. ---------------------------------------------------------------------- BosseB · 2020-04-13 09:05 Quote from: BosseB on April 13, 2020, 10:23:15 amIs there a way to "install" the Mate window manager in Ubuntu for testing so I don't have to do a full install again including fpc/Lazarus? I have tested the "Classic Shell" approach and it gave me the application menu back but did not solve the window restore problem. Reply to self: Yes there is a way to install the MATE desktop manager into Ubuntu 18.04 LTS! In fact it is part of the standard Ubuntu repositories so apt will be able to find it.  So I followed this tutorial for MATE on Ubuntu and it worked just fine. And now a minimized Lazarus restores all windows in one click without having to individually restoring them. MATE also has a useful application menu that can be configured with the commonly used apps in a favourites section. This desktop change to MATE within Ubuntu saved me the hassle of re- installing everything from scratch. Unfortunately it did not solve my other (OT, not related to Lazarus) problem: This laptop can enter suspend mode, for example via the power button (MATE then asks what I want to do) or by closing the lid. But it is NOT POSSIBLE to restore from suspend, whatever action I tried it stays in limbo.... Only way out is to hold down the power button until BIOS fully shuts down power, then I can start it from scratch. ---------------------------------------------------------------------- dbannon · 2020-04-14 00:00 Quote from: BosseB on April 13, 2020, 11:05:47 am.... Unfortunately it did not solve my other (OT, not related to Lazarus) problem: This laptop can enter suspend mode, for example via the power button (MATE then asks what I want to do) or by closing the lid. But it is NOT POSSIBLE to restore from suspend, whatever action I tried it stays in limbo.... Only way out is to hold down the power button until BIOS fully shuts down power, then I can start it from scratch. That is, as you note, OT, almost certainly an issues with your Laptop and how well supported it is in the Linux Kernel.  When I first got my Dell laptop, it failed to suspend, two releases of firmware later, all good. Given that Cannonical are about to release Ubuntu 20.04, also a LTS product, you may find a newer OS can support your hardware.  I am running the beta and its pretty good. Especially the Mate variant. Davo ---------------------------------------------------------------------- BosseB · 2020-04-14 09:38 Still OT.... Thanks for your input! Yes, I think I saw that Ubuntu 20.04 LTS is around the corner. I will wait for it and possibly install fresh with the MATE version so I don't get a bunch of old stuff migrated from my experiments. Another note: My laptop battery is bad, it won't charge anymore so I am on mains power at the moment. Ordered a new battery online a few days ago and got a delivery message today that estimated a 15 day wait... So when the battery arrives is probably when 20.04 has been released as well. I will hold off until then. Meanwhile I will convert my Raspbian script for installing fpc/lazarus from sources on the Ubuntu target, then the lazarus install will be a lot faster than today. ---------------------------------------------------------------------- dbannon · 2020-04-15 00:03 No, you cannot leave the holy church of ububtu !  You will be hunted down and dealt with! Using Mate and one of the 'docks' across the bottom (or elsewhere) Mac style, you can minimize and resore using the dock icon.  So, don't minimize using one of the lazarus window's window control icons, click the leopard icon in the dock. Works for me.... Davo