Recent

Author Topic: Request: A beginner's guide to installing Lazarus 2.2.6 for Ubuntu 22.04  (Read 3753 times)

Nel_Fie

  • New Member
  • *
  • Posts: 33
CURRENT SOLUTIONS (as of 24.08.2023) : Relevant post link

I'm completely new to Linux/Ubuntu, having just upgraded my system from Windows 7. I barely understand yet how the terminal works or is supposed to be used. Can someone here provide me a simple step-by-step to installing the current version of Lazarus from scratch (with no pre-existing installation), down to the actual commands for the terminal?

I've looked at the Lazarus Wiki page, I've seen Handoko's pinned thread at the top of the section (which was last edited in 2018, and I assume things can change a lot in 5 years), looked around in this section of the forum (e.g. I've seen this recent thread: "The problem with installing lazarus 2.2.6 in Ubuntu 22.04" but it doesn't have any thorough instructions inside as far as I saw).

A lot of the information provided seems either outdated, and/or makes a lot of assumptions of pre-existing knowledge on the part of the user about how Ubuntu and related things work, and/or has the steps kind of disordered across different sections or posts, with backtracking across the board, etc... well either way, I haven't found anything that I'm entirely confident won't just end up filling my drive with a lot of useless clog that I'll end up having to go through and delete by hand and start all over again - or heaven forfend, reinstall Ubuntu from scratch just for the hope of making Lazarus work.

So, if anyone here knows and has the time, could you please write down a beginner's guide to installing the current version of Lazarus for Ubuntu?

Any additional recommendations regarding decisions to be made during the installation process are welcome - for example, I saw some discussion about different debuggers that can be used and which ones work better. Not sure if that's entirely relevant during installation, but if it is, I'd be glad to know about it.
« Last Edit: August 24, 2023, 03:46:15 pm by Nel_Fie »

440bx

  • Hero Member
  • *****
  • Posts: 4647
I cannot help with the installation of Lazarus on Ubuntu because I don't use Ubuntu BUT, based on what you described, I would _strongly_ recommend that you have Ubuntu installed in a Virtual Machine.  This would allow you to take snapshots which are enormous time savers when you're just learning how to do something as they allow you to go back to the last state/snapshot that was problem-free instead of having to redo many steps (including having to re-install the O/S in a worst case.)

That's my $0.02 worth of "help".

HTH.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Lulu

  • Sr. Member
  • ****
  • Posts: 263
Hi, I suggest you to use fpcupdeluxe, it's a wonderfull automatic installer for all version of fpc and lazarus.

On your new Ubuntu machine:
1) open a console and run the following command to install the prerequisites
Code: Pascal  [Select][+][-]
  1. sudo apt install make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev

2) Create a folder fpcupdeluxe somewhere in /home/your_user_name, for example, I'm lulu so, for me it's /home/lulu/fpcupdeluxe
3) Dowload the fpcupdeluxe linux version here: https://github.com/newpascal/fpcupdeluxe/releases/latest and put it in the created folder
4) Run fpcupdeluxe-x86_64-linux
5) Choose a version for FPC and Lazarus, i.e. FPC3.2.2 Lazarus2.2.4 or simply click on STABLE button
6) click button "Install/Update FPC+Lazarus, wait...
7) when its done, close fpcupdeluxe and double click on the created Lazarus icon on your Ubuntu desktop.

I hope I don't forgotten something...

Edit: for usefull informations read https://github.com/LongDirtyAnimAlf/fpcupdeluxe
       and there is a discussion on this forum https://forum.lazarus.freepascal.org/index.php/topic,34645.0.html
« Last Edit: August 22, 2023, 11:05:19 pm by Lulu »
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Leledumbo

  • Hero Member
  • *****
  • Posts: 8772
  • Programming + Glam Metal + Tae Kwon Do = Me
  • Download all 3 debs from here
  • If you have GDebi installed you can just block them all, right click then install, the dependencies will be downloaded on the go
  • Otherwise, open a terminal, cd to where you download them, then just: sudo dpkg -i *.deb. Essentially, that's what GDebi does, so it's the same as the previous step
I suggest familiarizing yourself with the system, including the ability to navigate and execute terminal commands. As a developer, that's essential. Only casual users won't need to go down to terminal level.

dbannon

  • Hero Member
  • *****
  • Posts: 3150
    • tomboy-ng, a rewrite of the classic Tomboy
...
Otherwise, open a terminal, cd to where you download them, then just: sudo dpkg -i *.deb. Essentially, that's what GDebi does, so it's the same as the previous step[/li][/list]
Sadly, no. dpkg does not resolve dependencies and most clean installs of Ubuntu will need some.   I am no sure if 
Code: Pascal  [Select][+][-]
  1. sudo apt install *.deb <enter>
