Forum > macOS / Mac OS X

libpq.dylib unreachable ?

(1/3) > >>

ThierryJ:
Hello There,

I am trying to connect to my PostgreSQL server from Lazarus using a TPQConnection standard component. When I try to connect, I am receiving this alert :

Can not load PostgreSQL client library "libpq.dylib". Check your installation.

I have checked, the library is present in /usr/lib. It is in fact a link pointing to libpq.5.6.dylib.

I assume that the parameters are correct, since when I look to the files opened by the Lazarus process when running I find this : /usr/lib/dyld. Lazarus knows where to find its libraries.

So, what is happening ? I have exactly the same problem on another machine, running the same versions of osx, Lazarus and fpc.

My configuration :

MacOS High Sierra 10.13.4
Lazarus 1.8.2
FPC 3.0.4
gdb 8.0.1 (signed, working from Lazarus)

Any comment or suggestion will be welcome, I am fighting since more than one day with this and I am becoming tired...

Thanks in advance,

Thierry

Phil:

--- Quote from: ThierryJ on May 21, 2018, 08:34:58 pm ---Can not load PostgreSQL client library "libpq.dylib". Check your installation.

--- End quote ---

I assume you've looked at the code in postgres3dyn.pp and seen that it's calling LoadLibrary to load libpq.dylib.

But it doesn't include absolute path to library. FPC docs have always suggested including an absolute path:

https://www.freepascal.org/docs-html/rtl/dynlibs/loadlibrary.html

Easy for you to check if that's the problem. If so, file a bug report.

ThierryJ:
Hello Phil,

Thank you for your answer. I have tried to locate postgres3dyn.pp :


--- Code: ---iMac27:lazarus me$ pwd
/Developer/lazarus
iMac27:lazarus me$ find . -name "*.pp" -print | grep postgres
iMac27:lazarus me$
--- End code ---

So, this file is not on my system (??) Anyway I found this forum entry : http://forum.lazarus-ide.org/index.php?topic=15782.0. Same problem, none of the mentioned files or units are present on my system... The post is old, 2012.

I have built the SQLdb package, with success, but nothing has changed after.

Do you think that I will have to build Lazarus from sources instead of just installing it from the official package ?

Do you have any more information ? I am lost...

Thanks in advance,

Thierry

marcov:
Base Database classes are non-visual, so part of FPC, not Lazarus.

ThierryJ:
OK, found. Looking to the code, I see that there is no assumption about the path where the library should be on Darwin. Does it mean that I have to modify this code to fix the path to /usr/lib/libpq.dylib ? It is useless to build a rather complicated way to determine the suffix of the library and still ignoring its location...

It is so strange to have to proceed this way on systems able to establish logical links to physical files... I am completely new to fpc and Lazarus, so it is difficult to me to evaluate the effort required to use simply the configuration file settings for reaching this library. But obviously some other modules do this because I can see that /usr/lib/dyld is in use when Lazarus/fpc are running.

I have tried to copy / rename libpq.dylib to /Developer/lazarus/ directory, beside the lazarus binary, but I still get the same message.

If you can give me a clue on where to find a good doc about building fpc and/or its modules, I would be very grateful...

Thanks in advance,

Thierry
 

Navigation

[0] Message Index

[#] Next page

Go to full version