Open ikelaiah opened 4 months ago
Yeah, I'm aware of that. FPC changed their approach to member visibility in generics not too long ago. I'll have to look into it as soon as I have enough time.
Thanks @avk959 .
Seems to be fixed? At least yesterday's FPC-3.3.1-15663-ga888a141a2-dirty(x86_64-linux) can now compile the current version of LGenerics.
Thanks @avk959 , I'll test.
Hi @avk959 ,
Since you compiled it with FPC-3.3.1-15663-ga888a141a2-dirty(x86_64-linux), most likely my setup is not right. Thanks for checking, and I'm closing this issue now.
Compile Project, Mode: Release, Target: C:\Users\iwank\Documents\github\1brc-ObjectPascal\bin\ikelaiah.exe: Exit code 1, Errors: 40, Hints: 2
Hint: Start of reading config file C:\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.cfg
Hint: End of reading config file C:\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.cfg
Verbose: Free Pascal Compiler version 3.3.1-15679-g5284948087 [2024/05/09] for x86_64
Verbose: Copyright (c) 1993-2024 by Florian Klaempfl and others
Verbose: Target OS: Win64 for x64
Verbose: Compiling OneBRC.lpr
Verbose: Compiling weatherstation.pas
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindFirst(out OpenString):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindLast(out OpenString):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindFirst(out OpenString):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindLast(out OpenString):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindMin(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindMin(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindMin(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindMax(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindMax(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindMax(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindFirst(out OpenString):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindLast(out OpenString):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindFirst(out OpenString):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindLast(out OpenString):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindFirst(out OpenString):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindLast(out OpenString):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
weatherstation.pas(70,1) Verbose: There were 40 errors compiling module, stopping
Verbose: Compilation aborted
Verbose: C:\fpcupdeluxe\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode
Since you compiled it with FPC-3.3.1-15663-ga888a141a2-dirty(x86_64-linux), most likely my setup is not right.
It's impossible to give any advice without seeing the source code.
Hi @avk959
I'm reopening this again, providing my code (which I should have provided earlier). I'm still stuck, hoping you can help.
program GHashmapLPDemo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cmem, cthreads,
{$ENDIF}
Classes,
lgHashMap,
SysUtils;
type
TDictionary = specialize TGHashMapLP<shortstring, int64>;
var
dict: TDictionary;
s:shortstring;
begin
dict := TDictionary.Create;
try
dict.Add('One', 1);
dict.Add('Two', 2);
dict.Add('Three', 3);
dict.Add('Four', 4);
WriteLn('Printing key-value...');
for s in dict.Keys do
begin
WriteLn('Key: ', s, ' Value: ', dict[s]);
end;
finally
dict.Free;
end;
WriteLn('Press enter to exit');
ReadLn;
end.
And I get this error message when I compile using F9 in Lazarus IDE.
Compile Project, Target: C:\Users\iwank\Documents\fp-projects\free-pascal-snippets\LGenerics\GHashmapLP\GHashmapLPDemo.exe: Exit code 1, Errors: 40, Hints: 2
Hint: Start of reading config file C:\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.cfg
Hint: End of reading config file C:\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.cfg
Verbose: Free Pascal Compiler version 3.3.1-15679-g5284948087 [2024/05/09] for x86_64
Verbose: Copyright (c) 1993-2024 by Florian Klaempfl and others
Verbose: Target OS: Win64 for x64
Verbose: Compiling GHashmapLPDemo.lpr
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindFirst(out OpenString):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindLast(out OpenString):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(140,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindFirst(out OpenString):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindLast(out OpenString):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindMin(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindMin(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindMin(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindMax(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindMax(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
enumsh.inc(25,19) Error: No matching implementation for interface method "FindMax(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindFirst(out OpenString):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindLast(out OpenString):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgabstractcontainer.pas(201,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindFirst(out OpenString):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindLast(out OpenString):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindFirst(out OpenString):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindLast(out OpenString):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMin(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGOnLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
lgutils.pas(259,6) Error: No matching implementation for interface method "FindMax(out OpenString;TGNestLessCompare$1$crc640B6513_crc69E394E1):System.Boolean;" found
GHashmapLPDemo.lpr(46,0) Verbose: There were 40 errors compiling module, stopping
Verbose: Compilation aborted
Verbose: C:\fpcupdeluxe\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode
Many thanks, Iwan
Hey Iwan(@ikelaiah),
Could you provide the compiler and Lazarus version please? Many thanks in advance!! If you did already, I'm really sorry for repeating the question!! :people_hugging: :heart:
Cheers, Gus
@gcarreno , sure!
Lazarus 3.99 (rev main_3_99-1970-g06f123d8dd) FPC 3.3.1 x86_64-win64-win32/win64 Free Pascal Compiler version 3.3.1-15679-g5284948087
Thanks.
Looks like the OpenStrings compiler switch is now enabled by default in DELPHI mode. Just try replace line 22 in the lgUtils unit with {$MODE DELPHI}{$P-}.
Thanks for the suggestion. Here's what I did.
lgUtils
unit with {$MODE DELPHI}{$P-}
lgenerics.lpk
It works in Debug mode, with correct output.
$ ./GHashmapLPDemo.exe
Printing key-value...
Key: Two Value: 2
Key: Four Value: 4
Key: Three Value: 3
Key: One Value: 1
Press enter to exit
Heap dump by heaptrc unit of "C:\Users\iwank\Documents\fp-projects\free-pascal-snippets\LGenerics\GHashmapLP\GHashmapLPDemo.exe"
131 memory blocks allocated : 8598/8944
131 memory blocks freed : 8598/8944
0 unfreed memory blocks : 0
True heap size : 393216 (352 used in System startup)
True free heap : 392864
When I run in Release mode, it give me the following.
$ ./GHashmapLPDemo.exe
An unhandled exception occurred at $0000000100030B39:
EAccessViolation: Access violation
$0000000100030B39
$0000000100030E67
$0000000100030CC3
$0000000100033A42
$0000000100034736
$0000000100042A80
$00000001000017F0
$00007FFAE1AC257D
$00007FFAE300AA48
Progress! We are getting somewhere.
-Iwan
Additional info.
When I compile the project under Release mode, I get the2 warnings. But no warning in the Debug mode.
Warning: Object file "GHashmapLPDemo.o" contains 32 bit absolute relocation to symbol ".data.n_TC_$GHASHMAPLPDEMO_$$__static_tgopenaddressing$4$crc0769d515_crc7da784b1_MAX_CAPACITY".
Warning: Object file "GHashmapLPDemo.o" contains 32 bit absolute relocation to symbol ".data.n_TC_$GHASHMAPLPDEMO_$$__static_tgopenaddressing$4$crc0769d515_crc7da784b1_MAX_CAPACITY".
Full message from Lazarus when compiling in Release mode.
Compile Project, Mode: Release, Target: C:\Users\iwank\Documents\fp-projects\free-pascal-snippets\LGenerics\GHashmapLP\GHashmapLPDemo.exe: Success, Warnings: 2, Hints: 2
Hint: Start of reading config file C:\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.cfg
Hint: End of reading config file C:\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.cfg
Verbose: Free Pascal Compiler version 3.3.1-15679-g5284948087 [2024/05/09] for x86_64
Verbose: Copyright (c) 1993-2024 by Florian Klaempfl and others
Verbose: Target OS: Win64 for x64
Verbose: Compiling GHashmapLPDemo.lpr
Verbose: Linking C:\Users\iwank\Documents\fp-projects\free-pascal-snippets\LGenerics\GHashmapLP\GHashmapLPDemo.exe
Warning: Object file "GHashmapLPDemo.o" contains 32 bit absolute relocation to symbol ".data.n_TC_$GHASHMAPLPDEMO_$$__static_tgopenaddressing$4$crc0769d515_crc7da784b1_MAX_CAPACITY".
Warning: Object file "GHashmapLPDemo.o" contains 32 bit absolute relocation to symbol ".data.n_TC_$GHASHMAPLPDEMO_$$__static_tgopenaddressing$4$crc0769d515_crc7da784b1_MAX_CAPACITY".
Verbose: 45 lines compiled, 1.3 sec, 481664 bytes code, 14308 bytes data
Verbose: 2 warning(s) issued
Verbose: 2 hint(s) issued
My results for your example are:
To me all this along with the linker message looks like a compiler problem, what about you?
I see. It does look like a compiler's problem.
Hi @avk959,
Thanks for the fine library for FPC. I am runnning into issues when compiling with FPC trunk and using
lghashmap
. I get the following error.Can you help? Many thanks.
-Iwan