Re: [Lazarus] Lazarus fails to build

2023-03-19 Thread Sven Barth via lazarus
Martin Frb via lazarus  schrieb am So., 19.
März 2023, 20:57:

> On 19/03/2023 19:53, Sven Barth via lazarus wrote:
> >  If it *would* work however you could simply do {$if not
> > declared(name_of_the_unit)}, because the unit name is also a valid
> > symbol.
>
> ooohh nooo. That would be like C header files Don't wont that. ;)
>

It's you who brought out the ifdef idea and I simply pointed out a more
correct solution than picking some random symbol in the unit.

Regards,
Sven

>
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Lazarus fails to build

2023-03-19 Thread Mattias Gaertner via lazarus
On Sun, 19 Mar 2023 01:50:26 +0100
Mattias Gaertner via lazarus  wrote:

>[...]
> Note that when a base package is renamed or a new one is added it
> will still need a clean build using make. 

The IDE now detects such changes, warn the user and offers to build
using make distclean, make lazbuild and lazbuild --build-ide=


Mattias
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Lazarus fails to build

2023-03-19 Thread Martin Frb via lazarus

On 19/03/2023 19:53, Sven Barth via lazarus wrote:
 If it *would* work however you could simply do {$if not 
declared(name_of_the_unit)}, because the unit name is also a valid 
symbol.


ooohh nooo. That would be like C header files Don't wont that. ;)
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Lazarus fails to build

2023-03-19 Thread Sven Barth via lazarus

Am 19.03.2023 um 09:36 schrieb Martin Frb via lazarus:

On 19/03/2023 00:00, Michael Van Canneyt via lazarus wrote:


On Sat, 18 Mar 2023, Mattias Gaertner via lazarus wrote:



As this happens seldom there is no detection built in (yet) to handle
this automatically.


If possible, might be a good idea.


Afaik there are 2 scenarios.

1) The duplicate.
The user has the package installed, that now became a base package. So 
units are used twice.


For this there may be a very simple solution.
- staticpackes is used by lazarus.pp
- So we could add new core-packackage-units to a different unit's use 
clause. Then they don't appear twice in the same uses clause.
E.g. we could add a unit LazCorePackages, and that just contains a 
uses clause.  It would be used first in the uses of lazarus.pp.


It may also be able to do some trickery with IFDEF.
If core packages are in the lazarus.pp uses clause, appearing only 
after staticpackages, then there could be {$IF not 
defined(symbol_from_new_core_unit)}.

Haven't tested that, don't know if it would actually work.


It would not, because FPC loads the units only at the of the uses clause 
and not once for every unit it finds. This is an incompatibility with 
Delphi, but currently there's no real desire to change that as it only 
affects such uses-clause trickery. If it *would* work however you could 
simply do {$if not declared(name_of_the_unit)}, because the unit name is 
also a valid symbol.


Regards,
Sven
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Lazarus fails to build

2023-03-19 Thread Martin Frb via lazarus

On 19/03/2023 00:00, Michael Van Canneyt via lazarus wrote:


On Sat, 18 Mar 2023, Mattias Gaertner via lazarus wrote:



As this happens seldom there is no detection built in (yet) to handle
this automatically.


If possible, might be a good idea.


Afaik there are 2 scenarios.

1) The duplicate.
The user has the package installed, that now became a base package. So 
units are used twice.


For this there may be a very simple solution.
- staticpackes is used by lazarus.pp
- So we could add new core-packackage-units to a different unit's use 
clause. Then they don't appear twice in the same uses clause.
E.g. we could add a unit LazCorePackages, and that just contains a uses 
clause.  It would be used first in the uses of lazarus.pp.


It may also be able to do some trickery with IFDEF.
If core packages are in the lazarus.pp uses clause, appearing only after 
staticpackages, then there could be {$IF not 
defined(symbol_from_new_core_unit)}.

Haven't tested that, don't know if it would actually work.


2) The "unit not found"
The user does not have the package installed, yet.
Say when we added IdeDebugger package. This would have added units to 
the "core" uses clause.

But not only. Units of IdeDebugger are used throughout the entire IDE code.
And if you do not have that package installed (and use an old IDE, that 
does not have it as core yet), then the package's path is not in the 
list of unit-search paths.

So you will get "unit not found" errors.
To rebuild, you must first install the package that will become core.

Not sure how an old IDE can learn about that.

(The point (2) does not happen with every package. If the package is 
just used, so it can register itself, then that will be fine.)

E.g.
- LazDebuggerFpLldb => core, but only registration
- SynEdit => core, and units get used

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Lazarus fails to build

2023-03-19 Thread Michael Van Canneyt via lazarus




On Sun, 19 Mar 2023, Mattias Gaertner via lazarus wrote:


On Sun, 19 Mar 2023 00:00:02 +0100 (CET)
Michael Van Canneyt  wrote:


[...]

As this happens seldom there is no detection built in (yet) to
handle this automatically.


I added a simple detection, so in the future the IDE will not add base
packages to staticpackages.inc.

I also added some comments.


Thank you !

I pulled you changes and rebuilt, all recompiles without issues.
And the comments will definitely give a hint as how to proceed in case it still 
goes
wrong...

Michael.
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus