[Lazarus] Projects in a directory hierarchy - what is allowed?

Bo Berglund bo.berglund at gmail.com
Mon Feb 3 14:13:27 CET 2020

On Mon, 3 Feb 2020 11:29:15 +0100, Mattias Gaertner via lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>On Sun, 02 Feb 2020 23:50:59 +0100
>Bo Berglund via lazarus <lazarus at lists.lazarus-ide.org> wrote:
>> It was started on Raspbian, but I had problems with the Lazarus IDE
>> (it crashes regularly several times a day and then I lose all edits
>> since the last save).
>Can you create stacktraces of the crashes?

I think I need to run lazarus from the debugger in that case, right?
I tried this before (see my thread started Nov 1, 2019 about this:
"Lazarus 2.0.6 IDE suddenly disappeared losing a lot of edits...")

>> If I now open the project in Lazarus and command Compile, build or
>> Quick compile an error is triggered telling me that a file not used by
>> my project cannot find its Linux-only units in the uses clause....
>> Here the show stops!
>Does a clean build work? For example "Run / Clean up and build ..."?

When I start this I get to a dialog where the files that will be
deleted are listed and there is basically everything about lazarus.
Did not dare do that, is there some way to limit the number of files
to "clean"?

>> It complains that it cannot find some unix-only units inside the
>> sourcefile PiGpio.pas, which is used by another project residing one
>> level up in the tree from the working dir of the current project.
>Compile with flag -vt to find out why the compiler uses PiGpio.pas.

How do I set a "flag" like that? I am compiling through use of the
menu command Run/build or run/compile....

>Or in Lazarus use View  / Unit Dependencies.
>Click left on PiGpio.pas and look on the right for "used by ...".

You mean after the problem has appeared and PiGpio appears?
After my rename of PiGpio it no longer appears, instead a file uses
PiGpio and which does not belong to my project either...

>> Questions:
>> 1) Is it not allowed to use source files *above* the current project
>> dir?
>Of course it is allowed.

Can I add a file to uses without also making the directory it is in
available for general browsing by Lazarus or the compiler?
I don't want Lazarus to find a bunch of other files located next to
the two I need....
I tried using ../unitname in my uses clause but then Lazarus barfs at
that syntax instead.

>> 2) If I add a path .. via project properties does this really mean
>> that Lazarus will try to compile ALL source files found there even if
>> only a couple are part of the current project?
>No. FPC will compile only sources used by your project - direct and
>indirect. Maybe you have some indirect dependency or some old ppu file.

Well, I don't know about that, but how could that happen?
I moved the project files between the systems using subversion only.
>> 3) What can I do to remedy this problem?
>1. compile clean and check if this makes a difference
>2. Compile with -vt flag.
>3. Check View / Unit dependencies
>4. Since you are using Windows and Unix and have mixed case unit names,
>you must make sure, that all uses sections use the correct case.

I have noted that when I create a unit in linux and name it say
SomeUnit, it gets saved as someunit.pas but the name still remains
SomeUnit inside Lazarus. THis is very strange to me and I don't know
what to do about it...
Seems to work fine anyway inside raspbian linux based Lazarus.

>5. give us more information, e.g. directory listings

The whole file tree, you mean?
>From the top of the master project?

Bo Berglund
Developer in Sweden

More information about the lazarus mailing list