FPMkUnit could not parse arguments properly
Summary
FPMkUnit is used to build packages. It parses command line arguments itself for options but it couldn't do that right.
System Information
- Operating system: Ubuntu
- Processor architecture: x86-64
- Compiler version: 3.2.2+dfsg-46 (2025/02/08)
- Device: Computer
Steps to reproduce
- Create
fpmakewith the guide provided in FP wiki - Build with
-gland-ghflags - Run with no /
buildoption
Example Project
program fpmake;
uses fpmkunit;
procedure CreatePackage(const name: shortstring; deps: array of string);
var
p: TPackage;
t: TTarget;
i: integer;
begin
with Installer do begin
p := AddPackage(name);
t := p.targets.AddUnit(name);
for i := low(deps) to high(deps) do
t.Dependencies.Add(deps[i]);
t.UnitPath.Add('include');
t.UnitPath.Add('src');
end;
end;
procedure CreatePackage(const name: shortstring); overload;
begin
CreatePackage(name, []);
end;
begin
{Defaults.Options.Append calls}
{CreatePackage calls}
Installer.Run;
end.
What is the current bug behavior?
What is the expected (correct) behavior?
The program crashes.
Relevant logs and/or screenshots
From gdb:
(gdb) run build
Starting program: /mnt/d/Projects/Commands-Collection/fpmake build
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x0000000000435064 in FPMKUNIT$_$TCUSTOMDEFAULTS_$__$$_GETOPTIONS$$TSTRINGS ()
(gdb) bt
#0 0x0000000000435064 in FPMKUNIT$_$TCUSTOMDEFAULTS_$__$$_GETOPTIONS$$TSTRINGS ()
#1 0x00000000004f2040 in ?? ()
#2 0x0000000000401405 in main () at fpmake.pp:29
(gdb)
(the 29th line of fpmake.pp is Installer.Run)