Recent

Author Topic: How to install a package from source?  (Read 5429 times)

Nel_Fie

  • New Member
  • *
  • Posts: 15
How to install a package from source?
« on: October 20, 2021, 02:27:56 pm »
01/11/2021 : Current correct answer

How do I install a package from its source files?

As practice I've been trying to install the generics.collection library but I can't figure it out. What I could find on the Lazarus wiki suggests I should be using fppkg, but if I follow the instructions described at step 5, I get the following error:

Quote
The FPC Package tool encountered the following error:
[<currentdir>] Package "rtl" is not installed

My best guess is that this is due to PATH not being set up correctly, and fppkg not being able to find rtl as a result. That said, the whole approach might be incorrect, so I welcome any step-by-step walkthrough on how to install such a package from scratch.

NB: I'm entirely new to Free Pascal and Lazarus, and I don't have a formal education in programming. I've been mostly using Python as a hobbyist, and I'm trying FP and Lazarus as a renewed foray into compiled languages. As a result I lack a lot of vocabulary and what might be considered "common sense" or "basic knowledge" to a professional, so feel free to use the simplest English you can muster.
« Last Edit: November 01, 2021, 12:19:52 pm by Nel_Fie »

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: How to install a package from source?
« Reply #1 on: October 20, 2021, 03:22:03 pm »
You must look for the rigth package :-) fpc have its packagemanagment and Lazarus a different.

If you know nothing about fpc packagemanagment, dont use it. A normal Lazarus user did not use the fpc managment.

So my question is, are you working with fpc only or are you working with Lazarus ?!


in Lazarus you must only
Code: Pascal  [Select][+][-]
  1. ...
  2. uses fgl;
  3. ...
  4. TSpecList = specialize TFPGList<TCycle>;
  5. ...
  6.   LoadSpecList : TSpecList ;
  7. ...
use fgl

https://wiki.lazarus.freepascal.org/Generics
« Last Edit: October 20, 2021, 03:27:57 pm by af0815 »
regards
Andreas

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: How to install a package from source?
« Reply #2 on: October 20, 2021, 05:03:52 pm »
There is a difference in syntax in mode Delphi. Some code requires that to work.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: How to install a package from source?
« Reply #3 on: October 20, 2021, 08:38:39 pm »
As practice I've been trying to install the generics.collection library but I can't figure it out.
Generics.Collections library is now included in FPC distribution. You can use it directly without installing anything extra.
The library is originally from Maciej Izak.

The fgl mentioned by af0815 is an older and more limited generics library. Still very useful for many purposes. It is used also in Lazarus sources in many places.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: How to install a package from source?
« Reply #4 on: October 21, 2021, 07:10:39 am »
The fgl mentioned by af0815 is an older and more limited generics library. Still very useful for many purposes. It is used also in Lazarus sources in many places.
Then the wiki should be updated to the actual version.
regards
Andreas

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: How to install a package from source?
« Reply #5 on: October 21, 2021, 10:25:23 am »
Then the wiki should be updated to the actual version.
Actually it mentions a rtl-generics package but does not explain how to use it.
Usage is not intuitive as the unit name is Generics.Collections while the package / library is rtl-generics.
It says FPC 3.1.1.+ while FPC 3.2+ might be better now.
So yes, the wiki should be updated. It should have simple code examples like for the fgl.
I hope somebody volunteers to update it.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

af0815

  • Hero Member
  • *****
  • Posts: 1289
regards
Andreas

Nel_Fie

  • New Member
  • *
  • Posts: 15
Re: How to install a package from source?
« Reply #7 on: October 21, 2021, 02:18:43 pm »
Thank you all for the replies, you have helped shed some light on the issue.

While I intended to use that particular library for something, my main concern right now is to figure out how to install packages, so that I may use then in Lazarus. If understand af0815 correctly, fppkg is not the right tool to do this - what should I be using then?

Would that be the OPM, or are there other utilities?

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: How to install a package from source?
« Reply #8 on: October 21, 2021, 06:42:53 pm »
OPM for Lazarus is the starting point for you.
regards
Andreas

Nel_Fie

  • New Member
  • *
  • Posts: 15
Re: How to install a package from source?
« Reply #9 on: October 22, 2021, 01:37:16 pm »
Very well, thank you! I'll be giving it a test A.S.A.P.

Nel_Fie

  • New Member
  • *
  • Posts: 15
Re: How to install a package from source?
« Reply #10 on: November 01, 2021, 12:18:44 pm »
/*This post is provided for users dealing with a similar issue, as well as future reference. Reply not required*/

As the answers kindly provided above make clear, there is a distinct difference between Free Pascal and Lazarus. When it comes to packages specifically, a Lazarus package is provided as or containing an *.lpk file.

As for how to install it, here is a page providing instructions: link

Before you can use the package in a project however, you need to mark it as a dependency. This is done in the Project Inspector (Project>Project Inspector). It has a page on the wiki, but it doesn’t contain much information at time of writing.

EDIT: You can find additional information on packages on the Lazarus Packages, including the bit below - but it covers a broad range of topics in a somewhat unordered manner, so I recommend looking through every section even if you're seaching for something specifc.

In the Project Inspector window, click on “Add” (most top left button) and choose “New Requirement”.  This opens a new window with a list of available packages. In the list, find the package you wish to add and click “OK”.
The package should now appear in the Project Inspector, in the “Required Packages” section, and you should now be able to use the package in your project without any errors upon compilation.

Also, here’s a general note on using the Free Pascal/Lazarus wiki: the main page is divided into a “Free Pascal” section on the left, and a “Lazarus” section on the right. Many tutorials and other information from the left section are specific to Free Pascal, and do not apply to Lazarus (and vice-versa).
I know this seems obvious, but I didn’t pay attention to that, and ended up reading documentation that is not relevant to Lazarus. So if you’re using the wiki, don’t make the same mistake I did!
« Last Edit: November 01, 2021, 06:18:28 pm by Nel_Fie »

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: How to install a package from source?
« Reply #11 on: November 01, 2021, 04:06:53 pm »
+1 for the feedback
regards
Andreas

 

TinyPortal © 2005-2018