[Lazarus] Cannot load libpq.so

Leonardo M. Ramé l.rame at griensu.com
Wed Sep 26 17:13:59 CEST 2012


On 2012-09-26 11:52:49 -0300, Leonardo M. Ramé wrote:
> On 2012-09-26 07:42:29 +0200, zeljko wrote:
> > On Tuesday 25 of September 2012 20:42:18 Leonardo M. Ramé wrote:
> > > On 2012-09-25 20:35:43 +0200, Bernd wrote:
> > > > 2012/9/25 Leonardo M. Ramé <l.rame at griensu.com>:
> > > > > Do you know a way to know where's the loader looking for libraries?,
> > > > > from command line.
> > > > 
> > > > ldconfig --print-cache
> > > > 
> > > > Your library should appear there if installed correctly
> > > > 
> > > > --
> > > 
> > > Here's the result of ldconfig:
> > > 
> > > /sbin/ldconfig --print-cache|grep libpq
> > > libpqwalreceiver.so (libc6) => /usr/local/pgsql/lib/libpqwalreceiver.so
> > > libpq.so.5 (libc6) => /usr/local/pgsql/lib/libpq.so.5
> > > libpq.so (libc6) => /usr/local/pgsql/lib/libpq.so
> > > 
> > > It seems to be installed correctly.
> > 
> > If you compiled it by yourself then something goes wrong probably. Maybe 
> > you've compiled 64bit lib and tried to load it with 32bit app ?
> > You can easy test that. Create new application, include dynlibs and try to 
> > load that library in some event (eg. ButtonOnClick). According to your posts 
> > ld.conf contains valid entries and libpq.so is in the path, so something else 
> > is wrong .
> > 
> > zeljko
> > 
> 
> I've made this simple program to test what's happening while loading
> libpq.so. 
> 
> Important: I must point out that I'm running FPC 2.7.1 on a Linux PowerPC
> 64 bits machine. And it works ok on an x86_64 Ubuntu PC.
> 
> The result I'm getting when calling "RaiseLastOSError" is this:
> 
> An unhandled exception occurred at $000000001001582C:
> EOSError: An operating system call failed.
>   $000000001001582C
> 
> Here's the program:
> 
> program test;
>  
> {$mode objfpc}{$H+}
>  
> uses
>   sysutils,
>   dynlibs;
>  
> const
>   cLibrary = '/usr/local/pgsql/lib/libpq.so';
>  
> var
>   lHandle: TLibHandle;
>  
> begin
>    if not FileExists(cLibrary) then
>    begin
>      writeln('Library ' + cLibrary + ' does not exists.');
>      halt;
>    end;
>  
>    lHandle := LoadLibrary(cLibrary); 
>    if lHandle = 0 then
>    begin
>      writeln('Library not loaded');
>      RaiseLastOSError;
>    end;
> end.
> 
> 

I've created a bug report here:
http://bugs.freepascal.org/view.php?id=22987

It's related to FPC and not Lazarus.

Regards,
-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com




More information about the Lazarus mailing list