Page 1 of 1

[patch_done] compile Linux Lazarus testing-egonhugeist r1055

Posted: 05.03.2012, 12:18
by ism
Not compile in Linux lazarus 0.9.30.2 fpc 2.4.4 testing-egonhugeist rev 1055

/home/client20/bin/zeos/testing-egonhugeist/src/core/ZClasses.pas(202,14) Warning: An inherited method is hidden by "TZAbstractObject.Equals(const IUnknown):Boolean;"
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZClasses.pas(203,40) Warning: An inherited method is hidden by "TZAbstractObject.GetHashCode:LongInt;"
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZClasses.pas(205,14) Warning: An inherited method is hidden by "TZAbstractObject.ToString:AnsiString;"
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(134,13) Hint: Type "HMODULE" redefinition
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(193,58) Warning: Some fields coming after "ZAlias" weren't initialized
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(202,52) Hint: Parameter "CP" not used
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(203,47) Hint: Parameter "CP" not used
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(204,47) Hint: Parameter "CP" not used
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(745,27) Error: Identifier not found "dlopen"
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(750,29) Error: Identifier not found "dlclose"

/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(750,30) Hint: Conversion between ordinals and pointers is not portable
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(755,18) Error: Identifier not found "dlsym"
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(755,19) Hint: Conversion between ordinals and pointers is not portable
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(829) Fatal: There were 3 errors compiling module, stopping

Posted: 05.03.2012, 12:58
by wylton
ZClasses.pas has modification。。windows and linux not compiler.

Posted: 05.03.2012, 14:35
by marcov
Remove the ifdef around gethashcode in interface and implementation

Posted: 05.03.2012, 16:57
by EgonHugeist
Done Rev. 1056...

Posted: 05.03.2012, 18:29
by ism
no effect
error in this place
$IFDEF UNIX}
{$IFDEF FPC}
function LoadLibrary(ModuleName: PChar): HMODULE;
begin
Result := HMODULE(dlopen(Modulename, RTLD_GLOBAL));
end;
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.4.4 [2011/09/28] for i386
Copyright (c) 1993-2010 by Florian Klaempfl
Target OS: Linux for i386
Compiling zcore.pas
Compiling /home/client20/bin/zeos/testing-egonhugeist/src/core/ZClasses.pas
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZClasses.pas(202,14) Warning: An inherited method is hidden by "TZAbstractObject.Equals(const IUnknown):Boolean;"
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZClasses.pas(203,14) Warning: An inherited method is hidden by "TZAbstractObject.GetHashCode:LongInt;"
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZClasses.pas(205,14) Warning: An inherited method is hidden by "TZAbstractObject.ToString:AnsiString;"
Compiling /home/client20/bin/zeos/testing-egonhugeist/src/core/ZMessages.pas
Writing Resource String Table file: ZMessages.rst
Compiling /home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(134,13) Hint: Type "HMODULE" redefinition
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(193,58) Warning: Some fields coming after "ZAlias" weren't initialized
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(202,52) Hint: Parameter "CP" not used
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(203,47) Hint: Parameter "CP" not used
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(204,47) Hint: Parameter "CP" not used
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(745,27) Error: Identifier not found "dlopen"
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(750,29) Error: Identifier not found "dlclose"
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(750,30) Hint: Conversion between ordinals and pointers is not portable
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(755,18) Error: Identifier not found "dlsym"
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(755,19) Hint: Conversion between ordinals and pointers is not portable
/home/client20/bin/zeos/testing-egonhugeist/src/core/ZCompatibility.pas(829) Fatal: There were 3 errors compiling module, stopping

Posted: 06.03.2012, 10:00
by EgonHugeist
:wallb:

Grrrr,
ok did it hopefully. I ask the man who did this FPC2.6+ job again if it doesn't work..

Rev. 1060

Posted: 06.03.2012, 11:45
by ism
in fpc 2.4.4 and Lazarus 0.9.30.2 unit dlopen replace unit dl http://wiki.freepascal.org/Lazarus/FPC_Libraries

in fpc 2.6.0 i do not know , i try



temporary patch

Code: Select all

