pult / SuperObject.Delphi

Pascal (Delphi, FPC) json parser library SuperObject
The Unlicense
45 stars 22 forks source link

does not compile in Lazarus installed with fpcupdeluxe #12

Open raelb opened 2 months ago

raelb commented 2 months ago

Hi, I have installed fpc and Lazarus with latest version of fpcupdeluxe (https://github.com/LongDirtyAnimAlf/fpcupdeluxe) - v2.4.0e, selecting the stable version. It installs fpc 3.2.2 and Lazarus v3.4. (Pic below)

Adding superobject to a project, does not compile:

image

Here is the compile log: Hint: (11030) Start of reading config file D:\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.cfg Hint: (11031) End of reading config file D:\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.cfg Free Pascal Compiler version 3.2.2-r0d122c49 [2024/09/17] for x86_64 Copyright (c) 1993-2021 by Florian Klaempfl and others (1002) Target OS: Win64 for x64 (3104) Compiling superobject_test.lpr (3104) Compiling unit1.pas (3104) Compiling .\Lib\superobject.pas D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(249,9) Warning: (5079) Unit "Rtti" is experimental D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1135,49) Error: (5000) Identifier not found "TCustomAttribute" D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1135,49) Error: (4009) class type expected, but got "" D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1137,43) Error: (5000) Identifier not found "TCustomAttribute" D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1137,43) Error: (4009) class type expected, but got "" D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1149,43) Error: (5000) Identifier not found "TCustomAttribute" D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1149,43) Error: (4009) class type expected, but got "" D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1161,43) Error: (5000) Identifier not found "TCustomAttribute" D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1161,43) Error: (4009) class type expected, but got "" D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1170,41) Error: (5000) Identifier not found "TCustomAttribute" D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1170,41) Error: (4009) class type expected, but got "" D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1228,46) Error: (5000) Identifier not found "TRttiField" D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1229,49) Error: (5000) Identifier not found "TRttiField" D:\fpcupdeluxe\ccr\demos\SuperObject.Delphi.\Lib\superobject.pas(1417,47) Fatal: (10026) There were 12 errors compiling module, stopping Fatal: (1018) Compilation aborted

image

pult commented 2 months ago

Custom Attribute is supported from compiler 3.3.1 ( your 3.2.2 ). https://wiki.freepascal.org/Custom_Attributes

Try disabling "{$define HAVE_RTTI}" in "superobject.pas". For example, like this:

{$IFDEF FPC}
  {$define HAVE_INLINE}
  ...
  {$if (fpc_version>3) or ( (fpc_version=3) and ((fpc_release>3) or ((fpc_release=3) and (fpc_patch>0))) )}
    {$define HAVE_RTTI} // optional
  {$ifend}
...

Fix (Not tested) https://github.com/pult/SuperObject.Delphi/commit/431a3cca69389c27e40c3321bad8652138c3ab92

raelb commented 2 months ago

Thanks, that works, and I can compile my project fine on Windows 10.

However, I also installed fpcupdeluxe on wsl (ubuntu). When I try to compile on that system (linux 64), I get this error:

image

pult commented 2 months ago

Fix (Not tested): FPC no member "TTimeZone.Local" https://github.com/pult/SuperObject.Delphi/commit/ed209915198ae34ef2f6614545bcab6f2fe515cf