Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-08

Cannot load libpq.dylib on Mac OS X

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Joao Morais

Hello FPC list

The following code raises the following exception on a Mac OS X Lion with FPC 2.6.2:

========
$ cat pqconsole.lpr
program pqconsole;
{$mode objfpc}{$H+}
uses
  sqldb, pqconnection;
var
  vdb: TSQLQuery;
  vcon: TPQConnection;
begin
  vcon := TPQConnection.Create(nil);
  try
    vdb := TSQLQuery.Create(nil);
    try
      vcon.LoginPrompt := False;
      vcon.DatabaseName := 'bar';
      vcon.KeepConnection := True;
      vcon.Password := 'pwd';
      vcon.UserName := 'bar';
      vcon.HostName := 'localhost';
      vcon.Connected := True;
      vdb.DataBase := vcon;
    finally
      vdb.Free;
    end;
  finally
    vcon.Free;
  end;
end.
========

---------------
$ ./pqconsole
An unhandled exception occurred at $000CA921 :
EInOutError : Can not load PostgreSQL client library "libpq.dylib". Check your installation.
---------------

What I have done so far:

1. export DYLD_LIBRARY_PATH=/Path/To/libpq.dylib/dir (using Postgresql.app 9.2.4 from Heroku)

2. export DYLD_LIBRARY_PATH=.
and copying the libpq.dylib to the binary dir

3. Installed pg 9.2.4 from EnterpriseDB package

4. Restarted the SO =)

By the way, pgAdmin is installed and works flawlessly.

There are also some libpqs out there:

------------------
$ ll /usr/lib/libpq*
-rwxr-xr-x 1 root wheel 163840 9 Abr 22:51 /usr/lib/libpq.5.4.dylib lrwxr-xr-x 1 root wheel 15 16 Nov 2012 /usr/lib/libpq.5.dylib -> libpq.5.4.dylib
lrwxr-xr-x 1 root wheel 15 16 Nov 2012 /usr/lib/libpq.dylib -> libpq.5.4.dylib
------------------

Hints?

Joao Morais

Joao Morais
to Joao Morais
Joao Morais wrote 17 lines
$ ./pqconsole An unhandled exception occurred at $000CA921 : EInOutError : Can not load PostgreSQL client library "libpq.dylib". Check your installation. --------------- What I have done so far: 1. export DYLD_LIBRARY_PATH=/Path/To/libpq.dylib/dir (using Postgresql.app 9.2.4 from Heroku) 2. export DYLD_LIBRARY_PATH=. and copying the libpq.dylib to the binary dir 3. Installed pg 9.2.4 from EnterpriseDB package 4. Restarted the SO =)

5. Compiling with "ppcx64" instead of "fpc" in order to generate a 64 bit application. Now it works!

Thanks Silvio pointing out some links in private.

Joao Morais