Index: src/core/ZCompatibility.pas
===================================================================
--- src/core/ZCompatibility.pas	(revision 1060)
+++ src/core/ZCompatibility.pas	(working copy)
@@ -61,7 +61,7 @@
   Variants,
 {$IFDEF UNIX}
   {$IFDEF FPC}
-    dynlibs,
+    dl,
   {$endif}
    {$ifdef kylix}
     libc,
But new error in Linux Lazarus

Code: Select all

unit ZPgEventAlerter;

interface
{$i zcomponent.inc}
uses   

Code: Select all

/home/client20/bin/zeos/testing-egonhugeist/src/component/ZPgEventAlerter.pas(51,2) Fatal: Can't open include file "zcomponent.inc"

Posted: 06.03.2012, 12:55
by marcov
Last error: yes, I'm not used to these issues, since Lazarus and FPC projects have all their files in lowercase (and lowercase is always matched by FPC). Fixed, r1061.

First error, this is more difficult. The "dl" unit is less portable than the dynlibs unit, and might cause problems.

The dynlibs unit however exports "windows" style "loadlibrary" and "getprocadddres" symbols on all platforms.

The change back to "dl" is only a temporary one (only good for certain core *nix platforms, not the more freak ones), so in time "dynlibs" is better, but some issues (e.g. the library handle handle type, which can't be THandle or HModule and dlopen options (dynlibs uses RTLD_LAZY instead of _GLOBAL)) must be researched more before a definitive change is made.

The best solution would be to introduce a handle type for dlls, and alias it to HModule on Delphi and Kylix and dynlibs.TLibHandle on FPC, and use that everywhere where loadlib is used.

Posted: 06.03.2012, 15:06
by ism
in Unix in a case of the character has the importance

patch
--- src/component/ZPgEventAlerter.pas (revision 1060)
+++ src/component/ZPgEventAlerter.pas (working copy)
@@ -48,7 +48,7 @@
unit ZPgEventAlerter;

interface
-{$i zcomponent.inc}
+{$i ZComponent.inc}
uses
SysUtils, Classes, ExtCtrls,
{$IFDEF MSWINDOWS}

Posted: 07.03.2012, 09:33
by EgonHugeist
Thank you ism and marcov.

Done in testing-egonhugeist 1062 too.

Marco can you work out the DynLibs-issues too?

Best regards

Posted: 07.03.2012, 10:38
by marcov
In testing it already is "dl", so I guess sb else fixed it?

Posted: 07.03.2012, 13:54
by ism
Patch dlopen , it is example, possible do better

please verify

Lazarus 0.9.30.4 fpc 2.6.0 Linux working

Code: Select all

Index: src/core/ZCompatibility.pas
===================================================================
--- src/core/ZCompatibility.pas	(revision 1062)
+++ src/core/ZCompatibility.pas	(working copy)
@@ -742,17 +742,17 @@
   {$IFDEF FPC}
 function LoadLibrary(ModuleName: PChar): HMODULE;
 begin
-  Result := HMODULE(dlopen(Modulename, RTLD_GLOBAL));
+  Result := dynlibs.LoadLibrary (ModuleName);//  HMODULE(dlopen(Modulename, RTLD_GLOBAL));
 end;
 
 function FreeLibrary(Module: HMODULE): LongBool;
 begin
-  Result := longbool(dlclose(pointer(Module)));
+  Result := dynlibs.FreeLibrary(Module); //longbool(dlclose(pointer(Module)));
 end;
 
 function GetProcAddress(Module: HMODULE; Proc: PChar): Pointer;
 begin
-  Result := dlsym(pointer(Module), Proc);
+  Result := dynlibs.GetProcAddress (Module,Proc) //dlsym(pointer(Module), Proc);
 end;
   {$ENDIF}
 {$ENDIF}

Posted: 08.03.2012, 06:30
by EgonHugeist
ism,

did you check this on windows too?

Posted: 08.03.2012, 11:50
by ism
see IFDEF
{$IFDEF UNIX}
{$IFDEF FPC}
function LoadLibrary(ModuleName: PChar): HMODULE;
begin
Result := dynlibs.LoadLibrary (ModuleName);
end;
this code seen and compile only on unix fpc

in windows all ok

Check everything in Virtualbox Opensuse

Posted: 08.03.2012, 21:08
by EgonHugeist
ism,

commit your patch Rev. 1063. Thank you. That's what we need.

Best regards