[Lazarus] How to tell lazarus the location of a used package?

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Nov 22 09:26:04 CET 2010

On Mon, 22 Nov 2010 07:40:34 +0100
Bo Berglund <bo.berglund at gmail.com> wrote:

> On Mon, 22 Nov 2010 00:11:23 +0100, Mattias Gaertner
> <nc-gaertnma at netcologne.de> wrote:
> >On Sun, 21 Nov 2010 23:16:09 +0100
> >Bo Berglund <bo.berglund at gmail.com> wrote:
> >
> >> I *have* copied SdpoSerial from the original lazarus components dir
> >> into the new lazarus components dir. So what more do I need to do in
> >> order to get lazarus find the sdposerial package?
> >
> >Just open the SdpoSerialLaz.lpk once.
> >The "components" directory has no special meaning to the IDE. The
> >package can be anywhere on your disk.
> >
> Thanks, this solved the problem. But I would *never ever* have thought
> that the action of opening a file like this would be "sticky" for the
> future....
> What happens if one opens several different same-name lpk files in
> different locations just to see what they contain? Will Lazarus then
> use the last opened one? Seems very unsafe for the project to me....

Each dependency can be given a minimum and maximum version. So the IDE
will automatically open a compatible package when you open a
And if that is not sufficient you can even give a specific file name
(since 0.9.29). Right click in the project inspector on the dependency.

> >> I have intentionally NOT *installed* it in any of the Lazarus versions
> >> because it does not give me any visual object. But still if I use the
> >> original lazarus it manages to find sdposerial, but not with the SVN
> >> version.
> >
> >The IDE saves the locations of the lpk files in its config directory.
> What is the scope of this saving? For the currently open project or
> for all future and past projects too?

The IDE. So the scope is all projects and packages opened with this IDE.
If you open an IDE with another --primary-config-path you will get
another set.

> >> In Delphi 7 I used to set serach paths for units in my project options
> >> thus ensuring that I have full control over which version of common
> >> files were used by my application.
> >> But I cannot find a corrsponding property in the lazarus project
> >> options....
> >> There simply seems to be no place to set project specific paths at
> >> all. What good is project options if you cannot set the project search
> >> paths????
> >
> >The project specific search paths are in the compiler options. But the
> >directories of SdpoSerialLaz belong to SdpoSerialLaz, not to your
> >project. Just tell the IDE where the SdpoSerialLaz.lpk is and let
> >Lazarus handle the search paths automatically.
> Extremely strange that just opening the file will "tell" Lazarus where
> the files are for the forseeable future....

It's pretty flexible and comfortable and was done so because of the
bad experiences with Delphi. 
For example sharing projects/packages is much easier. You don't need to
adapt any search path.
Some people want this system even for units: "Why can't the IDE find a
unit? I just opened it!"


More information about the Lazarus mailing list