Recent

Author Topic: Packaging lazarus-based software for Linux distributions - 3rd party components  (Read 8186 times)

sash

  • Sr. Member
  • ****
  • Posts: 366
Quote from: FangQ
Units that was referred using its absolute path, and I copied those in a subfolder in my project's folder, and changed the lpi Units section and replaced the path with the relative local path
https://github.com/fangq/mcx/commit/9f18ccb2049d73ba1df0d4dd6e198271172474e1#diff-1eaacebea919f98b6105117358e60a44

As I can see unit paths are still in relative (but long enough) format.

Quote from: FangQ
I do not see any of the GLScene units (*.pas) were compiled in the command line output,
How do you use those units (and all stuff declared there) in your code then?

Quote from: FangQ
lazbuild also emit the following warning:
Code: Bash  [Select][+][-]
  1. .../mcxstudio.lpr(10,10) Hint: (5023) Unit "GLScene_RunTime" not used in mcxstudio
I did not copy the GLScene_RunTime.lpk file to my project.
The above message was about  unit GLScene_RunTime.(pas), not package. And as I see a purpose of this unit is to place all these GL*.pas units in its uses section.

Look, your project is complex enough and I'm unable to make a full review of it. But I'd recommend you to make a minimal glscene test project and work out automated build on something simple, so you'll get used to build modes, paths, side libraries and so on.

My personal approach is something like this: I have some of the "Release" modes dedicated solely for automated build, where I have all 3rd party packages and units removed from project (lpi), although their search paths are still there. This way they (3rd party units) are still being compiled as needed, because they are included in uses sections in particular places of my units.
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

FangQ

  • Full Member
  • ***
  • Posts: 134
As I can see unit paths are still in relative (but long enough) format.

true, but those were pointed to a non-portable folder that only exists on my local computer. But now I am confused, what's the meaning of the "<Units>...</Units>" section? are those the units to be compiled in this project or just the editor opened tabs?

Quote from: sash
How do you use those units (and all stuff declared there) in your code then?

there are only two places that the GLScene unit names are involved, one is in the lpr:

https://github.com/fangq/mcx/blob/etherdome/mcxstudio/mcxstudio.lpr#L10

the other is the uses section of the rendering window at

https://github.com/fangq/mcx/blob/master/mcxstudio/mcxrender.pas#L15-L19

I don't think there are other places they are needed.

Quote from: sash
Quote from: FangQ
lazbuild also emit the following warning:
Code: Bash  [Select][+][-]
  1. .../mcxstudio.lpr(10,10) Hint: (5023) Unit "GLScene_RunTime" not used in mcxstudio
I did not copy the GLScene_RunTime.lpk file to my project.
The above message was about  unit GLScene_RunTime.(pas), not package. And as I see a purpose of this unit is to place all these GL*.pas units in its uses section.

Look, your project is complex enough and I'm unable to make a full review of it. But I'd recommend you to make a minimal glscene test project and work out automated build on something simple, so you'll get used to build modes, paths, side libraries and so on.

My personal approach is something like this: I have some of the "Release" modes dedicated solely for automated build, where I have all 3rd party packages and units removed from project (lpi), although their search paths are still there. This way they (3rd party units) are still being compiled as needed, because they are included in uses sections in particular places of my units.

Here is what I have tried, I logged on my computer (installed lazarus 1.8.3, with a recompiled lazarus-gui binary after installing glscene from my own account) with an account different from mine, then, when I run lazbuild mcxstudio.lpi, I got the below error as the 3rd line output from lazbuild

Code: Pascal  [Select][+][-]
  1. Error: (lazbuild) Broken dependency: GLScene_RunTime

I need to understand what changes I need to make to let lazbuild know where to find the needed glscene units. You are right, the GLScene_RunTime contains nearly all .pas units in the package, as you can see from here

https://sourceforge.net/p/glscene/code/HEAD/tree/branches/GLSceneLCL/Packages/GLScene_RunTime.pas

does that mean I need to copy all .pas units that is shown in the uses section of GLScene_RunTime.pas into my project folder in order for lazbuild to compile them? (actually, I tried that, but it still gave me the same error).

for a small reproducer, you can checkout the mcxshow.lpi project under the same folder, it contains only 1 window involving glscene.

https://github.com/fangq/mcx/blob/etherdome/mcxstudio/mcxshow.lpr
« Last Edit: September 25, 2018, 12:23:38 am by FangQ »

sash

  • Sr. Member
  • ****
  • Posts: 366
Quote from: FangQ
But now I am confused, what's the meaning of the "<Units>...</Units>" section? are those the units to be compiled in this project or just the editor opened tabs?

