[solved] ZConnection.libraryLocation

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

elidorio2
Expert Boarder
Expert Boarder
Posts: 159
Joined: 20.08.2006, 05:37
Location: Tapejara -Pr
Contact:

[solved] ZConnection.libraryLocation

Post by elidorio2 »

Hello

I'm compiling my executable application developed with Zeos 7 and Lazarus 09.30.4 and Postgresql 9.1 and Windows7 32.
And the same libpq81.dll not find the dll, the dll is already in the same directory as the executable and yet the message remains.
The message:
None of the dynamic libraries Can Be found or is not loadable: libpq81.dll libpq.dll!
Use TZConnection.libraryLocation if the location is invalid.


What can be?

Edson
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

Edson,

this may be a stupid question: Different compilete versions in 32/64Bit? And one of the unsupported dll's was found in the Path environment? A 64Bit exe can not load a 32Bit dll header or reverted as far as i know...

I do not see another possibility to get this exception if the files do exist.

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
elidorio2
Expert Boarder
Expert Boarder
Posts: 159
Joined: 20.08.2006, 05:37
Location: Tapejara -Pr
Contact:

Post by elidorio2 »

Michael.

Just a correction.
Exe was compiled on a machine with windows7 32. I'm trying to run the exe on a machine with windows xp 32, such that it has problems with the dll.

Edson
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

Ok Edson. We start from the premise that you've a 32Bit Application and 32Bit dll.

Are all dll's of PostgreSQL avaiable in that directory? Not only the libpg.dll?

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
elidorio2
Expert Boarder
Expert Boarder
Posts: 159
Joined: 20.08.2006, 05:37
Location: Tapejara -Pr
Contact:

Post by elidorio2 »

The dll Postgresql are all in the directory. As the picture below.
In ZComnection.LibraryLocation need to configure something?

Edson
You do not have the required permissions to view the files attached to this post.
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

Spaces in path ?
Or non ascii symbols in path

Or ./directory

Or LibraryLocation must be empty , then it will search the current directory
Lazarus 1.0.8 fpc 2.6.0
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

elidorio2,

my first advice clean up that folder. Keep only the librarys you need (copy them from the PostgreSQL\Bin folder). And i join with ism here. In your case use TZLibraryLocation = ''; because the system finds th dll's in your application folder. Also be sure you do not have another version in the Windows\system directory.

That exception will only be raised if the function LoadLibrary does not return a valid handle or the dll is realy not found. These are the two possibilities and nothing else is possible.

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
elidorio2
Expert Boarder
Expert Boarder
Posts: 159
Joined: 20.08.2006, 05:37
Location: Tapejara -Pr
Contact:

Post by elidorio2 »

Hello Michel and Ism,
There must be something strange, since I cleaned the whole directory and the message still persists. I turned off all the dll and I was asking as putting and yet the error persists.
You do not have the required permissions to view the files attached to this post.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

elidorio2,

Ok step by step, Edson. Tell me do you use the TZConnection.LibraryLocation ? Is that property empty?

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
elidorio2
Expert Boarder
Expert Boarder
Posts: 159
Joined: 20.08.2006, 05:37
Location: Tapejara -Pr
Contact:

Post by elidorio2 »

Michael,
I do not use it.
I do not set any value in this property is empty.
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

The simple question is whether directory with the dll the current?
Try to check temporarily put in C: \ windows \ system32

Check start shortcut
Lazarus 1.0.8 fpc 2.6.0
elidorio2
Expert Boarder
Expert Boarder
Posts: 159
Joined: 20.08.2006, 05:37
Location: Tapejara -Pr
Contact:

Post by elidorio2 »

Hello Michael,

The dll files are todoas in the current directory. Strange all the dll are in the directory and it is asking for libpq and libpq81.
I moved all the dll to the system32 and even then, and still the problem pesiste. I've been searching on google and found several people with the same problem, the solution is not encotrei yet!
Note, I'm using postgresql 9.1.
Please if possible do a test there, create an exe and try to run it on another machine.

Edson
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

elidorio2,

Hmm curious. Edson you bo not need the libpq81.dll the libpq.dll from the PostgreSQL\Bin folder should be enough.

Edson please scan that Harddisk for additional available libpg*.dll. I've tested this (not with XP) and it works. Check the path= environment variable (Start\control-panel\...).

I'm still thinking that your app and that dll is incompatible. Test it by your self:
Open ZPlainLoader.pas

Code: Select all

function TZNativeLibraryLoader.ZLoadLibrary(Location: String): Boolean;
begin
   if FLoaded then
      Self.FreeNativeLibrary;
   FLoaded := False;
   Result := False;

{$IFDEF UNIX}
  {$IFDEF FPC}
        FHandle := LoadLibrary(PAnsiChar(Location));
  {$ELSE}
        FHandle := HMODULE(dlopen(PAnsiChar(Location), RTLD_GLOBAL));
  {$ENDIF}
{$ELSE}
        FHandle := LoadLibrary(PChar(Location));
{$ENDIF}

   if (FHandle <> INVALID_HANDLE_VALUE) and (FHandle <> 0) then
   begin
      FLoaded := True;
      FCurrentLocation := Location;
      Result := True;
   end;
end;
Add there a line for fileexist(Location) or an errormessage which will be raised if the Handle is invalid..

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
elidorio2
Expert Boarder
Expert Boarder
Posts: 159
Joined: 20.08.2006, 05:37
Location: Tapejara -Pr
Contact:

Post by elidorio2 »

Hello Michael,

What's to understand is that Zeos does not read the other directory unless the C: \ Program Files \ PostgreSQL \ 9.1 \ bin.

In my opinion he is trying to get the dll in the directory above.

On my development computer it finds the dll normal, because they are in the directory above, now when I change the exe to another computer he can not find something that dll.
You do not have the required permissions to view the files attached to this post.
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Post by miab3 »

Today I installed PostgreSQL 9.1.4-64 bits.
Everything works fine on D2006, DXE232/64, and Lazarus Win 32/64.
On the server and three computers Win7 32/64, Win 7 32 and Vista 32 after installing the appropriate client libraries to the appropriate system directories or in the application directory.

Zeos 7 testing-egonhugeist rev.1389

Michal Abramczyk
Locked