I've moved code out into separate packages. Mostly works fine, but ...
Both in the IDE and when using lazbuild, I sometimes get an error that a certain file could not be found. Here's some excert from the build log:
https://wiki.freepascal.org/lazbuild
Info: (lazarus) Open dependency Project: PROJECTNAME uses PACKAGENAME ...
Info: (lazarus) Open dependency: trying "PACKAGENAME" in 2 links: "D:\Development\Packages\PACKAGENAME\PACKAGENAME.lpk" ...
Info: (lazarus) Open dependency: package file found: "D:\Development\Packages\PACKAGENAME\PACKAGENAME.lpk". Parsing lpk ...
Info: (lazarus) Open dependency [PACKAGENAME]: Success: "D:\Development\Packages\PACKAGENAME\PACKAGENAME.lpk"
...
Hint: (lazarus) Missing state file of PACKAGENAME 3.10.2: D:\Development\Packages\PACKAGENAME\lib\i386-win32-package\PACKAGENAME.compiled
Hint: (lazarus) Fallback output directory of PACKAGENAME: D:\laz\config_lazarus\lib\PACKAGENAME\lib\i386-win32-package
...
(10001) PPU Loading D:\Development\Packages\PACKAGENAME\lib\i386-win32-package\SOMEUNIT.ppu
(10011) PPU Source: SOMEUNIT.pas not found
(10028) Recompiling SOMEUNIT, checksum changed for D:\Development\Packages\PROJECTNAME\lib\i386-win32-package\FORMUNIT.ppu {impl}
Fatal: (10022) Can't find unit SOMEUNIT used by FORMUNIT
Fatal: (1018) Compilation aborted
Error: D:\laz\fpc\bin\i386-win32\ppc386.exe returned an error exitcode
Error: (lazarus) Compile Project, Mode: Release-x86, Target: d:\Development\Projects\PROJECT\bin\PROJECT-Release\PROJECTNAME.exe: stopped with exit code 1
Info: (lazarus) [TCompiler.Compile] end
Error: (lazbuild) failed compiling of project d:\Development\Projects\PROJECT\source\PROJECT\PROJECTNAME.lpi
Doing "Cleanup and build" in the IDE works, but I have a PowerShell script compiling all modules in 32 and 64 bit and creating installer, portable edition, &c., so getting this to work with lazbuild would be great.
What is the issue with the "fallback output directory", might this be causing ppu conflicts? D:\laz\config_lazarus\lib\ does not even exist.
Here's the simply PowerShell module I use to build using lazbuild.
Import-Module PepiLog
$global:LazarusPath = "d:\laz\lazarus\"
$global:LazarusBuildExecutable = "d:\laz\lazarus\lazbuild.exe"
function Invoke-BuildLazarusProject {
Param([string]$AProjectFilename, [string]$ABuildMode, [string]$ALogFile)
& $global:LazarusBuildExecutable ("-B") ("-r") ("--verbose") ("--verbose-pkgsearch") ("--build-mode=" + $ABuildMode) ($AProjectFilename) > $ALogFile
if ($LastExitCode -ne 0)
{
return $false
Write-LogError ("lazbuild: " + $sProject)
}
else
{
return $true
}
}
I can't find anything missing in the
documented lazbuild parameters, but it seems there is some kind of issue with the package recompilation.