Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?

Lists: pgsql-general
From: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2016-01-04 12:40:29
Message-ID: CANFyU959RRvAqmrGvLor=go3PSi4LdYcjDw8TQ6YRvzpouZrog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg사설 토토SQL

Hi

As per the installation doc available here,
http://www.postgresql.org/docs/devel/static/install-windows.html

the sources can be built with Microsoft Visual C++ 2005 to Microsoft Visual
C++ 2013. Does it mean the higher version like Microsoft Visual C++ 2015 is
not supported? We tried building it with Visual Studio 2015 and Windows 10
SDK, but see build errors like

src/backend/utils/adt/pg_locale.c(809): error C2037: left of 'locale_name'
specifies undefined struct/union '__crt_locale_data'

--
Sandeep Thakkar


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2016-01-04 13:07:43
Message-ID: CAB7nPqSWb3joq8YQtCHo5KJsbcuS81M5_7WUKZG406jBGS17_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg젠 토토SQL :

On Mon, Jan 4, 2016 at 9:40 PM, Sandeep Thakkar
<sandeep(dot)thakkar(at)enterprisedb(dot)com> wrote:
> As per the installation doc available here,
> http://www.postgresql.org/docs/devel/static/install-windows.html
>
> the sources can be built with Microsoft Visual C++ 2005 to Microsoft Visual
> C++ 2013. Does it mean the higher version like Microsoft Visual C++ 2015 is
> not supported? We tried building it with Visual Studio 2015 and Windows 10
> SDK, but see build errors like
>
> src/backend/utils/adt/pg_locale.c(809): error C2037: left of 'locale_name'
> specifies undefined struct/union '__crt_locale_data'

I am afraid that's not within the support range now.. Like similar
builds with MSVC in the past, this is surely going to need some teaks
with _MSC_VER flags. Just nobody got around yet to patch the code.
--
Michael


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2016-01-04 15:12:16
Message-ID: 11823.1451920336@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 503 범퍼카 토토 페치

Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
> On Mon, Jan 4, 2016 at 9:40 PM, Sandeep Thakkar
> <sandeep(dot)thakkar(at)enterprisedb(dot)com> wrote:
>> ... We tried building it with Visual Studio 2015 and Windows 10
>> SDK, but see build errors like
>>
>> src/backend/utils/adt/pg_locale.c(809): error C2037: left of 'locale_name'
>> specifies undefined struct/union '__crt_locale_data'

> I am afraid that's not within the support range now.. Like similar
> builds with MSVC in the past, this is surely going to need some teaks
> with _MSC_VER flags. Just nobody got around yet to patch the code.

That particular chunk of code is quite MSVC version dependent; read the
comments for it. It's annoying but not especially surprising that they
broke it in an upgrade. Somebody will have to research how one is
supposed to get the appropriate locale name now.

regards, tom lane


From: Yury Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2016-01-21 17:52:18
Message-ID: e317eec9-d40d-49b9-b776-e89cf1d18c82@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Tom Lane wrote:
> Somebody will have to research how one is
> supposed to get the appropriate locale name now.
It's just a bug:
https://connect.microsoft.com/VisualStudio/feedback/details/1882835/locale-t-compile-issues-with-vs2015
I spied a solution there and made a patch (in attachment).
I came across this error when building Postgres using the CMake for the
MSVC 2015.

Thanks.

PS I do not know whether this patch needs to be added to commitfest?
--
Yury Zhuravlev
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
workaround_for_msvc2015_issue.patch text/x-patch 1.1 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Yury Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2016-01-21 21:42:44
Message-ID: 29010.1453412564@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 503 토토 커뮤니티 페치

