Обсуждение: Libpq visual c++ build errors, addrinfo and sockaddr_storage redefinition error
Libpq visual c++ build errors, addrinfo and sockaddr_storage redefinition error
От
"Pierre Joye"
Дата:
hi, While trying to update the PHP postgresql extension to 8.3.1, I met a couple of issues. The first was about not using kerberos, the makefile is incorrect as an error will be raised when kerberos is used and no kerberos is used. I added the following lines to avoid libpath error: !IFDEF USE_SSL CPP_PROJ=$(CPP_PROJ) /D USE_SSL SSL_LIBS=ssleay32.lib libeay32.lib gdi32.lib SSL_LIBPATH_ARG= /libpath:"$(SSL_LIB_PATH)" !ENDIF !IFDEF USE_KFW CPP_PROJ=$(CPP_PROJ) /D KRB5 KFW_LIBS=krb5_32.lib comerr32.lib gssapi32.lib KFW_LIBPATH_ARG= /libpath:"$(KFW_LIB_PATH)" !ENDIF and use XXX_LIBPATH_ARG in the LINK32_FLAG The 2nd problem is about Shell32.lib, it is missing in the lib list. It is required for SHGetFolderPath. The last two problems are more tricky. It is about addrinfo and sockaddr. addrinfo is actually defined on windows and seems to have the correct order of the structure elements (see the comment in src/include/getaddrinfo.h). Removing this declaration seems to work (not tested yet). I'm now trying to figure out the sockaddr_storage redclaration. The windows struct is different (http://msdn.microsoft.com/en-us/library/aa917505.aspx) and I'm not sure it is a good idea to force the related HAVE_* definitions. Does anyone have an idea about how to fix these two problems? If not, I can try to fix them and run some tests using PHP, any help welcome as I'm not a pgsql user (only building php releases and snapshots, www.php.net/download and snaps.php.net). The last version of my win32.mak file is available here: http://pecl2.php.net/downloads/php-windows-builds/source/libpq/win32.mak Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org
Re: Libpq visual c++ build errors, addrinfo and sockaddr_storage redefinition error
От
Magnus Hagander
Дата:
Pierre Joye wrote: > hi, > > While trying to update the PHP postgresql extension to 8.3.1, I met a > couple of issues. > > The first was about not using kerberos, the makefile is incorrect as > an error will be raised when kerberos is used and no kerberos is used. First of all, what version of MSVC are you building this with? And what version of the Platform SDK? Second, is there any particular reason you need to build it yourself, instead of using the binaries that we ship already? And third, I'd recommend you try to build it using the "main method" which is using the tools in src/tools/msvc, and not the win32.mak method. It's much more complete. You can build "just libpq" that way as well. > The 2nd problem is about Shell32.lib, it is missing in the lib list. > It is required for SHGetFolderPath. That's strange, because if that was so then nobody should be able to build it. We should be getting the symbol from shfolder.lib. > The last two problems are more tricky. It is about addrinfo and > sockaddr. addrinfo is actually defined on windows and seems to have > the correct order of the structure elements (see the comment in > src/include/getaddrinfo.h). Removing this declaration seems to work > (not tested yet). Again, you seem to be doing *something* wrong here, because it builds perfectly fine for others. :-) Anything "unusual" about your environment, that you would guess? (And do try the "real" backend build way instead of win32.mak. Even if it doesn't fix your issue, it might help with showing us what actually is wrong) //Magnus
Re: Libpq visual c++ build errors, addrinfo and sockaddr_storage redefinition error
От
"Pierre Joye"
Дата:
Hi Magnus, On Tue, May 6, 2008 at 1:36 PM, Magnus Hagander <magnus@hagander.net> wrote: > Pierre Joye wrote: > > hi, > > > > While trying to update the PHP postgresql extension to 8.3.1, I met a > > couple of issues. > > > > The first was about not using kerberos, the makefile is incorrect as > > an error will be raised when kerberos is used and no kerberos is used. > > First of all, what version of MSVC are you building this with? And what > version of the Platform SDK? We use the last SDK working with VC6 (2003/02). That's sadly a requirement for php 5.x. We are working on supporting 2k5 and the latest SDK for 5.3+. However VC6 support has to be kept for the 5.x branches (at least). > Second, is there any particular reason you need to build it yourself, > instead of using the binaries that we ship already? Mainly because of VC6, we had many issues in the pasts with builds not using the exact same crt than PHP. > And third, I'd recommend you try to build it using the "main method" > which is using the tools in src/tools/msvc, and not the win32.mak > method. It's much more complete. You can build "just libpq" that way as > well. I did not know this one, thanks! I will give it tonight. > > The 2nd problem is about Shell32.lib, it is missing in the lib list. > > It is required for SHGetFolderPath. > > That's strange, because if that was so then nobody should be able to > build it. We should be getting the symbol from shfolder.lib. I got an unknown symbol "SHGetFolderPath" using win32.mak. > > The last two problems are more tricky. It is about addrinfo and > > sockaddr. addrinfo is actually defined on windows and seems to have > > the correct order of the structure elements (see the comment in > > src/include/getaddrinfo.h). Removing this declaration seems to work > > (not tested yet). > > Again, you seem to be doing *something* wrong here, because it builds > perfectly fine for others. :-) Anything "unusual" about your > environment, that you would guess? Besides the museum piece of software that is the 2003's SDK, nothing ;) > (And do try the "real" backend build way instead of win32.mak. Even if > it doesn't fix your issue, it might help with showing us what actually > is wrong) Yes, I will definitively try the "normal" way. It will certainly fix all the issues. I'll come back to you after my tests. Thanks for your quick reply and the tips! -- Pierre http://blog.thepimp.net | http://www.libgd.org
Re: Libpq visual c++ build errors, addrinfo and sockaddr_storage redefinition error
От
Magnus Hagander
Дата:
Pierre Joye wrote: > Hi Magnus, > > On Tue, May 6, 2008 at 1:36 PM, Magnus Hagander <magnus@hagander.net> > wrote: > > Pierre Joye wrote: > > > hi, > > > > > > While trying to update the PHP postgresql extension to 8.3.1, I > > > met a couple of issues. > > > > > > The first was about not using kerberos, the makefile is > > > incorrect as an error will be raised when kerberos is used and > > > no kerberos is used. > > > > First of all, what version of MSVC are you building this with? And > > what version of the Platform SDK? > > We use the last SDK working with VC6 (2003/02). That's sadly a > requirement for php 5.x. We are working on supporting 2k5 and the > latest SDK for 5.3+. However VC6 support has to be kept for the 5.x > branches (at least). There's your problem, really. 8.3+ does not support VC6 anymore. We need 7.1 or newer. > > And third, I'd recommend you try to build it using the "main > > method" which is using the tools in src/tools/msvc, and not the > > win32.mak method. It's much more complete. You can build "just > > libpq" that way as well. > > I did not know this one, thanks! I will give it tonight. That one will require Visual Studio 2005... > > > The last two problems are more tricky. It is about addrinfo and > > > sockaddr. addrinfo is actually defined on windows and seems to > > > have the correct order of the structure elements (see the > > > comment in src/include/getaddrinfo.h). Removing this declaration > > > seems to work (not tested yet). > > > > Again, you seem to be doing *something* wrong here, because it > > builds perfectly fine for others. :-) Anything "unusual" about your > > environment, that you would guess? > > Besides the museum piece of software that is the 2003's SDK, > nothing ;) :-D //Magnus
Re: Libpq visual c++ build errors, addrinfo and sockaddr_storage redefinition error
От
"Pierre Joye"
Дата:
On Tue, May 6, 2008 at 2:36 PM, Magnus Hagander <magnus@hagander.net> wrote: > Pierre Joye wrote: > > Hi Magnus, > > > > On Tue, May 6, 2008 at 1:36 PM, Magnus Hagander <magnus@hagander.net> > > wrote: > > > Pierre Joye wrote: > > > > hi, > > > > > > > > While trying to update the PHP postgresql extension to 8.3.1, I > > > > met a couple of issues. > > > > > > > > The first was about not using kerberos, the makefile is > > > > incorrect as an error will be raised when kerberos is used and > > > > no kerberos is used. > > > > > > First of all, what version of MSVC are you building this with? And > > > what version of the Platform SDK? > > > > We use the last SDK working with VC6 (2003/02). That's sadly a > > requirement for php 5.x. We are working on supporting 2k5 and the > > latest SDK for 5.3+. However VC6 support has to be kept for the 5.x > > branches (at least). > > There's your problem, really. 8.3+ does not support VC6 anymore. We > need 7.1 or newer. I was suspecting this problem. Do you have any experiences of using these 2k5 binaries with VC6 (especially in threaded environment)? We may give it a try in the next weeks and update it again in 5.2.7 and 5.3 if it works well. > > > And third, I'd recommend you try to build it using the "main > > > method" which is using the tools in src/tools/msvc, and not the > > > win32.mak method. It's much more complete. You can build "just > > > libpq" that way as well. > > > > I did not know this one, thanks! I will give it tonight. > > That one will require Visual Studio 2005... Ok, that will be usefull for the 2k5 move :) -- Pierre http://blog.thepimp.net | http://www.libgd.org
Re: Libpq visual c++ build errors, addrinfo and sockaddr_storage redefinition error
От
Magnus Hagander
Дата:
Pierre Joye wrote: > > > We use the last SDK working with VC6 (2003/02). That's sadly a > > > requirement for php 5.x. We are working on supporting 2k5 and > > > the latest SDK for 5.3+. However VC6 support has to be kept for > > > the 5.x branches (at least). > > > > There's your problem, really. 8.3+ does not support VC6 anymore. We > > need 7.1 or newer. > > I was suspecting this problem. Do you have any experiences of using > these 2k5 binaries with VC6 (especially in threaded environment)? We > may give it a try in the next weeks and update it again in 5.2.7 and > 5.3 if it works well. It shouldn't be a problem, other than requiring both runtimes to be present. Unless you use PQtrace() in which case it will be a big problem. Basically, as long as you don't free() something in one runtime that was malloced():d in a nother one, and as long as you don't pass "CRT pointers" between the two runtimes, you are fine. And we do pass a CRT pointer around in PQtrace, but that's the only case. We used to have a problem with some Kerberos structure that was malloced in one place and free()d in another, but that has been fixed. //Magnus
Re: Libpq visual c++ build errors, addrinfo and sockaddr_storage redefinition error
От
"Pierre Joye"
Дата:
hi Magnus! On Tue, May 6, 2008 at 8:01 PM, Magnus Hagander <magnus@hagander.net> wrote: > Pierre Joye wrote: >> > > We use the last SDK working with VC6 (2003/02). That's sadly a >> > > requirement for php 5.x. We are working on supporting 2k5 and >> > > the latest SDK for 5.3+. However VC6 support has to be kept for >> > > the 5.x branches (at least). >> > >> > There's your problem, really. 8.3+ does not support VC6 anymore. We >> > need 7.1 or newer. Ok, time for some news :) We have finally decide of a death sentence for VC6 (php 5.3.x is the last release to support it). Then only VC9 binaries will be provided (be 5.4 or 6). >> I was suspecting this problem. Do you have any experiences of using >> these 2k5 binaries with VC6 (especially in threaded environment)? We >> may give it a try in the next weeks and update it again in 5.2.7 and >> 5.3 if it works well. > > It shouldn't be a problem, other than requiring both runtimes to be > present. Unless you use PQtrace() in which case it will be a big > problem. > > Basically, as long as you don't free() something in one runtime that > was malloced():d in a nother one, and as long as you don't pass "CRT > pointers" between the two runtimes, you are fine. And we do pass a CRT > pointer around in PQtrace, but that's the only case. We used to have a > problem with some Kerberos structure that was malloced in one place and > free()d in another, but that has been fixed. I managed to compile the latest libpq with VC6, it requires only some minor changes. I describe the procedure here (not asking to merge the changes but it may help someone reading this list or the archive): http://wiki.php.net/internals/windows/libs/libpg (should be pq =) VC8 and VC9 works out of the box except that the command line options are ignored (I will try to find the cause and report a bug for it). You made a great work :) I'm about to update the PHP Snapbox with the new versions, if you know some pgsql+php Windows users, it would be the right time to test (online on Monday 28th of July). Thanks for your fantastic work and help :) Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org