Code Monkey home page Code Monkey logo

Comments (14)

avk959 avatar avk959 commented on May 29, 2024 2

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.

from lgenerics.

avk959 avatar avk959 commented on May 29, 2024 1

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.

from lgenerics.

avk959 avatar avk959 commented on May 29, 2024 1

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.

from lgenerics.

gcarreno avatar gcarreno commented on May 29, 2024 1

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!! 🫂 ❤️

Cheers,
Gus

from lgenerics.

ikelaiah avatar ikelaiah commented on May 29, 2024 1

@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.

from lgenerics.

avk959 avatar avk959 commented on May 29, 2024 1

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-}.

from lgenerics.

ikelaiah avatar ikelaiah commented on May 29, 2024

Thanks @avk959 .

from lgenerics.

ikelaiah avatar ikelaiah commented on May 29, 2024

Thanks @avk959 , I'll test.

from lgenerics.

ikelaiah avatar ikelaiah commented on May 29, 2024

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

from lgenerics.

ikelaiah avatar ikelaiah commented on May 29, 2024

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

from lgenerics.

ikelaiah avatar ikelaiah commented on May 29, 2024

Thanks for the suggestion.
Here's what I did.

  1. Replaced line 22 in the lgUtils unit with {$MODE DELPHI}{$P-}
  2. Reloaded and recompiled the lgenerics.lpk
  3. Cleaned up project and recompiled

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

from lgenerics.

ikelaiah avatar ikelaiah commented on May 29, 2024

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

from lgenerics.

avk959 avatar avk959 commented on May 29, 2024

My results for your example are:

  • FPC 3.3.1-15705-gac8fefbc2b-dirty-x86_64-linux,
    optimization level -O3: OK;
  • FPC 3.3.1-15682-g59e307ec2e-x86_64-win64,
    optimization level -O3: Access violation;
    optimization level -O1: OK;

To me all this along with the linker message looks like a compiler problem, what about you?

from lgenerics.

ikelaiah avatar ikelaiah commented on May 29, 2024

I see. It does look like a compiler's problem.

from lgenerics.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.