will work, need to test. But I suggest its not a great idea to install things as root with a wildcard. Better, in my opinion, to name each of the three files on the sudo apt command line. Not as hard as it sounds, first, after the down load, go to the download directory, probably /home/YOUR_USERNAME/downloads, and do a
Code: Pascal  [Select][+][-]
  1. ls -l *.deb <enter>
to view the files, noting, perhaps that the three we expect are there. Then, type
Code: Pascal  [Select][+][-]
  1. sudo apt install
(and a space but not Enter yet) and add the correct file names, one by one, by either -

  • copy the names by just selecting one with the mouse and then clicking the mouse middle button, add a space and do the next one ...

or
  • start typing one of the names, press tab and see if the OS has enough information to fill in the command line for you, if so, add a space and do the next one, if not, type more of the file name, tab ...
Then, and only then, add the <enter> !

The above sounds a bit pedantic but a new linux user needs to start off with good habits, a wild card install from the downloads directory is not a good idea.

David

A lot of this is explained in the wiki page, installing Lazarus on Linux, it really does not matter which Linux or which version of Linux you are using. See https://wiki.freepascal.org/Installing_Lazarus_on_Linux

And Leledumbo is definitely right, if you are going to use linux in any more then the most superficial way, you need to use the command line. You will soon be doing what I wrote above in far less time than it takes to read my instructions ....

David
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Leledumbo

  • Hero Member
  • *****
  • Posts: 8772
  • Programming + Glam Metal + Tae Kwon Do = Me
Sadly, no. dpkg does not resolve dependencies and most clean installs of Ubuntu will need some
Oh yeah? Pretty sure it did, but I'll need to reconfirm. Maybe on my next device.
I am no sure if 
Code: Pascal  [Select][+][-]
  1. sudo apt install *.deb <enter>
will work, need to test.
It won't, apt will accept local file only when given at least relative path, so wildcard is a no go unless you know how to have the expanded result prepended with ./

Nel_Fie

  • New Member
  • *
  • Posts: 33
I cannot help with the installation of Lazarus on Ubuntu because I don't use Ubuntu BUT, based on what you described, I would _strongly_ recommend that you have Ubuntu installed in a Virtual Machine.  This would allow you to take snapshots which are enormous time savers when you're just learning how to do something as they allow you to go back to the last state/snapshot that was problem-free instead of having to redo many steps (including having to re-install the O/S in a worst case.)

That's my $0.02 worth of "help".

HTH.

Right - although there's a difficulty in that, which is that I also have never used Virtual Machines before, so that would add another whole stack of things to learn and get used to. Thank you for suggesting it nonetheless, I'll have to look into this for the future.

Hi, I suggest you to use fpcupdeluxe, it's a wonderfull automatic installer for all version of fpc and lazarus.

On your new Ubuntu machine:
1) open a console and run the following command to install the prerequisites
Code: Pascal  [Select][+][-]
  1. sudo apt install make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev

2) Create a folder fpcupdeluxe somewhere in /home/your_user_name, for example, I'm lulu so, for me it's /home/lulu/fpcupdeluxe
3) Dowload the fpcupdeluxe linux version here: https://github.com/newpascal/fpcupdeluxe/releases/latest and put it in the created folder
4) Run fpcupdeluxe-x86_64-linux
5) Choose a version for FPC and Lazarus, i.e. FPC3.2.2 Lazarus2.2.4 or simply click on STABLE button
6) click button "Install/Update FPC+Lazarus, wait...
7) when its done, close fpcupdeluxe and double click on the created Lazarus icon on your Ubuntu desktop.

I hope I don't forgotten something...

Edit: for usefull informations read https://github.com/LongDirtyAnimAlf/fpcupdeluxe
       and there is a discussion on this forum https://forum.lazarus.freepascal.org/index.php/topic,34645.0.html

I'll probably try this, thank you for sharing. Although I'm not sure I'll have use for all the added functionalities, it seems to be the most headache-free option so far.

[...]
A lot of this is explained in the wiki page, installing Lazarus on Linux, it really does not matter which Linux or which version of Linux you are using. See https://wiki.freepascal.org/Installing_Lazarus_on_Linux

And Leledumbo is definitely right, if you are going to use Linux in any more then the most superficial way, you need to use the command line. You will soon be doing what I wrote above in far less time than it takes to read my instructions ....

David

Yes, I saw that link, but I decided to ignore it since the author of the first section "Requisite Linux packages" didn't even seem certain of what the requisites were, and instead unloaded their responsibility unto an unrelated forum member by quoting them. In addition, they fail to explain how said packages are to be installed or what they do exactly.

