/usr/share/doc/odbc-postgresql/docs/win32-compilation.html is in odbc-postgresql 1:10.01.0000-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Compiling psqlODBC on Windows</title>
<script src="frame_adjust.js" language="javascript"></script>
</head>
<body bgcolor="#ffffff" text="#000000" link="#ff0000" vlink="#a00000" alink="#0000ff">
<h1>Compiling psqlODBC on Windows</h1>
<p>
This page describes how to build the PostgreSQL ODBC Driver on Windows. There
are three methods to build: from command line using nmake makefiles, from
Powershell using MSBuild files, and from Visual Studio IDE.
</p>
<p>
The following 3rd party software are required for the build:
<ul>
<li> Microsoft Windows SDK 7.0 (or later), or Microsoft Visual Studio C++ 2005
Edition (or later). Other compilers may work but have not been tested.
Download the latest version from <a href="http://www.microsoft.com/downloads/">Microsoft's download page</a>
</li>
<li> PostgreSQL Client library (libpq.dll) and headers. Download the latest
version from the <a href="http://www.enterprisedb.com/products-services-training/pgbindownload/">
PostgreSQL Binaries Download page</a>.
</li>
<li> WiX Toolset. Required for building the installer. Download the latest
version from the <a href="http://wixtoolset.org/">WiX Toolset website</a>
</ul>
</p>
<h2>Building with Powershell and MSBuild</h2>
<pre>
Using Powershell and MSBuild is recommended.
In fact the binaries of official release are built using this mothod.
Currently 4 Windows Powershell scripts are provided for developers.
winbuild/BuildAll.ps1 - build all dlls for psqlodbc drivers using
MSBuild.
winbuild/editConfiguration.ps1 - a GUI tool to set Build environment
winbuild/regress.ps1 - build regression test programs and run
installer/buildInstallers.ps1 - build installers(.msi and setup.exe)
Use Powershell console or Command Prompt to invoke scripts:
For example, to build the driver:
C:\psqlodbc\winbuild\> (Powershell) ./BuildAll.ps1 <options>
or you can use the same functionality from Command Prompt using Windows
helper batch at the parent folder (..\). See ..\readme_winbuild.txt.
C:\psqlodbc\> (Commnd Prompt) .\BuildAll.bat <options>
1. Please start a powershell console and set the ExecutionPolicy of
Powershell to RemoteSigned or Unrestricted.
You can get the ExecutionPolicy by typing
Get-ExecutionPolicy
When the ExectionPolicy is "Restricted" or "AllSigned" then type e.g.
Set-ExecutionPolicy RemoteSigned
To see details about ExecutionPolicy, type
Get-Help about_Execution_Policies
2. You have to install one of the following.
. Visual Studio 2015 non-Express edtion or Express 2015 for Windows
Desktop
. Visual Studio 2013 non-Express edtion or Express 2013 for Windows
Desktop
. Visual Studio 2012 non-Express edtion or Express 2012 for Windows
Desktop
. Full Microsoft Visual C++ 2010
. Windows SDK 7.1
You have to include x64 development tools (bin, lib, include) as
well as x86 ones for the installation.
You can install multiple versions of VC++ and use them.
You can easily switch by specifying VCVersion parameter.
3. Setup Build environment
Please type
.\editConfiguration(.ps1)
and edit the setting of your environment especially the folders
you placed libpq related include/lib/bin files.
<img src="./editConfiguration.jpg" />
4. Build
Please type
.\BuildAll(.ps1)
to invoke build operations.
If you installed both VC10 and VC12 and you'd like to compile
under VC10 environment, type
.\BuildAll(.ps1) -V(CVersion) 10.0
or set the value 10.0 to vcversion using ./editConfiguration.
To see details about the use of BuildAll, type
Get-Help .\BuildAll(.ps1) [-Detailed | -Examples | -Full]
5. Outputs of Build
The build can produce output in up to four directories for each of
the debug and release configurations:
- x64_Unicode_Release the Unicode driver, 64-bit
- x86_ANSI_Release the ANSI driver, 64-bit
- x86_Unicode_Release the ANSI driver, 32-bit
- x86_ANSI_Release the Unicode driver, 32-bit
For debug builds (-Configuration Debug) the directories are named with
Debug instead of Release but otherwise the same.
pgxalib.dll is only built for the multibyte/unicode version, as it is
the same for both unicode and ansi drivers.
6. How to use drivers.
You can't use psqlodbc drivers at once you build the drivers.
Usually you have to install drivers using installers made by
installer/buildInstallers.ps1. buildInstallers.ps1 bundles
libpq and related libraries like ssleay32, libeay32 from the
PostgreSQL bin directory and MSVC runtime libraries compiled with.
However, it is painful for developers to build binaries, build
installers and install each time the source files are changed.
It is recommended to use a special installation-less driver
(postgres_devw) registered by regress.ps1
7. Regression test in place
After BuildAll(.ps1), please type
.\regress(.ps1)
You have to neither install nor copy binaries.
By default, build 32-bit binaries from test sources and run the tests.
If you'd like to test 64-bit version, please type
.\regress(.ps1) -p(latform) x64
Please note the outputs(obj, exe etc) generated by build operations and
results of tests are placed in the directory winbuild/test_x86(test_x64
in case of 64-bit).
8. Installer
To build the .msi installer file:
C:\psqlodbc\installer\> (Powershell) ./buildInstallers.ps1 <options>
or
C:\psqlodbc\> (Command Prompt) .\buildInstallers.bat <options>
By default, buildInstallers.ps1 builds bootstrapper program
psqlodbc-setup.exe together.
See ../installer/readme.txt in the source directory for details.
Troubleshooting:
Some documentation on dealing with Windows SDK installation issues
can be found on the related pg_build_win page:
https://github.com/2ndQuadrant/pg_build_win#troubleshooting
</pre>
<h2>Building with nmake.exe</h2>
Use NMAKE.exe to build the driver for the currently active target:<br><br>
<code>C:\psqlodbc\> nmake /f win64.mak <options></code><br><br>
<p>
Despite the name, win64.mak is used to build both 32-bit and 64-bit binaries.
With the Microsoft Windows SDK Command Prompt, you can switch between 32-bit
and 64-bit target architectures with <tt>setenv /x86</tt> and <tt>setenv
/x64</tt> commands. If using a Visual Studio Command Prompt you can start the
x86 or x64 versions from the Start menu, or run <tt>vcvarsall.bat</tt> with
appropriate options to switch architectures.
</p>
<p>
To build the .msi installer file:<br><br>
<code>C:\psqlodbc\> nmake /f win64.mak installer</code><br><br>
The resulting installer file goes to installer/x64 or installer/x86 directory.
</p>
<p>
To build both 32-bit and 64-bit versions in one command:<br><br>
<code>C:\psqlodbc\> nmake /f win64.mak world</code><br><br>
</p>
<p>
The following build options may be used, either on the command line, or
by creating a file called "windows-local.mak".
</p>
<p>
<table cellspacing="0" cellpadding="3" width="780" border=1>
<tr>
<td>Variable</td>
<td>Values</td>
</tr>
<tr>
<td>CFG</td>
<td>Release(default), or Debug</td>
</tr>
<tr>
<td>PG_INC</td>
<td>$(PROGRAMFILES)\PostgreSQL\9.3\include</td>
</tr>
<tr>
<td>PG_LIB</td>
<td>$(PROGRAMFILES)\PostgreSQL\9.3\lib</td>
</tr>
<tr>
<td>SSL_INC</td>
<td>C:\OpenSSL-Win32\include</td>
</tr>
<tr>
<td>SSL_LIB</td>
<td>C:\OpenSSL-Win32\lib</td>
</tr>
<tr>
<td>ANSI_VERSION</td>
<td>no (If set to "yes", output dll name to psqlodbc30a.dll)</td>
</tr>
<tr>
<td>MSDTC</td>
<td>yes</td>
</tr>
</table></p>
<ol>
<li>UNICODE is the default (psqlodbc35w.dll), unless ANSI_VERSION is selected (psqlodbc30a.dll)</li>
<li>libpq.dll is mandatory.</li>
<li>If MSDTC == Yes, "pgxalib.dll" is created.</li>
<li>If MSDTC is enabled, ANSI_VERSION also creates "pgenlista.dll", or UNICODE creates "pgenlist.dll".</li>
</ol>
<h2>IDE Method</h2>
<p>A Microsoft Visual Studio project file (and workspace) is included in the source tree.
</p>
<p><strong>psqlodbc.dsp</strong>
can be used with Microsoft Visual C++ 6.0.
</p>
<p><strong>psqlodbc.proj</strong> and
<strong>psqlodbc.sln</strong>
can be used with Microsoft Visual C++ 2005 Edition (including the Express edition which can be downloaded free of charge from <a href="http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx">http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx</a>)
</p>
<p>
Preparation before the build:
</p>
<ol>
<li>The Windows distribution of PostgreSQL will install the required headers and libraries into C:\Program Files\PostgreSQL\9.2
<li>OpenSSL should be installed into C:\OpenSSL (OpenSSL binaries can be downloaded from <a href="http://www.slproweb.com/products/Win32OpenSSL.html">http://www.slproweb.com/products/Win32OpenSSL.html</a>)
</li></ol>
<p>
If you want to change the installation arrangement, it
is necessary to edit the project settings.
</p>
<p>
Note:
</p>
<p>
The default build settings will create the following driver:
</p>
<ol>
<li>UNICODE support.
<li>libpq is mandatory.
<li>The driver filename is "psqlodbc35w.dll".</li></ol>
</body>
</html>
|