Recent

Author Topic: Lazarus doesn't recompile changed units  (Read 8060 times)

FLLSilva

  • New Member
  • *
  • Posts: 11
Re: Lazarus doesn't recompile changed units
« Reply #30 on: October 01, 2020, 07:01:02 pm »
Regardless of datetime comparison problems, or code sharing, shouldn't the BUILD function compile all units regardless of whether they have been changed or not? In that case, wouldn't that be considered a bug in the compiler?

I've already set up Lazarus to run a routine to clean the lib folder before each build, I waste a few seconds in this process each time I send it, but I'm more sure that everything is being done correctly.

But I believe that this issue of the project's build should be analyzed by the FPC team to identify what else could be influencing this problem. Today, at least here for me, the build is working exactly like the compile.

Thank you Handoko.

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: Lazarus doesn't recompile changed units
« Reply #31 on: October 01, 2020, 07:13:03 pm »
Maybe no one ever reported this issue before you, it happens extremely rare. Without enough information, nothing can be done.

Anyways, thank you for providing the information.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Lazarus doesn't recompile changed units
« Reply #32 on: October 01, 2020, 07:18:11 pm »
A = Yes, I have source files distributed in several subfolders, but all within the main project folder.
       Example: <projDir>\Source, <projDir>\Source\Server, <projDir>\Source\Client, <projDir>\Source\Client\Views, <projDir>\Source\Client\Models, <projDir>\Source\Client\Controllers, etc.
       But all of these units are properly inserted in the project's .lpr file.
They are in the .lpr file, but are the paths also in the "Other unit files (-Fu)" settings?
Project options -> Compiler options -> Paths.

