Re: VS 2015 support in src/tools/msvc

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Petr Jelinek <petr(at)2ndquadrant(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: VS 2015 support in src/tools/msvc
Date: 2016-03-04 14:23:54
Message-ID: CAB7nPqT8mfN6GoRt4WcNh8WiK==sSh3VkVonRFMzOi6oXefTQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 4, 2016 at 3:54 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> I still need to dig into that in more details. For the time being the
> patch attached is useful IMO to plug in VS 2015 with the existing
> infrastructure. So if anybody has a Windows environment, feel free to
> play with it and dig into those problems. I'll update this thread once
> I have a more advanced status.

OK, attached are a set of patches that allowed me to compile Postgres
using VS2015, in more details:
- 0001, as mentioned by Petr upthread, psed is removed from the core
distribution of Perl in 5.22, so when installing ActivePerl it is not
possible to create probes.h, and the code compilation would fail. I
bumped into that so here is a patch. What I am proposing here is to
replace psed by sed, sed being available in MSYS like bison and flex,
so when building using MSVC the environment to set up is normally
already good to go even with this additional dependency. Now, it is
important to mention that probes.h is not part of a source tarball. I
think that we would want probes.h to be part of a source tarball so as
it would be possible to compile the code on Windows using MSVC without
having to install MSYS. I haven't done that in this patch, thoughts on
the matter are welcome.
- 0002, which adds support for VS2015 in src/tools/scripts
- 0003, to address a compilation failure that I bumped into when
compiling ecpg. In src/port, TIMEZONE_GLOBAL and TZNAME_GLOBAL refer
to respectively timezone and tzname, however for win32, those should
be _timezone and _tzname. See here:
https://msdn.microsoft.com/en-us/library/htb3tdkc.aspx
- 0004, which is to address the problem of the missing lc_codepage
from locale.h in src/port/. I have been pondering about the use of
more fancy routines like GetLocaleInfoEx as mentioned by Petr
upthread. However, I think that we had better avoid any kind of
complication and just fall back to the old code path should _MSC_VER
>= 1900. We could always reuse lc_codepage if it gets reintroduced in
a future version of VS.

This set of patches is clearly a work-in-progress, but I am at the
point where feedback is welcome, and the code can compile. The issue
wit psed is something I think could be backpatched a bit more than the
VS2015 core patches, support for perl 5.22 happening on all the
supported branches.
Note that I did not bump into the stdbool issues. Note as well that VS
has complained about a couple of warnings. I am attaching them in the
file named VS2015_warnings.txt. Those are quite interesting as well.
--
Michael

Attachment Content-Type Size
VS2015_warnings.txt text/plain 8.2 KB
0001-Replace-dependency-to-psed-by-sed.patch application/x-patch 3.8 KB
0002-Add-support-for-VS-2015-in-MSVC-scripts.patch application/x-patch 4.9 KB
0003-Fix-declaration-of-TIMEZONE_GLOBAL-and-TZNAME_GLOBAL.patch application/x-patch 1.1 KB
0004-Fix-use-of-locales-for-VS-2015.patch application/x-patch 1.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Verite 2016-03-04 14:54:41 Re: raw output from copy
Previous Message Robert Haas 2016-03-04 14:02:19 Re: postgres_fdw vs. force_parallel_mode on ppc