Wednesday, July 23, 2008

[HACKERS] issues/experience with building postgres on Windows

Hi,

trying to build postgres on Windows, I ran into a number of
problems not covered by the FAQs or the PostgreSQL 8.3.3
documentation:
http://www.postgresql.org/docs/8.3/interactive/install-win32-full.html

In short, it's not been an easy experience so far:
- build errors with latest Visual Studio Express C++ 2008
- ok with VS Express 2005 but integration issues with Platform SDK
- issues locating the 14 required software packages:
- no luck getting Bison 1.875 or 2.2 Windows binaries
- linkage errors with the latest ActivePerl/TCL libraries
- locating a OSSP-UUID binary package for Windows
(.dll but no uuid.h with Hiroshi Saito's binary package?)

Below are more details / questions / suggestions with the goal to
help for a better build experience on Windows.

Any hints or comments welcome!

Regards,
Martin


1) Build errors with Visual Studio Express C++ 2008

For building with Visual Studio Express 2005, the Microsoft
Platform SDK needs to be downloaded, installed, and integrated
into the INCLUDE/LIB/PATHs.

However, since Visual Studio Express 2008 already comes with
the integrated SDK, I tried this one first. Ran into a number
of VCBuild errors:

vcbuild.exe : error VCBLD0010: Project 'G:\olsen\pg\pgsql\postgres.vcproj' requ
ires upgrade. Use 'vcbuild /upgrade' or 'devenv /upgrade' to upgrade the projec
t.

Couldn't get past these errors by executing "vcbuild /upgrade"
on the generated .vcproj files. The VS Release Notes and
other sites describe this issue a bit but to not much help.

==> Anyone knowing how to build postgres with VC++ 2008?


2) Back to Visual Studio Express C++ 2005 & MS Platform SDK

The postgres documentation wasn't specific but I installed
Microsoft Platform SDK for Windows Server 2003 R2
http://www.microsoft.com/downloads/details.aspx?FamilyID=0baf2b35-c656-4969-ace8-e4c0c0716adb&DisplayLang=en
for I guessed this the basis for the Postgres documentation.

There's a newer version, though, now called Windows SDK:
Windows SDK for Windows Server 2008 and .NET Framework 3.5
http://www.microsoft.com/downloads/details.aspx?FamilyID=e6e1c3df-a74f-4207-8586-711ebe331cdc&DisplayLang=en

==> Anyone tried building PG with latest Windows SDK (2008)?


3) Issues adding Platform SDK paths to VC++ 2005

The README in pgsql/src/tools/msvc/ informs about the steps
needed to integrate the Platform SDK with VC++ 2005 by editing
the Include, Library and Path tags in the files
vcprojectengine.dll.express.config
vcprojectengine.dll.config
under the VC++ directory vc\vcpackages.

The README's following assertion is not correct, I think:
"This should work for both GUI and commandline builds, but a
restart may be necessary."

While the Include/Lib/Path changes appear to be in effect for
the GUI they are NOT in the Visual Studio 2005 Command Prompt!
(even after restart)

The following MS pages
http://www.microsoft.com/express/2005/platformsdk/default.aspx
http://www.microsoft.com/express/2005/platformsdk/default.aspx
describe additional steps, notably to also delete the file
vccomponents.dat
located in
%USERPROFILE%\Local Settings\Application Data\Microsoft\VCExpress\8.0
before restarting VC++ Express Edition.

But this didn't change the paths in the VS 2005 Command Prompt
either. So I had to change the user INCLUDE/LIB/PATH
environment manually.

Actually, I'm using the Command Prompt from the MS Platform
SDK's Build Environment selection, not the VS 2005 start menu,
for other important environment settings (target OS, 32/64,
debug/release etc).

==> Does the README's assertion need to be changed/corrected?


4) Issues with locating the 14 required software packages

- ActiveState Perl, ActiveState TCL
Had to click around to find out that I don't want the
"ActivePerl Pro Studio Free Trial" software but the
"ActivePerl". Same with ActiveTcl.

Problem: found out later that PG doesn't build with the
latest ActivePerl/TCL language packs!

- Bison, Flex
The PG documentation states: only Bison 1.875 or versions
2.2 and later will work.

Problem: The GnuWin32 website only offers Bison 2.1!

- Diff, Gettext
No problems.

- MIT Kerberos
No problems but unsure how to answer some of the
installation questions.

- libxml2, libxslt, iconv
No problems.

- openssl
No problems but unsure how to answer some of the
installation questions.

- ossp-uuid
Downloaded source from http://www.ossp.org/pkg/lib/uuid/.

Problem: from where to get a ossp-uuid Windows binary?

- Python
No problems.

- zlib
No problems.

==> Can't we provide a package for download with all/most of
the libraries/tools needed for building PG on Windows?


5) Configuring pgsql/src/tools/msvc/config.pl, buildenv.pl

A typo in my config.pl had the build aborting with only
The system cannot find the path specified.
and no further clues.

==> More information on misconfigured config.pl would help!


6) Getting a Bison 1.875 or 2.2 Windows binary

Google couldn't find me a Windows binary and I didn't want to
build one myself (using mingw). So, I copied cygwin's 2.2
binary, together with the needed .dlls, into an empty
directory at the end of the PATH.

==> Using cygwin's Bison 2.2 worked!


7) Linkage errors with the latest ActivePerl/TCL libraries

Having installed the latest ActivePerl/TCL language packs
(Perl: 5.10.0.1003, TCL: 8.5.2.0.284846) resulted in linkage
errors against libraries 'tk84.lib' and 'perl85.lib'.

I couldn't determine where those library were hardcoded, so, I
downloaded and installed older versions (Perl: 5.8.8.822, TCL:
8.4.19.0.285137. Worked!

==> Fixing the linkage errors against the latest ActivePerl/TCL
libs or documenting the version requirements would be great!


8) Getting a Windows OSSP-UUID library

Google found me a postgres hackers email thread with this link
http://winpg.jp/~saito/pg_work/OSSP_win32/
to 1.6.2 uuid-ossp.dll mingw-compiled by Hiroshi Saito. Thanks!

Problem: from where to get the also needed uuid.h?

I've seen that Hiroshi Saito has worked on a patch for building the
uuid-ossp package on Windows. I didn't succeed in building
ossp-uuid using wingw on Windows and took the shortcut of using
cygwin to generate the uuid.h.

But that hack didn't work, I'm getting linkage errors:

uuid.lib(uuid_str.obj) : error LNK2019: unresolved external symbol _va_copy referenced in function _uuid_str_vasprintf
.\Release\uuid-ossp\uuid-ossp.dll : fatal error LNK1120: 1 unresolved externals

==> Where can I find a complete ossp-uuid package for Windows?

And this is where I am right now. Any hints/comments welcome!


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

No comments: