Re: Compiling extensions on Windows - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Compiling extensions on Windows
Date
Msg-id 52D35F14.2020008@joeconway.com
Whole thread Raw
In response to Re: Compiling extensions on Windows  (Craig Ringer <craig@2ndquadrant.com>)
Responses Re: Compiling extensions on Windows
List pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/12/2014 07:22 PM, Craig Ringer wrote:
> On 01/13/2014 11:13 AM, Joe Conway wrote: What I mean is that you
> should not need a full Pg build tree to compile extensions. Just as
> we use PGXS on *nix, so it is possible to just use Visual Studio to
> build the extension on Windows as a VS project like any other.

I have never gotten that to work.

>> As long as the SDK is matched, the resulting plr.dll works fine 
>> with the EDB one-click installer version of postgres (or at
>> least so far).
> 
> The SDK shouldn't even need to match. Windows software is expected
> to cope with mismatched, mix-and-match C runtimes. Icky, but
> occasionally useful.

Unfortunately my experience tells me otherwise. Mismatched SDK =
plr.dll that does not work correctly with EDB builds of postgres.

> So long as you don't pass a FILE* across DLL boundaries, or free() 
> memory that was malloc()'d in another DLL, mixing runtimes should
> work fine. I'd be interested in knowing what problems you
> encountered when the runtime didn't match.

plr would not load. I'm not good enough with MSVC and Windows
debuggers to figure out why, and don't have the time or interest to
become so, I just know matching the SDK to the postgres build resulted
in it owrking for me and no more complaints of this type from the
field. It would work fine with the postgres build I made, but not with
the EDB build which of course is what virtually everyone running pg on
Windows uses.

> Maybe it's specific to how we do build within a Pg source tree? I
> was able to use three different SDK builds against EDB's latest
> 9.3 packages - SDK 7.1 (x86 and x64), toolchain v90 (x86), and
> toolchain v100 (x86) - to compile and test a moderately trivial
> extension.

Trivial is probably the key thing. With PL/R it also has to link
against the R.dll which is built with yet another toolchain on Windows.

Joe

- -- 
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJS018UAAoJEDfy90M199hl/mAP/2OhXbvrlKSzP6fWi8g9Tez0
PnWaOFXXPIeOi5lJ/o5rC7HrQdiCCBljSBAffq0PKl8SVn2cDwmA5E2n4T3JfZQF
PYGZiYuqoiZ6i+svW7x6XocDnIhJgMJvTvys7ToApjmkD3VEgj7RO8MHQyYmVDsh
A9WIPpyb96mTmzlTLnHZDkfL7MgEof4kTHHC2jOa6i3wMq+zATc6lBTXOcrrGzS8
qd/iIap0kNdwKgLEX/jXip0YOB8SMfxOeHVLV+790JUwnWmBJnbn3XDqFEmj39kK
dGEP8vaxjPppyEmMvkGZd5Hxw6WIGFASTjyn6kXH1VfVqsLNZYO+rwTXnSVtyqH0
aFCKLT7awMBjFSh3plFQcqxeeqElZZaCRNVO5xooQ28xoUoUl/wVYqI0yoF9hKKm
NlJ8jJGB6aEImFlQ7QUg2eZRfMpyYc9J06uaX1+/L3g71O4O2Xzgc6gPVWvYCIQP
BvcNBtUlxA38H5wjiMSlyyz4Si95cIIbqDfUliKZ1Ab0W24en0vnvISxk6v/2GKc
vE9X7GRFUjmUJNoIvkRu0hnzp5S955sO0X6Q6pDmgM2esGRADMTntY0Bcxp8R2qg
qiZkVs1vfuewLmzz4LqixItW9BhMHK3zdGcv07xntNt+EAaz8g3cU5tBZP8CP6y8
JTa/fyFth7hL+ttkH5hc
=9+nY
-----END PGP SIGNATURE-----



pgsql-hackers by date:

Previous
From: Andreas Karlsson
Date:
Subject: Re: Syntax of INSERT...ON DUPLICATE KEY LOCK FOR UPDATE
Next
From: Craig Ringer
Date:
Subject: Re: Compiling extensions on Windows