Обсуждение: Building under Visual Studio 2008 - pqcomm.c compile error
All,
I am attempting to build postgres 8.3.3 under Visual Studio 2008, and I get the following error in the build:
.\src\backend\libpq\pqcomm.c(389): error C2065: ‘IPPROTO_IPV6’ : undeclared identifier
Our IT department has asked us to upgrade all our systems from VS2005 to 2008. Though currently I don’t need to fully build postgres 8.3.3 via source (we use the binaries), we do have a custom module in contrib which we need to build a dll from. It seems the above error prevents the building of postgres.lib, which is needed to complete the build of our custom module. Has anyone tried successfully to build postgres under VS2008?
Doug Knight
WSI Corp
"Knight, Doug" <dknight@wsi.com> writes:
> I am attempting to build postgres 8.3.3 under Visual Studio 2008, and I
> get the following error in the build:
> .\src\backend\libpq\pqcomm.c(389): error C2065: 'IPPROTO_IPV6' :
> undeclared identifier
[ squint... ] They define IPV6_V6ONLY and AF_INET6 but not
IPPROTO_IPV6? That's pretty bizarre. You might want to hunt around in
the system header files for those symbols and see if there's some
feature macro or something we need to set to get IPPROTO_IPV6 to be
defined. Or maybe it's in some other header file that we're not
including.
regards, tom lane
On Mon, Jul 14, 2008 at 4:21 PM, Knight, Doug <dknight@wsi.com> wrote: > Has anyone tried successfully to build postgres under VS2008? I know neither Magnus or I have tried yet, and I doubt any of the other hackers have either. -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com
Unfortunately I had to uninstall VS2005 to install VS2008 due to limited
space, or I'd search the old libraries to see where the symbol used to
be. Anyone care to search their VS2005 includes for IPPROTO_IPV6 so I
can compare to the VS2008?
Also, following the usual build procedure (using build.bat/build.pl), I
encountered errors saying I needed to do "vcbuild /upgrade" on
postgres.vcproj, libpgport.vcproj, and pgevent.vcproj. After consulting
with one of our QA people who builds stuff in Windows all the time, I
came up with the following procedure to build postgres under VS2008
(This includes changing pqcomm.c per Tom's comment below):
(in msvc)
mkvcbuild.pl
cd ..\..\..
vcbuild /upgrade postgres.vcproj
vcbuild /upgrade libpgport.vcproj
vcbuild /upgrade pgevent.vcproj
(actually, I wound up creating a script that did vcbuild /upgrade to ALL
of the vcproj files here)
msbuild pgsql.sln
Note that after doing all the vcbuild /upgrade commands, I used msbuild
referencing the pgsql.sln file instead of vcbuild to do the actual
build. So, aside from the issue of the missing IPPROTO_IPV6 symbol, its
built under VS2008. It will probably be some time before I can try
running postgres built this way, as we're under the gun to get a release
out this week.
I'm not an MS developer by any means, so if someone has a better way to
do this feel free to say so. This is what worked for me.
Doug
-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Monday, July 14, 2008 12:05 PM
To: Knight, Doug
Subject: Re: [HACKERS] Building under Visual Studio 2008 - pqcomm.c
compile error
"Knight, Doug" <dknight@wsi.com> writes:
> Since I am primarily a Linux-based coder, do you know where I would
find
> the header files under VS2005 or 2008?
No idea, I don't use MSVC.
> Also, it looks like the
> IPPOROTO_IPV6 is only used within a ifdef check for IPV6_ONLY. Is
there
> some way I could "undefined" it to prevent this part of the code from
> being compiled?
Well, you could just change
#ifdef IPV6_V6ONLY
to
#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
and then it would compile --- but whether it would work right is less
clear, unless your machine doesn't do IPV6 anyway. Since we know this
code compiles under VS2005, I'm inclined to recommend that you look
for the real solution, which is to find out where that symbol went...
regards, tom lane
I’m getting this same error and wonder if Tom’s fix is sufficient.
IPPROTO_IPV6 is defined in wd2def.h IF _WIN32_WINNT >= 0x0501, but in
pg_config_os.h _WIN32_WINNT is DEFINED as 0x0500 so IPPROTO_IPV6 is left
undefined.
Regards,
Dave
-----------------------
Unfortunately I had to uninstall VS2005 to install VS2008 due to limited
space, or I'd search the old libraries to see where the symbol used to
be. Anyone care to search their VS2005 includes for IPPROTO_IPV6 so I
can compare to the VS2008?
Also, following the usual build procedure (using build.bat/build.pl), I
encountered errors saying I needed to do "vcbuild /upgrade" on
postgres.vcproj, libpgport.vcproj, and pgevent.vcproj. After consulting
with one of our QA people who builds stuff in Windows all the time, I
came up with the following procedure to build postgres under VS2008
(This includes changing pqcomm.c per Tom's comment below):
(in msvc)
mkvcbuild.pl
cd ..\..\..
vcbuild /upgrade postgres.vcproj
vcbuild /upgrade libpgport.vcproj
vcbuild /upgrade pgevent.vcproj
(actually, I wound up creating a script that did vcbuild /upgrade to ALL
of the vcproj files here)
msbuild pgsql.sln
Note that after doing all the vcbuild /upgrade commands, I used msbuild
referencing the pgsql.sln file instead of vcbuild to do the actual
build. So, aside from the issue of the missing IPPROTO_IPV6 symbol, its
built under VS2008. It will probably be some time before I can try
running postgres built this way, as we're under the gun to get a release
out this week.
I'm not an MS developer by any means, so if someone has a better way to
do this feel free to say so. This is what worked for me.
Doug
-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Monday, July 14, 2008 12:05 PM
To: Knight, Doug
Subject: Re: [HACKERS] Building under Visual Studio 2008 - pqcomm.c
compile error
"Knight, Doug" <dknight(at)wsi(dot)com> writes:
> Since I am primarily a Linux-based coder, do you know where I would
find
> the header files under VS2005 or 2008?
No idea, I don't use MSVC.
> Also, it looks like the
> IPPOROTO_IPV6 is only used within a ifdef check for IPV6_ONLY. Is
there
> some way I could "undefined" it to prevent this part of the code from
> being compiled?
Well, you could just change
#ifdef IPV6_V6ONLY
to
#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
and then it would compile --- but whether it would work right is less
clear, unless your machine doesn't do IPV6 anyway. Since we know this
code compiles under VS2005, I'm inclined to recommend that you look
for the real solution, which is to find out where that symbol went...
regards, tom lane
This electronic mail message is intended exclusively for the individual(s) or entity to which it is addressed. This message, together with any attachment, is confidential and may contain privileged information. Any unauthorized review, use, printing, retaining, copying, disclosure or distribution is strictly prohibited. If you have received this message in error, please immediately advise the sender by reply email message to the sender and delete all copies of this message.
THIS E-MAIL IS NOT AN OFFER OR ACCEPTANCE: Notwithstanding the Uniform Electronic Transactions Act or any other law of similar import, absent an express statement to the contrary contained in this e-mail, neither this e-mail nor any attachments are an offer or acceptance to enter into a contract, and are not intended to bind the sender, LeTourneau Technologies, Inc., or any of its subsidiaries, affiliates, or any other person or entity.
WARNING: Although the company has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments.
> I'm getting this same error and wonder if Tom's fix is sufficient. > > IPPROTO_IPV6 is defined in wd2def.h IF _WIN32_WINNT >= 0x0501, but in > pg_config_os.h _WIN32_WINNT is DEFINED as 0x0500 so > IPPROTO_IPV6 is left > undefined. > > Regards, > Dave > > ----------------------- > Unfortunately I had to uninstall VS2005 to install VS2008 due > to limited > space, or I'd search the old libraries to see where the symbol used to > be. Anyone care to search their VS2005 includes for IPPROTO_IPV6 so I > can compare to the VS2008? It is defined unconditionally in PlatformSDK/Include/WinSock2.h in VS2005 Professional. Will a build run on Win2000 if we define 0x0501 ? Andreas
On Wed, Sep 2, 2009 at 19:34, Zeugswetter Andreas OSB sIT<Andreas.Zeugswetter@s-itsolutions.at> wrote: >> I'm getting this same error and wonder if Tom's fix is sufficient. >> >> IPPROTO_IPV6 is defined in wd2def.h IF _WIN32_WINNT >= 0x0501, but in >> pg_config_os.h _WIN32_WINNT is DEFINED as 0x0500 so >> IPPROTO_IPV6 is left >> undefined. >> >> Regards, >> Dave >> >> ----------------------- >> Unfortunately I had to uninstall VS2005 to install VS2008 due >> to limited >> space, or I'd search the old libraries to see where the symbol used to >> be. Anyone care to search their VS2005 includes for IPPROTO_IPV6 so I >> can compare to the VS2008? > > It is defined unconditionally in PlatformSDK/Include/WinSock2.h > in VS2005 Professional. > > Will a build run on Win2000 if we define 0x0501 ? I believe it will - as long as we don't use any of those features. And AFAIK the API calls for winsock hasn't changed - it's just what parameters they take. But it is certainly something w need to verify by testing :-) -- Magnus HaganderMe: http://www.hagander.net/Work: http://www.redpill-linpro.com/