Обсуждение: Home dir changes have broken MSVC builds
Recent changes to interfaces/libpg/fe-connect.c have broken MSVC builds, which I am reliably informed are definitely still required - at least some uses of libpq.dll made with gcc apparently cause the resulting builds or applications to blow up. The trouble seems to come from these 2 lines: + #define _WIN32_IE 0x0400 + #include <shlobj.h> First, on MSVC, _WIN32_IE is already defined at that point. If you get around that then processing the include file causes errors. I am making some more tests and will post more details shortly - problem first noticed by TJ Doesn'tWantToMentionHisSurname. MinGW builds appear to be fine, though. cheers andrew
Andrew Dunstan wrote: > > Recent changes to interfaces/libpg/fe-connect.c have broken MSVC > builds, which I am reliably informed are definitely still required - > at least some uses of libpq.dll made with gcc apparently cause the > resulting builds or applications to blow up. > > The trouble seems to come from these 2 lines: > > + #define _WIN32_IE 0x0400 > + #include <shlobj.h> > > First, on MSVC, _WIN32_IE is already defined at that point. If you get > around that then processing the include file causes errors. > > I am making some more tests and will post more details shortly - > problem first noticed by TJ Doesn'tWantToMentionHisSurname. > > MinGW builds appear to be fine, though. > > Here is the make output: Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. cd include if not exist pg_config.h copy pg_config.h.win32 pg_config.h cd .. cd interfaces\libpq nmake /f win32.mak Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. Building the Win32 static library... cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm11E0.tmp getaddrinfo.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm11E1.tmp pgstrcasecmp.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm11E2.tmp thread.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm11E3.tmp inet_aton.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm11E4.tmp crypt.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm11E5.tmp noblock.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm11E6.tmp md5.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm11E7.tmp ip.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm11E8.tmp wchar.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm11E9.tmp encnames.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm11EA.tmp win32.c fe-auth.c fe-protocol2.c fe-protocol3.c fe-connect.c fe-connect.c(38) : warning C4005: '_WIN32_IE' : macro redefinition C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\PrSht.h(18) : see previous definition of '_WIN32_IE' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\CommCtrl.h(1175) : error C2143: syntax error : missing ';' before '*' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\CommCtrl.h(2268) : error C2371: 'near' : redefinition; different basic types C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\CommCtrl.h(1175) : see declaration of 'near' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\CommCtrl.h(2268) : error C2143: syntax error : missing ';' before '*' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\CommCtrl.h(2284) : error C2371: 'near' : redefinition; different basic types C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\CommCtrl.h(1175) : see declaration of 'near' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\CommCtrl.h(2284) : error C2143: syntax error : missing ';' before '*' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3687) : error C2061: syntax error : identifier 'LPTBBUTTONSB' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3687) : error C2059: syntax error : ';' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3849) : error C2146: syntax error : missing ')' before identifier 'lpButtons' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3849) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3849) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3849) : error C2143: syntax error : missing ')' before 'identifier' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3849) : error C2081: 'LPTBBUTTONSB' : name in formal parameter list illegal C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3849) : error C2146: syntax error : missing ';' before identifier 'lpButtons' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3849) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3849) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3849) : error C2143: syntax error : missing ';' before 'identifier' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3849) : error C2061: syntax error : identifier 'lpButtons' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3851) : error C2059: syntax error : ')' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(3854) : error C2059: syntax error : '}' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(4086) : error C2146: syntax error : missing ')' before identifier 'lpButtons' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(4086) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(4086) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(4086) : error C2143: syntax error : missing ')' before 'identifier' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(4086) : error C2081: 'LPTBBUTTONSB' : name in formal parameter list illegal C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(4086) : error C2061: syntax error : identifier 'lpButtons' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(4086) : error C2059: syntax error : ';' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(4086) : error C2059: syntax error : ',' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(4088) : error C2059: syntax error : ')' fe-exec.c fe-lobj.c fe-misc.c fe-print.c fe-secure.c pqexpbuffer.c pqsignal.c pthread-win32.c NMAKE : fatal error U1077: 'cl.exe' : return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\BIN\nmake.exe"' : return code '0x2' Stop.
>Recent changes to interfaces/libpg/fe-connect.c have broken >MSVC builds, >which I am reliably informed are definitely still required - at least >some uses of libpq.dll made with gcc apparently cause the resulting >builds or applications to blow up. Can you get some more specifics on that? We know it was a fact with early betas because of the conflicting exports, but I was under the impression that these issues were all fixed by now. (not saying the MSVC build shouldn't work, just that the gcc should work too...) >The trouble seems to come from these 2 lines: > >+ #define _WIN32_IE 0x0400 >+ #include <shlobj.h> > >First, on MSVC, _WIN32_IE is already defined at that point. If you get >around that then processing the include file causes errors. Interesting - mingw was supposed to use compatible headers, I thought :-) Can you tru moving the #define up to the top of the file and see if that fixes things? So it's pulled before *any* windows include file. (My msvc has completely stopped building fromt he commandline. Need to fix that, but it's not up right now) //Magnus
Magnus Hagander wrote: >>Recent changes to interfaces/libpg/fe-connect.c have broken >>MSVC builds, >>which I am reliably informed are definitely still required - at least >>some uses of libpq.dll made with gcc apparently cause the resulting >>builds or applications to blow up. >> >> > >Can you get some more specifics on that? We know it was a fact with >early betas because of the conflicting exports, but I was under the >impression that these issues were all fixed by now. >(not saying the MSVC build shouldn't work, just that the gcc should work >too...) > > TJ (see addresses) can speak to this. > > > >>The trouble seems to come from these 2 lines: >> >>+ #define _WIN32_IE 0x0400 >>+ #include <shlobj.h> >> >>First, on MSVC, _WIN32_IE is already defined at that point. If you get >>around that then processing the include file causes errors. >> >> > >Interesting - mingw was supposed to use compatible headers, I thought >:-) >Can you tru moving the #define up to the top of the file and see if that >fixes things? So it's pulled before *any* windows include file. (My msvc >has completely stopped building fromt he commandline. Need to fix that, >but it's not up right now) > > > > I surrounded the #define with #ifndef ... #endif. If you agree that would be the first fix. But most errors remained (see my follow up email yesterday) The error appears to be on line that uses NEAR and complains about it ... I see that the MinGW windef.h defines NEAR as empty, while the MSVC windef.h defines it as "near". Don't know if that makes a difference. cheers andrew
>>>The trouble seems to come from these 2 lines: >>> >>>+ #define _WIN32_IE 0x0400 >>>+ #include <shlobj.h> >>> >>>First, on MSVC, _WIN32_IE is already defined at that point. >If you get >>>around that then processing the include file causes errors. >>> >>> >> >>Interesting - mingw was supposed to use compatible headers, I thought >>:-) >>Can you tru moving the #define up to the top of the file and >see if that >>fixes things? So it's pulled before *any* windows include >file. (My msvc >>has completely stopped building fromt he commandline. Need to >fix that, >>but it's not up right now) >> >> >I surrounded the #define with #ifndef ... #endif. If you agree that >would be the first fix. > >But most errors remained (see my follow up email yesterday) > >The error appears to be on line that uses NEAR and complains about it >... I see that the MinGW windef.h defines NEAR as empty, while >the MSVC >windef.h defines it as "near". Don't know if that makes a difference. Some reading up on MSDN gives this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore9 8/html/_core_removing_near_and_far_type_declarations.asp From what I can tell, NEAR is defined to near, which is then defined to blank in my windef.h (from the platform SDK included in VS2003) Could it be that we need to include windef.h explicitly, before we include this one? Worth a try. //Magnus
Magnus Hagander wrote: >>The error appears to be on line that uses NEAR and complains about it >>... I see that the MinGW windef.h defines NEAR as empty, while >>the MSVC >>windef.h defines it as "near". Don't know if that makes a difference. >> >> > >Some reading up on MSDN gives this: >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore9 >8/html/_core_removing_near_and_far_type_declarations.asp > >>From what I can tell, NEAR is defined to near, which is then defined to >blank in my windef.h (from the platform SDK included in VS2003) > >Could it be that we need to include windef.h explicitly, before we >include this one? Worth a try. > > > I tried but it didn't work. However, I made some progress with changing the section to look like this: #ifdef WIN32 #include "win32.h" #ifndef _WIN32_IE #define _WIN32_IE 0x0400 #endif #ifdef near #undef near #endif #define near #include <shlobj.h> #else Now the make produces this: Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. cd include if not exist pg_config.h copy pg_config.h.win32 pg_config.h cd .. cd interfaces\libpq nmake /f win32.mak Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. Building the Win32 static library... cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm1248.tmp getaddrinfo.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm1249.tmp pgstrcasecmp.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm124A.tmp thread.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm124B.tmp inet_aton.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm124C.tmp crypt.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm124D.tmp noblock.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm124E.tmp md5.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm124F.tmp ip.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm1250.tmp wchar.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm1251.tmp encnames.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm1252.tmp win32.c fe-auth.c fe-protocol2.c fe-protocol3.c fe-connect.c fe-exec.c fe-lobj.c fe-misc.c fe-print.c fe-secure.c pqexpbuffer.c pqsignal.c pthread-win32.c link.exe -lib @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm1253.tmp cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm1254.tmp libpqdll.c rc.exe /l 0x409 /fo".\Release\libpq.res" libpq.rc link.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm1255.tmp libpqdll.def(3) : warning LNK4017: DESCRIPTION statement not supported for the target platform; ignored Creating library .\Release\libpqdll.lib and object .\Release\libpqdll.exp libpq.lib(fe-connect.obj) : error LNK2019: unresolved external symbol __imp__SHGetSpecialFolderPathA@16 referenced in function _pqGetHomeDirectory .\Release\libpq.dll : fatal error LNK1120: 1 unresolved externals NMAKE : fatal error U1077: 'link.exe' : return code '0x460' Stop. NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\BIN\nmake.exe"' : return code '0x2' Stop. cheers andrew
Andrew Dunstan <andrew@dunslane.net> writes: > Creating library .\Release\libpqdll.lib and object .\Release\libpqdll.exp > libpq.lib(fe-connect.obj) : error LNK2019: unresolved external symbol > __imp__SHGetSpecialFolderPathA@16 referenced in function _pqGetHomeDirectory > .\Release\libpq.dll : fatal error LNK1120: 1 unresolved externals One part of the home-dir change involved adding shell32.dll (I think) to the link commands for libpq and/or psql. Probably this needs to propagate into the msvc and borland makefiles? regards, tom lane
>Andrew Dunstan <andrew@dunslane.net> writes: >> Creating library .\Release\libpqdll.lib and object >.\Release\libpqdll.exp >> libpq.lib(fe-connect.obj) : error LNK2019: unresolved >external symbol >> __imp__SHGetSpecialFolderPathA@16 referenced in function >_pqGetHomeDirectory >> .\Release\libpq.dll : fatal error LNK1120: 1 unresolved externals > >One part of the home-dir change involved adding shell32.dll (I >think) to >the link commands for libpq and/or psql. Probably this needs to >propagate into the msvc and borland makefiles? Most definitly. //Magnus
>>>The error appears to be on line that uses NEAR and complains >about it >>>... I see that the MinGW windef.h defines NEAR as empty, while >>>the MSVC >>>windef.h defines it as "near". Don't know if that makes a difference. >>> >>> >> >>Some reading up on MSDN gives this: >>http://msdn.microsoft.com/library/default.asp?url=/library/en- >us/vccore9 >>8/html/_core_removing_near_and_far_type_declarations.asp >> >>>From what I can tell, NEAR is defined to near, which is then >defined to >>blank in my windef.h (from the platform SDK included in VS2003) >> >>Could it be that we need to include windef.h explicitly, before we >>include this one? Worth a try. >> >> >> > >I tried but it didn't work. However, I made some progress with >changing >the section to look like this: > >#ifdef WIN32 >#include "win32.h" >#ifndef _WIN32_IE >#define _WIN32_IE 0x0400 I beleive his will break if _WIN32_IE is previously defined as something <0x0400. Not sure if we build with a patform SDK with that old defaults at all, but just to be sure it's probably better to #undef it and then #define it. >#endif >#ifdef near >#undef near >#endif >#define near >#include <shlobj.h> >#else > //Magnus
Magnus Hagander wrote: >> >>#ifdef WIN32 >>#include "win32.h" >>#ifndef _WIN32_IE >>#define _WIN32_IE 0x0400 >> >> > >I beleive his will break if _WIN32_IE is previously defined as something ><0x0400. Not sure if we build with a patform SDK with that old defaults >at all, but just to be sure it's probably better to #undef it and then >#define it. > > > >>#endif >>#ifdef near >>#undef near >>#endif >>#define near >>#include <shlobj.h> >>#else >> >> >> > > > Ok, I did that, made identical changes to src/port/path.c, and added shell32.lib (not shell32.dll) to src/win32.mak - and with that it does indeed complete. The make traces are shown below. Do any of these warnings matter, or is this good enough to wrap up and send in a patch? What's that one about the DESCRIPTION statement? cheers andrew ----------------------- Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. cd include if not exist pg_config.h copy pg_config.h.win32 pg_config.h cd .. cd interfaces\libpq nmake /f win32.mak Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. Building the Win32 static library... cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12CF.tmp getaddrinfo.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12D0.tmp pgstrcasecmp.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12D1.tmp thread.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12D2.tmp inet_aton.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12D3.tmp crypt.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12D4.tmp noblock.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12D5.tmp md5.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12D6.tmp ip.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12D7.tmp wchar.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12D8.tmp encnames.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12D9.tmp win32.c fe-auth.c fe-protocol2.c fe-protocol3.c fe-connect.c fe-exec.c fe-lobj.c fe-misc.c fe-print.c fe-secure.c pqexpbuffer.c pqsignal.c pthread-win32.c link.exe -lib @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12DA.tmp cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12DB.tmp libpqdll.c rc.exe /l 0x409 /fo".\Release\libpq.res" libpq.rc link.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12DC.tmp libpqdll.def(3) : warning LNK4017: DESCRIPTION statement not supported for the target platform; ignored Creating library .\Release\libpqdll.lib and object .\Release\libpqdll.exp cd ..\..\bin\psql nmake /f win32.mak Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12E2.tmp exec.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12E3.tmp getopt.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12E4.tmp getopt_long.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12E5.tmp path.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12E6.tmp pgstrcasecmp.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12E7.tmp sprompt.c cl.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12E8.tmp command.c C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\direct.h(124) : warning C4003: not enough actual parameters for macro 'mkdir' common.c common.c(616) : warning C4018: '<' : signed/unsigned mismatch copy.c describe.c help.c input.c large_obj.c mainloop.c mbprint.c print.c print.c(1238) : warning C4090: 'function' : different 'const' qualifiers print.c(1239) : warning C4090: 'function' : different 'const' qualifiers prompt.c psqlscan.c startup.c stringutils.c tab-complete.c variables.c link.exe @C:\DOCUME~1\adunstan\LOCALS~1\Temp\nm12E9.tmp cd ..\.. echo All Win32 parts havebeen built! All Win32 parts have been built!