internals:windows:libs:libpg

This is an old revision of the document!


LibPq (Postgresql Client Library) Windows, How to compile

Building LibPq 8.3.x

Requirements

Dependencies

Modification to the config scripts (all VCs)

To make it works smoothly with our libraries, it is first needed to modify the script to look for:

  • zlib.lib instead of zdll.lib
  • ssleay32.lib instead of ssleay32MD.lib
  • libeay32.lib instead of libeay32MD.lib

and for the debug versions:

  • zlib_debug.lib instead of zdll.lib
  • ssleay32_debug.lib instead of ssleay32MDd.lib
  • libeay32_debug.lib instead of libeay32MDd.lib

To do so, open src\tools\msvc\Solution.pm (line 332):

$proj->AddLibrary($self->{options}->{zlib} . '\lib\zlib.lib');

The configuration option given through the command line does not work. Edit the src\tools\msvc\config.pl to define the correct path. Here is an example using my local config:

our $config = {
    asserts=>0,			# --enable-cassert
    integer_datetimes=>0,   # --enable-integer-datetimes
    nls=>undef,				# --enable-nls=<path>
    tcl=>'c:\tcl',		# --with-tls=<path>
    perl=>'c:\perl', 			# --with-perl
    python=>'c:\python24', # --with-python=<path>
    #krb5=>'c:\prog\pgsql\depend\krb5', # --with-krb5=<path>
    krb5=>0,
    ldap=>0,			# --with-ldap
    openssl=>'c:\Users\pierre\Documents\php-sdk\vc8\x86\deps', # --with-ssl=<path>
    uuid=>'c:\prog\pgsql\depend\ossp-uuid', #--with-ossp-uuid
    xml=>'c:\Users\pierre\Documents\php-sdk\vc8\x86\deps',
    xslt=>'c:\prog\pgsql\depend\libxslt',
    iconv=>'c:\prog\pgsql\depend\iconv',
    zlib=>'c:\Users\pierre\Documents\php-sdk\vc8\x86\deps'# --with-zlib=<path>
};

Nothing else is necessary as long as the VC version is 2005 or later. See the next section for the changes I applied for the VC6 builds.

Modification to the sources (VC6) only

libpq relies on SHGetFolderPath which is not available in the Platform SDK used by VC6 (2003/02). The work around is:

#ifndef SHGetFolderPath
	{
HMODULE shfolder = LoadLibrary("shfolder.dll");
FARPROC qSHGetFolderPath;
#define CSIDL_PROGRAM_FILES 38
#define CSIDL_APPDATA 0x001a
char szPath[MAX_PATH];
 
shfolder = LoadLibrary("shfolder.dll");
if(shfolder == NULL) {
	return false;
}
 
 
qSHGetFolderPath = GetProcAddress(shfolder, "SHGetFolderPathA");
if (qSHGetFolderPath == NULL) {
	FreeLibrary(shfolder);
	return NULL;
}
 
if (qSHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szPath)) {
	FreeLibrary(shfolder);
	return NULL;
}
 
}
#else
	if (SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, tmppath) != S_OK)
		return false;
#endif

Configure

Configure for Win32

cd  C:\php-sdk\vc9\x86\libs_builds\postgresql-8.3.3

Compiling

internals/windows/libs/libpg.1216833488.txt.gz · Last modified: 2017/09/22 13:28 (external edit)