Обсуждение: Building PostgreSQL 9.6devel sources with Microsoft Visual C++ 2015?
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
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
On Mon, Jan 4, 2016 at 9:40 PM, Sandeep Thakkar <sandeep.thakkar@enterprisedb.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
Michael Paquier <michael.paquier@gmail.com> writes: > On Mon, Jan 4, 2016 at 9:40 PM, Sandeep Thakkar > <sandeep.thakkar@enterprisedb.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
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
Вложения
Yury Zhuravlev <u.zhuravlev@postgrespro.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
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
On Fri, Jan 22, 2016 at 7:16 AM, Yury Zhuravlev <u.zhuravlev@postgrespro.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
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
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
Вложения
On Fri, Jan 22, 2016 at 9:06 PM, Yury Zhuravlev <u.zhuravlev@postgrespro.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
Re: [GENERAL] Building PostgreSQL 9.6devel sources with MicrosoftVisual C++ 2015?
От
Sandeep Thakkar
Дата:
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@sss.pgh.pa.us> wrote:
Michael Paquier <michael.paquier@gmail.com> writes:
> On Mon, Jan 4, 2016 at 9:40 PM, Sandeep Thakkar
> <sandeep.thakkar@enterprisedb.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
Re: [GENERAL] Building PostgreSQL 9.6devel sources with MicrosoftVisual C++ 2015?
От
Michael Paquier
Дата:
On Thu, Feb 23, 2017 at 10:14 PM, Sandeep Thakkar <sandeep.thakkar@enterprisedb.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
Re: [GENERAL] Building PostgreSQL 9.6devel sources with MicrosoftVisual C++ 2015?
От
Sandeep Thakkar
Дата:
On Thu, Feb 23, 2017 at 7:03 PM, Michael Paquier <michael.paquier@gmail.com> wrote:
On Thu, Feb 23, 2017 at 10:14 PM, Sandeep Thakkar
<sandeep.thakkar@enterprisedb.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