Re: install libpq.dll in bin directory on Windows / Cygwin

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: MauMau <maumau307(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: install libpq.dll in bin directory on Windows / Cygwin
Date: 2013-07-28 19:37:49
Message-ID: 51F5730D.1040001@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 07/25/2013 06:27 PM, MauMau wrote:
> From: "Andrew Dunstan" <andrew(dot)dunstan(at)pgexperts(dot)com>
>> on Windows it's necessary to have libpq.dll/cygpq.dll either in the PATH
>> or in the same directory as client .exe files. The buildfarm client has
>> for many years simply copied this dll from the installation lib to the
>> installation bin directory after running "make install". But I can't
>> really see why we don't do that as part of "make install" anyway. I
>> haven't tested but I think something like this patch would achieve this
>> goal - it would fix something that's tripped a lot of people up over the
>> years.
>>
>> Comments? If we do this, should it be backported?
>
> I was just about to propose something related to this.
>
> On native Windows (not on Cygwin or MinGW), DLLs are in general placed
> in (1) system directory (e.g. c:\windows\system32), (2) somewhere in
> PATH, or (3) the same directory as EXEs which automatically load the
> DLL at invocation. It's no problem that most DLLs in PostgreSQL's lib
> directory, because they are loaded at runtime by postgres.exe by
> calling LoadLibrary() specifying an absolute or a relative path.
> However, the below files are misplaced:
>
> libecpg.dll
> libecpg_compat.dll
> libpgtypes.dll
>
> These should be placed in bin directory. If done so, when running SQL
> embedded C applications, users can just add bin in PATH, which is
> usually done already. Otherwise, users have to add both bin and lib
> in PATH. Usually, lib is not added in PATH in many software.
>
> Could you please place the above files in bin and remove them from lib?

I don't have a problem adding them to the bin directory. I'd be very
slightly wary of removing them from the lib directory, for legacy
reasons. Maybe these changes should be done for git tip and not
backported (or maybe just to 9.3). Or we could just decide to clean this
mess in one fell swoop.

>
> BTW, why is libpq.dll in lib necessary? For the above files? If so,
> we can remove libpq.dll from lib. Or, libpqwalreceiver.dll needs it?

Not sure. Perhaps you could experiment and see if anything bad happens
if libpq is just installed in the bin directory and not in lib.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-07-28 19:43:34 Re: install libpq.dll in bin directory on Windows / Cygwin
Previous Message Andres Freund 2013-07-28 18:50:16 Re: replication_reserved_connections