Yury Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru> writes:
> +#if _MSC_VER >= 1800
> + //From VS2012.
> + typedef struct localerefcount
> + {
> + char *locale;
> + wchar_t *wlocale;
> + ... etc etc ...

Ick. Even if that works today, it seems absolutely guaranteed to fail
in future, as soon as Microsoft either puts back the visible declaration
or changes the struct contents. If they've made a conscious decision
to not export the struct anymore, it's likely because they intend to
change it ... so I'd put the half-life of this "fix" at no more than one
Visual Studio release.

Hopefully, if they removed the visible declaration intentionally, they
provided some other way to get at those locale names. That's what we
need to be looking for, not hoping that direct access to undocumented
structures will continue to work.

regards, tom lane


From: Yury Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2016-01-21 22:16:28
Message-ID: f6e9bfd7-0a1d-4152-9b00-dffde1807fb2@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Tom Lane wrote:
> Ick. Even if that works today, it seems absolutely guaranteed to fail
> in future, as soon as Microsoft either puts back the visible declaration
> or changes the struct contents. If they've made a conscious decision
> to not export the struct anymore, it's likely because they intend to
> change it ... so I'd put the half-life of this "fix" at no more than one
> Visual Studio release.

Yes. You right. But at the moment, it's better than nothing. In addition,
we can then do something like this:
#if _MSC_VER >= 1800 && _MSC_VER < 1820

after MS push fix.

> Hopefully, if they removed the visible declaration intentionally, they
> provided some other way to get at those locale names. That's what we
> need to be looking for, not hoping that direct access to undocumented
> structures will continue to work.

It's more like a simple bug after refactoring. But I will try find another
way. (I don't like undocumented structures)

Thanks.
--
Yury Zhuravlev
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Yury Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2016-01-22 00:30:36
Message-ID: CAB7nPqTrMYu1qwrCgJkimtajyzeXRCJz-FjgBab05HEDJVuWkQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg롤 토토SQL :

On Fri, Jan 22, 2016 at 7:16 AM, Yury Zhuravlev
<u(dot)zhuravlev(at)postgrespro(dot)ru> wrote:
> Tom Lane wrote:
>> Ick. Even if that works today, it seems absolutely guaranteed to fail
>> in future, as soon as Microsoft either puts back the visible declaration
>> or changes the struct contents. If they've made a conscious decision
>> to not export the struct anymore, it's likely because they intend to
>> change it ... so I'd put the half-life of this "fix" at no more than one
>> Visual Studio release.
>
> Yes. You right. But at the moment, it's better than nothing. In addition, we
> can then do something like this:
> #if _MSC_VER >= 1800 && _MSC_VER < 1820
>
> after MS push fix.

Urg. That's just ugly.

>> Hopefully, if they removed the visible declaration intentionally, they
>> provided some other way to get at those locale names. That's what we
>> need to be looking for, not hoping that direct access to undocumented
>> structures will continue to work.
>
> It's more like a simple bug after refactoring. But I will try find another
> way. (I don't like undocumented structures)

How long do you think it would take for MS 1820 to be fixed and out? I
wouldn't personally mind telling to people trying to compile with 1800
that we cannot support it because it is buggy. That's one less wart to
have forever in the code.
--
Michael


From: Yury Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2016-01-22 07:10:28
Message-ID: d5570d5a-6be8-4d3b-951a-428e0f03389e@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 캔SQL :

Michael Paquier wrote:
> How long do you think it would take for MS 1820 to be fixed and out?
Maybe never.

> I
> wouldn't personally mind telling to people trying to compile with 1800
> that we cannot support it because it is buggy. That's one less wart to
> have forever in the code.
For the user, this is a bad response. In addition, many of the new features
msvc, due to which the user must use it.
Also, I think the current code looks like a hack. It's okay if we for some
time to add one more hack. But as I wrote above, I will try to find a
better solution.
While I was not going to back down: CMake+MSVC2015

Thanks.

--
Yury Zhuravlev
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company


From: Yury Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>
To: <pgsql-general(at)postgresql(dot)org>
Cc: <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2016-01-22 12:06:25
Message-ID: a8b47e79-d0fd-498d-8d1a-708e16dddd3c@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 503 토토 사이트 페치

Please look at the new patch. It is filled with black magic, but it looks
still more true.
He agreed with the internal API.

--
Yury Zhuravlev
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
workaround_for_msvc2015_issue_v2.patch text/x-patch 864 bytes

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Yury Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2016-01-23 15:12:43
Message-ID: CAB7nPqSo64_Fnut4s6KDKmnhdvW+Z3nBqqzVM9xxX=tPhkCk2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Fri, Jan 22, 2016 at 9:06 PM, Yury Zhuravlev
<u(dot)zhuravlev(at)postgrespro(dot)ru> wrote:
> Please look at the new patch. It is filled with black magic, but it looks
> still more true.
> He agreed with the internal API.

+ __crt_locale_data_public* public_loct =
__acrt_get_locale_data_prefix(loct);
Where did you get that?
--
Michael


From: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2017-02-23 13:14:30
Message-ID: CANFyU95F5vOw4otczfbJ2pAu8jqX2AG8rftuQqFGT=Yt5EaiXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 꽁 머니SQL

Hi,

I see that the commit *0fb54de9aa4ffb792ea63af853146021ae501f12* adds
support to build with Visual Studio 2015. But, I tried building 9.6.2 and
it returns me the same error on Windows2012 R2. Is it only me that is
seeing the error?

On Mon, Jan 4, 2016 at 8:42 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
> > On Mon, Jan 4, 2016 at 9:40 PM, Sandeep Thakkar
> > <sandeep(dot)thakkar(at)enterprisedb(dot)com> wrote:
> >> ... We tried building it with Visual Studio 2015 and Windows 10
> >> SDK, but see build errors like
> >>
> >> src/backend/utils/adt/pg_locale.c(809): error C2037: left of
> 'locale_name'
> >> specifies undefined struct/union '__crt_locale_data'
>
> > I am afraid that's not within the support range now.. Like similar
> > builds with MSVC in the past, this is surely going to need some teaks
> > with _MSC_VER flags. Just nobody got around yet to patch the code.
>
> That particular chunk of code is quite MSVC version dependent; read the
> comments for it. It's annoying but not especially surprising that they
> broke it in an upgrade. Somebody will have to research how one is
> supposed to get the appropriate locale name now.
>
> regards, tom lane
>

--
Sandeep Thakkar


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2017-02-23 13:33:18
Message-ID: CAB7nPqSrx1iGF6x0hQyxrd4MiGHs=9AObcZDvCCWeZkEftCw5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg배트맨 토토SQL

On Thu, Feb 23, 2017 at 10:14 PM, Sandeep Thakkar
<sandeep(dot)thakkar(at)enterprisedb(dot)com> wrote:
> I see that the commit 0fb54de9aa4ffb792ea63af853146021ae501f12 adds support
> to build with Visual Studio 2015. But, I tried building 9.6.2 and it returns
> me the same error on Windows2012 R2. Is it only me that is seeing the error?

Yes that should work. What kind of errors do you see?
--
Michael


From: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
Date: 2017-02-23 17:42:07
Message-ID: CANFyU95VubzwrNU4kdrwa4wfiqtqugVVXcziWxKSJvWXicO+7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Thu, Feb 23, 2017 at 7:03 PM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:

> On Thu, Feb 23, 2017 at 10:14 PM, Sandeep Thakkar
> <sandeep(dot)thakkar(at)enterprisedb(dot)com> wrote:
> > I see that the commit 0fb54de9aa4ffb792ea63af853146021ae501f12 adds
> support
> > to build with Visual Studio 2015. But, I tried building 9.6.2 and it
> returns
> > me the same error on Windows2012 R2. Is it only me that is seeing the
> error?
>
> Yes that should work. What kind of errors do you see?
>
src/backend/utils/adt/pg_locale.c(927): error C2037: left of 'locale_name'
specifies undefined struct/union '__crt_locale_data'
[D:\pginstaller\postgres.windows-x64\postgres.vcxproj]
src/backend/utils/adt/pg_locale.c(928): error C2198: 'wchar2char': too few
arguments for call [D:\pginstaller\postgres.windows-x64\postgres.vcxproj]

> --
> Michael
>

--
Sandeep Thakkar