IMO, not necessarily opened in editor, but yes, it is rather a method to organize files belonging to a project than "to compile" list.
Units to be compiled are those which listed in uses sections of other units in the source tree starting from the main unit (.lpr)
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

FangQ

  • Full Member
  • ***
  • Posts: 134
IMO, not necessarily opened in editor, but yes, it is rather a method to organize files belonging to a project than "to compile" list.
Units to be compiled are those which listed in uses sections of other units in the source tree starting from the main unit (.lpr)

If those are the "to compile", then my locally copied GLScene units should be fine; however, right now, "lazbuild mcxshow.lpi" gave me the following error

Code: Pascal  [Select][+][-]
  1. Error: (lazbuild) Broken dependency: GLScene_RunTime

and it looks like a result from the "RequiredPackages" section. How should I make lazbuild aware of this package? what file does it look for? *.pas or *.lpk or the compiled .ppl?

Code: Pascal  [Select][+][-]
  1.     <RequiredPackages Count="4">
  2.       <Item1>
  3.         <PackageName Value="GLScene_RunTime"/>
  4.       </Item1>
  5.       <Item2>
  6.         <PackageName Value="GLScene_DesignTime"/>
  7.       </Item2>
  8.       <Item3>
  9.         <PackageName Value="SynEdit"/>
  10.       </Item3>
  11.       <Item4>
  12.         <PackageName Value="LCL"/>
  13.       </Item4>
  14.     </RequiredPackages>
  15.  

I copied the GLSceneLCL/Packages/GLScene_RunTime.pas file to my project folder, but it still gave me that error.

sash

  • Sr. Member
  • ****
  • Posts: 366
If those are the "to compile", then my locally copied GLScene units should be fine; however, right now, "lazbuild mcxshow.lpi" gave me the following error
Code: [Select]
Error: (lazbuild) Broken dependency: GLScene_RunTime

I see no controversy here: "broken dependency" is not about units, it is about package. Remove package from project (in corresponding Build Mode) and this error will disappear.

As I said before for automated builds:
  0) Try something simple, and you will learn how it works. 
  1) You don't need packages, only units.
  2) Use dedicated Build Mode, and remove ALL packages from there, leave only paths to source units.

p.s. In fact, you don't need lazbuild either. Pure fpc (on source units) will work, but then you have to maintain all these switches in commandline manually.
      Lazbuild is just a convenient tool to reuse already existing project.


Upd: there's
Code: [Select]
-d or --skip-dependencies
  do not compile dependencies
option for lazbuild. Looks like it forces to ignore project dependencies (packages).
« Last Edit: September 26, 2018, 12:40:02 pm by sash »
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

FangQ

  • Full Member
  • ***
  • Posts: 134
As I said before for automated builds:
  0) Try something simple, and you will learn how it works. 
  1) You don't need packages, only units.
  2) Use dedicated Build Mode, and remove ALL packages from there, leave only paths to source units.

p.s. In fact, you don't need lazbuild either. Pure fpc (on source units) will work, but then you have to maintain all these switches in commandline manually.
      Lazbuild is just a convenient tool to reuse already existing project.

I think I finally got it. thank you so much for your patient replies.

I removed the GLScene_RunTime from the packages section in the .lpi and the uses section of the .lpr file. Then, I run the lazbuild myproj_nopkg.lpi iteratively to copy the dependent GLScene units to my project folder, one by one. in the end, I was able to recompile my project in a user profile without a recompiled lazarus-ide and lazbuild.

now, one dumb question left, the GLScene units are now stored in the same folder as my .lpr/lpi files, which makes the folder a little bit messy. I moved those in the subfolder GLSceneLCL/* , then I changed the below link in the .lpi file from

Code: Pascal  [Select][+][-]
  1.       <IncludeFiles Value="$(ProjOutDir)"/>
to

Code: Pascal  [Select][+][-]
  1.       <IncludeFiles Value="$(ProjOutDir);GLSceneLCL"/>

but still lazbuild fail to find those units in the subfolder. how can I tell lazbuild to search for the GLSceneLCL subfolder?

Quote
Upd: there's
Code: [Select]
-d or --skip-dependencies
  do not compile dependencies
option for lazbuild. Looks like it forces to ignore project dependencies (packages).

tried that, does not work well if I do not remove GLScene_RunTime package because it still looks for GLScene_RunTime.pas, which depends in essentially every unit.

sash

  • Sr. Member
  • ****
  • Posts: 366
Should be OtherUnitFiles
Code: XML  [Select][+][-]
  1. <SearchPaths>
  2.   <OtherUnitFiles Value="libs/path1;libs/path2"/>
  3. </SearchPaths>
  4.  
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

 

TinyPortal © 2005-2018