This may be out of topic but I highly recommend using Lazarus packages for library code!
A Lazarus package is more advanced than a Delphi package. When you set a dependent package for a project, the package injects its search paths into the project. You don't need to set them anywhere else.
The IDE remembers the location of a package after seeing it once. You don't need to search it from directory structures after that.
I am sorry to say but you have configured your project in a dummy way. :(

Quote from: Handako
Yep, if I remember correctly in my cases they all used shared library codes, which should be made as packages. I didn't because those codes were frequently changed and improved. Making them packages means I had to do extra steps.
What is the extra step?
A unit belonging to a package can be changed as easily as a unit belonging to a project.
Dependent packages of a project, and the project itself, are compiled automatically when they are changed.
« Last Edit: October 01, 2020, 07:29:12 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: Lazarus doesn't recompile changed units
« Reply #33 on: October 01, 2020, 07:47:10 pm »
For example I had a project SideNote.lpr, it used a unit uniData.pas.

The uniData is a shared library that handle data generation, reading and writing using TDBF. It also used by some of my other projects. Because the uniData.pas was just at its proof-of-concept stage, when developing the SideNote, I needed frequently to modify and add new features for uniData. Lazarus IDE allow us to edit multiple sources easily by opening and showing them as tabs on the Source Editor window.

If I make uniData as a package. When developing SideNote.lpr and I need to edit something on uniData, I have to open the package, edit and compile it. And then reopen SideNote.lpr again to continue developing.

Also, I frequently use undo feature especially when test new idea. But if I open a new project or package, I will lost the undos.

The package concept is great but not very suitable for me. When I write a module I rarely just focus writing it. I usually will choose a real project, so at the same time I am developing the module I also writing a project that using it.
« Last Edit: October 01, 2020, 07:55:57 pm by Handoko »

Sieben

  • Sr. Member
  • ****
  • Posts: 310
Re: Lazarus doesn't recompile changed units
« Reply #34 on: October 01, 2020, 07:56:56 pm »
I'm currently working on a few components that need to be installed in a package to be used. But I don't have to explicitly recompile that package to test new code. As JuhaManninen said it is automatically recompiled with every project recompile. Only when I introduce new published properties I need an explicit rebuild of the IDE of course to have them show up in OI. So I don't see any drawbacks in making your libraries a package. Only that the IDE posts a funny question when first installing a package that has no register procedure...
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: Lazarus doesn't recompile changed units
« Reply #35 on: October 01, 2020, 08:06:08 pm »
Really? Then I should try.
Thank you for the information.

Sieben

  • Sr. Member
  • ****
  • Posts: 310
Re: Lazarus doesn't recompile changed units
« Reply #36 on: October 01, 2020, 08:28:53 pm »
And when I consider this:

Quote from: JuhaManninen
The IDE remembers the location of a package after seeing it once.

it seems it doesn't even have to be installed, just 'packed' and compiled once. And that can be done without even leaving the current project.
« Last Edit: October 01, 2020, 08:36:29 pm by Sieben »
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Lazarus doesn't recompile changed units
« Reply #37 on: October 01, 2020, 08:32:19 pm »
I am able to reproduce with even a very small project.

How to:
Unzip attached project, open all units in Source Editor (unit1.,pas, unit2.pas and project1.lpr).
Open Console In/Output debug window (Ctrl+Alt+O).

Step 1: Change text in unit1
Code: Pascal  [Select][+][-]
  1.   writeln('Unit1 Click aaaaaaaaa');
  and do not save file!

Step 2: Switch to tab unit2 and change text
Code: Pascal  [Select][+][-]
  1. writeln('create bbbbbb');

Step 3: Do Quick Compile (from menu or by short cut). Note that both files are saved now.

Step 4: Change text again
Code: Pascal  [Select][+][-]
  1. writeln('create bbbbbb ccccc');

Step 5: Run project and click button. The output is:
Code: Pascal  [Select][+][-]
  1. create bbbbbb ccccc
  2. Unit1 Click

 >:( >:( >:( Where is "aaaaaaaaa" added in Step 1?  >:( >:( >:(
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: Lazarus doesn't recompile changed units
« Reply #38 on: October 01, 2020, 08:47:52 pm »
@Sieben

Yes, it works. I am changing the way I work now. Thank you.

@Blaazen

I opened the project you provided. Nothing showed in the Project Inspector. I'm using Lazarus 2.0.10 Linux.

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Lazarus doesn't recompile changed units
« Reply #39 on: October 01, 2020, 09:07:04 pm »
@ Handoko

Here Project Inspector shows three files and LCL dependency.  IMO zip contains all necessary files.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: Lazarus doesn't recompile changed units
« Reply #40 on: October 01, 2020, 09:16:41 pm »
It is empty on my Object Inspector.

I sometimes have problems opening projects posted on the forum. They're just empty. I believe the problems have something to do with the version difference of the Lazarus we're using.

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Lazarus doesn't recompile changed units
« Reply #41 on: October 01, 2020, 09:37:48 pm »
Info for Project Inspector should be in *.lpi file. Anyway, you can test this issue because the steps I described "works" for any project.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: Lazarus doesn't recompile changed units
« Reply #42 on: October 01, 2020, 09:43:11 pm »
Just tested it again. I re-downloaded the zip file, uncompressed it and opened the project1.lpi. Still nothing showed on my Object Inspector.

I'm using Lazarus 2.0.10. The projects files created using my Lazarus have Project Options > Version Value = 11. Simply modifying the value does not work. I remember there was a project info converter posted on the forum not long ago. But I miss it.

This is  your project1.lpi opened using a text editor:

Code: Pascal  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <CONFIG>
  3.   <ProjectOptions>
  4.     <Version Value="12"/>
  5.     <General>
  6.       <SessionStorage Value="InProjectDir"/>
  7.       <Title Value="project1"/>
  8.       <Scaled Value="True"/>
  9.       <ResourceType Value="res"/>
  10.       <UseXPManifest Value="True"/>
  11.       <Icon Value="0"/>
  12.     </General>
  13.     <MacroValues Count="1">
  14.       <Macro1 Name="LCLWidgetType" Value="qt"/>
  15.     </MacroValues>
  16.     <BuildModes>
  17.       <Item Name="Default" Default="True"/>
  18.       <Item Name="Final">
  19.         <CompilerOptions>
  20.           <Version Value="11"/>
  21.           <Target>
  22.             <Filename Value="ecsas"/>
  23.           </Target>
  24.           <SearchPaths>
  25.             <IncludeFiles Value="include;$(ProjOutDir)"/>
  26.             <OtherUnitFiles Value=".;frames;portaudio;xxhash"/>
  27.             <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
  28.           </SearchPaths>
  29.           <Parsing>
  30.             <SyntaxOptions>
  31.               <CStyleOperator Value="False"/>
  32.               <AllowLabel Value="False"/>
  33.             </SyntaxOptions>
  34.           </Parsing>
  35.           <CodeGeneration>
  36.             <SmartLinkUnit Value="True"/>
  37.             <TargetCPU Value="x86_64"/>
  38.             <TargetOS Value="linux"/>
  39.             <Optimizations>
  40.               <OptimizationLevel Value="3"/>
  41.               <VariablesInRegisters Value="True"/>
  42.               <UncertainOptimizations Value="True"/>
  43.             </Optimizations>
  44.           </CodeGeneration>
  45.           <Linking>
  46.             <Debugging>
  47.               <GenerateDebugInfo Value="False"/>
  48.               <DebugInfoType Value="dsStabs"/>
  49.               <StripSymbols Value="True"/>
  50.             </Debugging>
  51.             <LinkSmart Value="True"/>
  52.           </Linking>
  53.           <Other>
  54.             <Verbosity>
  55.               <ShowNotes Value="False"/>
  56.               <ShowHints Value="False"/>
  57.             </Verbosity>
  58.             <CustomOptions Value="-godwarfsets"/>
  59.           </Other>
  60.         </CompilerOptions>
  61.       </Item>
  62.       <SharedMatrixOptions Count="4">
  63.         <Item1 ID="775240689950" Modes="Default" Type="IDEMacro" MacroName="LCLWidgetType" Value="qt"/>
  64.         <Item2 ID="083542331135" Type="IDEMacro" MacroName="LCLWidgetType" Value="gtk2"/>
  65.         <Item3 ID="605968800907" Modes="Default" Value="-dEnableUTF8RTL"/>
  66.         <Item4 ID="236377512695" Type="IDEMacro" MacroName="LCLWidgetType" Value="qt5"/>
  67.       </SharedMatrixOptions>
  68.     </BuildModes>
  69.     <PublishOptions>
  70.       <Version Value="2"/>
  71.       <UseFileFilters Value="True"/>
  72.     </PublishOptions>
  73.     <RunParams>
  74.       <FormatVersion Value="2"/>
  75.     </RunParams>
  76.     <RequiredPackages>
  77.       <Item>
  78.         <PackageName Value="LCL"/>
  79.       </Item>
  80.     </RequiredPackages>
  81.     <Units>
  82.       <Unit>
  83.         <Filename Value="project1.lpr"/>
  84.         <IsPartOfProject Value="True"/>
  85.       </Unit>
  86.       <Unit>
  87.         <Filename Value="unit1.pas"/>
  88.         <IsPartOfProject Value="True"/>
  89.         <ComponentName Value="Form1"/>
  90.         <ResourceBaseClass Value="Form"/>
  91.         <UnitName Value="Unit1"/>
  92.       </Unit>
  93.       <Unit>
  94.         <Filename Value="unit2.pas"/>
  95.         <IsPartOfProject Value="True"/>
  96.         <UnitName Value="Unit2"/>
  97.       </Unit>
  98.     </Units>
  99.   </ProjectOptions>
  100.   <CompilerOptions>
  101.     <Version Value="11"/>
  102.     <SearchPaths>
  103.       <IncludeFiles Value="$(ProjOutDir)"/>
  104.       <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
  105.     </SearchPaths>
  106.     <Parsing>
  107.       <SyntaxOptions>
  108.         <CStyleOperator Value="False"/>
  109.         <AllowLabel Value="False"/>
  110.       </SyntaxOptions>
  111.     </Parsing>
  112.     <CodeGeneration>
  113.       <Checks>
  114.         <IOChecks Value="True"/>
  115.         <RangeChecks Value="True"/>
  116.         <OverflowChecks Value="True"/>
  117.       </Checks>
  118.       <VerifyObjMethodCallValidity Value="True"/>
  119.       <Optimizations>
  120.         <OptimizationLevel Value="0"/>
  121.       </Optimizations>
  122.     </CodeGeneration>
  123.     <Linking>
  124.       <Debugging>
  125.         <DebugInfoType Value="dsDwarf2"/>
  126.         <UseHeaptrc Value="True"/>
  127.         <TrashVariables Value="True"/>
  128.       </Debugging>
  129.     </Linking>
  130.     <Other>
  131.       <Verbosity>
  132.         <ShowNotes Value="False"/>
  133.       </Verbosity>
  134.       <CustomOptions Value="-godwarfsets
  135. -dDBGGRID
  136. -dDEBUG
  137. -dDBGAPP
  138. -dDBGCALC
  139. -dDBGCORE
  140. -dDBGPRJ"/>
  141.     </Other>
  142.   </CompilerOptions>
  143.   <Debugging>
  144.     <Exceptions>
  145.       <Item>
  146.         <Name Value="EAbort"/>
  147.       </Item>
  148.       <Item>
  149.         <Name Value="ECodetoolError"/>
  150.       </Item>
  151.       <Item>
  152.         <Name Value="EFOpenError"/>
  153.       </Item>
  154.     </Exceptions>
  155.   </Debugging>
  156. </CONFIG>
« Last Edit: October 01, 2020, 09:53:24 pm by Handoko »

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Lazarus doesn't recompile changed units
« Reply #43 on: October 01, 2020, 09:53:08 pm »
I don't know what's wrong. Try to create a new prj with just one button and copy the code there. It should work.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Lazarus doesn't recompile changed units
« Reply #44 on: October 01, 2020, 10:13:17 pm »
I sometimes have problems opening projects posted on the forum. They're just empty. I believe the problems have something to do with the version difference of the Lazarus we're using.
Yes, exactly. The unit file list in project info .lpi file now uses an XML tag syntax without numbers. Like :
Code: [Select]
<Unit>
...
</Unit>
Earlier it was something like :
Code: [Select]
<Unit1>
...
</Unit1>
which caused big diffs when files were added or deleted, and thus the numbers shifted.
Projects uploaded here should use the option "Maximize compatibility of project files (LPI and LPS)" in Miscellaneous page. Then the project is saved using the old XML syntax.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018