From: Nordström Thomas <thomas.nordstrom1@saabgroup.com>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Issues with compiling libpq 9.1.2 with Visual C++
Date: Tue, 18 Sep 2018 09:24:36 +0000
Message-ID: <e50405d5e33c48ac85929d78b0ac2fd0@CORPAPPL840.corp.saab.se> (raw)
OS: Windows 10
Toolset: vc141 (Visual Studio 2017)
I'm having trouble compiling version 9.1.2 of libpq with Visual C++. The reason that I want this particular version is because it's the one included with GDAL version 2.1.3 from GISinternals.com. To be specific, I pulled commit cfd8cf37d20be715e4bb9e382844c79556516824 from GitHub.
What I'm doing is running a powershell script with the following command (of course, I've already run the batch-file included with Visual Studio which sets all the relevant PATH environment variables needed to compile with Visual C++):
nmake /f "win32.mak" DEBUG=1 USE_SSL=1 SSL_INC="$opensslDir\include" SSL_LIB_PATH="$opensslDir\x86\Debug\lib\"
This first complains that there's no libpq-dist.rc. Through some googling I found this page: https://pgolub.wordpress.com/2009/04/13/building-postgresql-client-library-using-borland-c-compiler-... It says to just rename libpq.rc.in. This at least stops the error message, but it then complains about not finding libpqdll.def. That page said that the author solved it by simply finding an old version of that file, which to me sounds like a bad idea and also I've been unable to do.
If I run the build again it doesn't complain about the lack of libpqdll.def and claims that all Win32 files have been built. The static lib *seems* to have been built correctly, but the libpq.dll is 0 kB and there's no libpqdll.lib, so it clearly fails.
I'm *guessing* that both libpq-dist.rc and libpqdll.def would have been generated by running .\configure. However, when I try doing that it only looks for gcc and cc, but not cl.exe, so it gives the error that there's "no acceptable C compiler found in $PATH". I've found through Googling around that a lot of other people have .\configure scripts that look for cl.exe as well.
I'm running .\configure like this, btw:
sh .\configure
"sh" is Git Bash.
So,
How do I get libpq-dist.rc and libpqdll.def? (Through .\configure?)
If I have to use .\configure, how do I get it to look for cl.exe?
Thank you.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: thomas.nordstrom1@saabgroup.com
Subject: Re: Issues with compiling libpq 9.1.2 with Visual C++
In-Reply-To: <e50405d5e33c48ac85929d78b0ac2fd0@CORPAPPL840.corp.saab.se>
References: <e50405d5e33c48ac85929d78b0ac2fd0@CORPAPPL840.corp.saab.se>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox