issues/experience with building postgres on Windows

Started by Martin Zaunover 17 years ago6 messages
#1Martin Zaun
Martin.Zaun@Sun.COM

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!

#2Andrew Dunstan
andrew@dunslane.net
In reply to: Martin Zaun (#1)
Re: issues/experience with building postgres on Windows

Martin Zaun wrote:

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

Nobody ever said this was supported AFAIK. VC++ Express 2005 is the
supported compiler so far.

- ok with VS Express 2005 but integration issues with Platform SDK

Right.

- issues locating the 14 required software packages:
- no luck getting Bison 1.875 or 2.2 Windows binaries

bison 1.875 is available here:
http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=22822

- linkage errors with the latest ActivePerl/TCL libraries

Ugh.

What would be helpful would be a build log. something like:
http://www.pgbuildfarm.org/cgi-bin/show_stage_log.pl?nm=mastodon&dt=2008-07-24%20010001&stg=make
or an extract from it.

cheers

andrew

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#2)
Re: issues/experience with building postgres on Windows

Andrew Dunstan <andrew@dunslane.net> writes:

Martin Zaun wrote:

- issues locating the 14 required software packages:
- no luck getting Bison 1.875 or 2.2 Windows binaries

bison 1.875 is available here:
http://sourceforge.net/project/showfiles.php?group_id=23617&amp;package_id=22822

To the best of my knowledge, any bison version >= 1.875 works
fine; you need not insist on finding exactly those two releases.

regards, tom lane

#4Martin Zaun
Martin.Zaun@Sun.COM
In reply to: Tom Lane (#3)
Re: issues/experience with building postgres on Windows

Tom Lane wrote:

Andrew Dunstan <andrew@dunslane.net> writes:

Martin Zaun wrote:

- issues locating the 14 required software packages:
- no luck getting Bison 1.875 or 2.2 Windows binaries

bison 1.875 is available here:
http://sourceforge.net/project/showfiles.php?group_id=23617&amp;package_id=22822

To the best of my knowledge, any bison version >= 1.875 works
fine; you need not insist on finding exactly those two releases.

On my machine, using GnuWin32's Bison 2.1 resulted in compile errors
while cygwin's 2.2 is fine. Have seen the details being discussed
on hackers some time ago.

Thanks,
Martin

#5Hiroshi Saito
z-saito@guitar.ocn.ne.jp
In reply to: Martin Zaun (#1)
Re: issues/experience with building postgres on Windows

Hi.

Sorry, very late reaction....

I'm based on the environment of VC++2005 and MinGW by the reason for requiring official
support. and since it does not have many resources, the environment of VC++2008 is
restricted.
Therefore, many suggestion can't be performed now....:-(

----- Original Message -----
From: "Martin Zaun" <Martin.Zaun@Sun.COM>

(snip)

- locating a OSSP-UUID binary package for Windows
(.dll but no uuid.h with Hiroshi Saito's binary package?)

Ahh, sorry, Although I adjusted with Ralf-san of the official central figure of OSSP,
I did not synchronize with the release timing of PostgreSQL....Then, It was limited
to guidance of my web page.

(snip)

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

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

Yeah, I will propose to Ralf-san.

(snip)

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?

Um, I do not understand Cygwin....
Please try define of config.h
---
/* Predefined possible va_copy() implementation (id: ASS) */
#define __VA_COPY_USE_ASS(d, s) do { (d) = (s); } while (0)
---

Regards,
Hiroshi Saito

#6Magnus Hagander
magnus@hagander.net
In reply to: Andrew Dunstan (#2)
Re: issues/experience with building postgres on Windows

Andrew Dunstan wrote:

Martin Zaun wrote:

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

Nobody ever said this was supported AFAIK. VC++ Express 2005 is the
supported compiler so far.

All Visual C++ 2005 versions are supported, not just Express. But it's
true that 2008 is currently not supported out of the box.

- ok with VS Express 2005 but integration issues with Platform SDK

Right.

Yeah, that's an issue with VSE. The full Visual Sudio version doesn't
have this problem.

IIRC I have built it with the 2008 SDK, but I'm not 100% sure.

As for the paths - did you just compare the PATHs in the environment or
actually run the build? Because the build runs fine even when the PATHs
in the environment are wrong, as long as they are correct in the files -
at least for me...

But. It does sound like you are on the wrong commandline. You need to
use the Visual Studio one, not the Platform SDK one.

(And yes, the Visual Studio Express integration with the Platform SDK is
really crappy. I think they've made it nicer in 2008)

- issues locating the 14 required software packages:
- no luck getting Bison 1.875 or 2.2 Windows binaries

bison 1.875 is available here:
http://sourceforge.net/project/showfiles.php?group_id=23617&amp;package_id=22822

FWIW, that's the one I'm currently running.

It's all in the download page on SF, but the gnuwin32 *website* has the
wrong version up. But it's browsable. Not sure if we want to hardwire
something like that into the docs, as they might change it around on us...

Providing a pre-made package might actually be interesting, but someone
needs to maintain it... But probably not all that much work. If we get
someone to take responsibility for it (no, I'm not volunteering - I'll
be happy to help set it up, but not the maintenance part), what do
people think about the idea?

- linkage errors with the latest ActivePerl/TCL libraries

Ugh.

Yeah, we should document the versioning there. IIRC, those versions
weren't available at the time that code was written :-)

I think for starters documentation is enough.

//Magnus