Recent

Author Topic: Compiling 2 dependent packages fails  (Read 437 times)

Sergey Tkachenko

  • New Member
  • *
  • Posts: 45
    • TRichView
Compiling 2 dependent packages fails
« on: January 23, 2025, 05:30:45 pm »
I have 3 packages, A, B, and C.
B requires A; C requires A too.

I compile them in order: A, B, C.
When I compile them on Linux (Lazarus 3.8 ), I got errors when compiling the last package, C. Lazarus says that it cannot find some unit belonging to package A (incompatible PPU, or unit not found, or checksum changed).
After spending some time, it seems I found the reason. When I compile package B, Lazarus recompiles units of package A that are used by package B. The rest of units of package A become incompatible with these recompiled units.

As a workaround, I added all units of package A in "uses" of unit of package B, even though they are not needed there. Now all units of package A are recompiled when compiling package B, so I can compile all packages.

But is there more elegant solution?

wp

  • Hero Member
  • *****
  • Posts: 12595
Re: Compiling 2 dependent packages fails
« Reply #1 on: January 23, 2025, 07:36:33 pm »
Put the files of each package into separate folders, even the output directories of each package should be different. No package is allowed to have a path into the folders of the other packages.  A package must not have any access to source files of other packages. A package should list in its tree only the source files of itself. But a package can list the other packages under its requirements.

In total: Package A is not allowed to list packages B and C as requirements. But packages B lists A as a requirement and C list A as well.

Before compilation delete the old output directories since they might contain compiled units from other packages. Then compile the packages in the order A, B, C (or A, C, B - should not make a difference).

Take a look at the structure of JvclLaz (it is in OPM), which consists of more than 30 partially interdependent packages.

Sergey Tkachenko

  • New Member
  • *
  • Posts: 45
    • TRichView
Re: Compiling 2 dependent packages fails
« Reply #2 on: January 23, 2025, 08:36:59 pm »
Thank you! Moving all packages to separate directories fixed the problem.

 

TinyPortal © 2005-2018