As for learning how to use terminals, yes, I have every intention to do that, but as it currently stands I don't know enough about it. I know and understand some of the basics, but learning the wide range of functionalities it provides cannot exactly be squeezed into two days' worth of being a first-time Ubuntu user.

Nonetheless, thank you for taking the time to share your understanding and insights.

Handoko

  • Hero Member
  • *****
  • Posts: 5340
  • My goal: build my own game engine using Lazarus
Recent versions of Lazarus can be installed on Ubuntu (and its variants) easily, you only need to download the 3 deb files and install them using the following order:
1. fpc
2. fpc-src
3. lazarus


GDebi Package Installer and Synaptic Package Manager are not needed. They only needed if something bad happened on your installation.



Some years ago my Lazarus suddenly couldn't start normally. I found it had been replaced with the Lazarus version provided/maintained by Ubuntu Software Center automatically. Ubuntu is known for not providing the latest version in their software list, for stability reason I guess. To make thing worst, they made some necessary changes, so the config settings I made became lost.

I tried to uninstall the Lazarus provided by Ubuntu and reinstalled from the one provided by Lazarus team. But failed, because Ubuntu would prioritize their own.

Recent versions of Lazarus do not have such problem now. As you can see from the attached screenshot, Lazarus provided by Lazarus team has changed the software name to lazarus-project, that will trick Ubuntu to 'think' it is a different software.

For your information, installing Lazarus on older versions of Ubuntu may failed. If I remember correctly, I couldn't install Lazarus 2.2.4 on on Ubuntu 20.04. That happened because Lazarus requires certain libraries (libc if my memory serves me well) but that version of Ubuntu can't support the version of the library needed to run Lazarus.

So, if you're installing recent versions of Lazarus on recent versions of Ubuntu, you shouldn't have any problem.

Lulu

  • Sr. Member
  • ****
  • Posts: 263
For your information, installing Lazarus on older versions of Ubuntu may failed. If I remember correctly, I couldn't install Lazarus 2.2.4 on on Ubuntu 20.04. That happened because Lazarus requires certain libraries (libc if my memory serves me well) but that version of Ubuntu can't support the version of the library needed to run Lazarus.
Hi Handoko, fpcupdeluxe install sucessfully Lazarus 2.2.4/FPC3.2.2 on Ubuntu 20.04. I use it on a virtual machine since several months.
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

TRon

  • Hero Member
  • *****
  • Posts: 3463
For your information, installing Lazarus on older versions of Ubuntu may failed. If I remember correctly, I couldn't install Lazarus 2.2.4 on on Ubuntu 20.04. That happened because Lazarus requires certain libraries (libc if my memory serves me well) but that version of Ubuntu can't support the version of the library needed to run Lazarus.
It has to do with the fact that the .deb package is compiled on a newer system that links against a newer libc and as such renders it incompatible with older Linux versions.

If you compile Lazarus from source then that is not a problem. The same applies for FPC but usually you can use your distro's FPC installation for that as bootstrap compiler (and work your way up). There comes a time that something goes wrong and therre is need to upload older deb files (that are compiled on a new system) and which will casue more such issues so it is good to know how to compile from source. Hopefully FPCUpDeluxe will keep a copy of all bootstrap compilers (though Don Alfredo is also experimenting with a patched FPC version to circumvent these libc issues).
This tagline is powered by AI

Handoko

  • Hero Member
  • *****
  • Posts: 5340
  • My goal: build my own game engine using Lazarus
Thanks Lulu and TRon for the information. Usually I use the latest stable versions, but for certain reason,  I needed to use latest Lazarus version on a 2-years-older version of Ubuntu.

FPCUpDeluxe maybe useful for some users but I personally don't need it. I am happy with only the latest version of Lazarus installed on my computer.

And about the libc issue, and yes, I learned how to compile from the source and the problem solved. I currently using the latest stable version of Lazarus and Ubuntu. Many Ubuntu releases have short support period, 6 months to 5 years. I learned from experience, it often fails if we're trying to install the software released outside their support period, this issue happens less on Windows.

PierceNg

  • Sr. Member
  • ****
  • Posts: 392
    • SamadhiWeb
The part that tripped me up when installing Lazarus from .deb is that Lazarus installs into 'system' locations, not writeable by the unprivileged user. Afterwards, clicking on 'clean up and rebuild all' on a project (which someone trying to use Lazarus for more than just look look see see is likely to do) would spew many lines of error messages and cause confusion.

For FPC, do install FPC from .deb or fpcupdeluxe. Rebuilding or trying out newer versions of FPC require an existing compiler to bootstrap anyway. But for Lazarus, I suggest git cloning Lazarus source, then building Lazarus in place.

Nel_Fie

  • New Member
  • *
  • Posts: 33
So, I've now installed Lazarus via fpcupdeluxe as suggested by Lulu, and it seems to have worked. There were a couple of details that tripped me up, so I'll double-post with an extended walkthrough adding my own remarks.

Recent versions of Lazarus can be installed on Ubuntu (and its variants) easily, you only need to download the 3 deb files and install them using the following order:
1. fpc
2. fpc-src
3. lazarus


GDebi Package Installer and Synaptic Package Manager are not needed. They only needed if something bad happened on your installation.

[...]

Thank you for providing an updated rundown. It seems easy enough indeed.

The part that tripped me up when installing Lazarus from .deb is that Lazarus installs into 'system' locations, not writeable by the unprivileged user. Afterwards, clicking on 'clean up and rebuild all' on a project (which someone trying to use Lazarus for more than just look look see see is likely to do) would spew many lines of error messages and cause confusion.

For FPC, do install FPC from .deb or fpcupdeluxe. Rebuilding or trying out newer versions of FPC require an existing compiler to bootstrap anyway. But for Lazarus, I suggest git cloning Lazarus source, then building Lazarus in place.

Thank you for the added information, this might be good to know in the future.

Nel_Fie

  • New Member
  • *
  • Posts: 33
CURRENT SOLUTIONS (as of 24.08.2023)

Two major ways to easily install Lazarus and FPC seem to be available. The one I've used (and thus can confirm works) is by using a tool called "fpcupdeluxe" and was recommended by Lulu in this post. I'm copying their step-by-step here with some additions of my own (in green) which tripped me up slightly.

SOLUTION 1 : FPCUPDELUXE
(Tested and used by myself)

1) Open a console and run the following command to install the prerequisites
Code: Pascal  [Select][+][-]
  1. sudo apt install make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev git
1.1) I've added "git" at the end of the command above, since it is also a prerequisite, but wasn't originally included in the command by Lulu. You can also install it separately after, it'll still work.
2) Create a folder fpcupdeluxe somewhere in /home/your_user_name, for example, I'm lulu so, for me it's /home/lulu/fpcupdeluxe
3) Dowload the fpcupdeluxe linux version here: https://github.com/newpascal/fpcupdeluxe/releases/latest and put it in the created folder
4) Run fpcupdeluxe-x86_64-linux
4.1) This is done by going to the location of the file (either by typing 'cd [THE PATH]' in the terminal, or simply right-clicking the location in the file explorer and clicking "Open in Terminal").
4.2) I don't know how necessary it is, but instructions I found explaining how to run a linux executable says you require additional permissions, which you can grant yourself with the command 'chmod a+x fpcupdeluxe-x86_64-linux' (n.b. 'fpcupdeluxe-x86_64-linux' does not include the extension unless it is actually part of the filename. The fpcupdeluxe file as downloaded does not include ".exe" in its name, so you don't need it.)
4.3) Then you can run the file by typing './fpcupdeluxe-x86_64-linux' (n.b. same as above, the extension ".exe" is not needed unless it's part of the file's actual name).

5) Choose a version for FPC and Lazarus, i.e. FPC3.2.2 Lazarus2.2.4 or simply click on STABLE button
5.1) Before installing remember to set your installation path at the top left, otherwise it will install to "/home/fpcupdeluxe/" by default.
6) click button "Install/Update FPC+Lazarus, wait...
7) when its done, close fpcupdeluxe and double click on the created Lazarus icon on your Ubuntu desktop.

SOLUTION 2 : THE BASIC

The most basic approach was suggested by Handoko in this post.

Recent versions of Lazarus can be installed on Ubuntu (and its variants) easily, you only need to download the 3 deb files and install them using the following order:
1. fpc
2. fpc-src
3. lazarus


GDebi Package Installer and Synaptic Package Manager are not needed. They only needed if something bad happened on your installation.

OTHER DETAILS

I recommend reading some of the posts above for more details or context-specific solutions, such as to how to deal with installation issues caused by previous versions.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8772
  • Programming + Glam Metal + Tae Kwon Do = Me
The part that tripped me up when installing Lazarus from .deb is that Lazarus installs into 'system' locations, not writeable by the unprivileged user. Afterwards, clicking on 'clean up and rebuild all' on a project (which someone trying to use Lazarus for more than just look look see see is likely to do) would spew many lines of error messages and cause confusion.
This should've long been fixed. Lazarus can detect if it's installed into system folders, and will not touch anything there, instead it will make .lazarus folder in your $HOME and store everything it builds there, from compiled units to customized Lazarus binaries, which will take precedence when you call startlazarus launcher.

 

TinyPortal © 2005-2018