Thread: Postgres 32 bits client compilation fail. Win32 bits client is supported?

Postgres 32 bits client compilation fail. Win32 bits client is supported?

From
Ranier Vilela
Date:
Hi,
I am migrating my applications that use postgres client from msvc 2010 (32bits) to msvc 2019 (32 bits).
Compilation using msvc 2019 (64 bits), works very well.
But the build using msvc 2019 (32 bit) is not working.
The 32-bit Platform variable is set to x86, resulting in the first error.

"Project" C: \ dll \ postgres \ pgsql.sln "on node 1 (default targets).
C: \ dll \ postgres \ pgsql.sln.metaproj: error MSB4126: The specified solution configuration "Release | x86" is invalid. Plea
if specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sl
n / p: Configuration = Debug / p: Platform = "Any CPU") or leave those properties blank to use the default solution configurati
on. [C: \ dll \ postgres \ pgsql.sln]
Done Building Project "C: \ dll \ postgres \ pgsql.sln" (default targets) - FAILED. "

This is because the Sub DeterminePlatform function of the Solution.pm program uses the following expression:
"my $ output =` cl /? 2> & 1`; "
The result of msvc 2019 (32bits) is:
"Microsoft (R) C / C ++ Optimizing Compiler Version 19.24.28315 for x86"

By setting the Platform variable manually to WIn32, the compilation process continues until it stops at:
"Generating configuration headers ..."

Where the second error occurs:
unused defines: HAVE_STRUCT_CMSGCRED
USE_NAMED_POSI ... etc ...
ALIGNOF_DOUBLE USE_DEV_URANDOM at C: \ dll \ postgres \ src \ tools \ msvc / Mkvcbuild.pm line 842.

Question:
Will Postgres continue to support 32-bit client?

regards,
Ranier Vilela

Re: Postgres 32 bits client compilation fail. Win32 bits client is supported?

From
Amit Kapila
Date:
On Sat, Feb 8, 2020 at 8:05 AM Ranier Vilela <ranier.vf@gmail.com> wrote:
>
> Hi,
> I am migrating my applications that use postgres client from msvc 2010 (32bits) to msvc 2019 (32 bits).
> Compilation using msvc 2019 (64 bits), works very well.
> But the build using msvc 2019 (32 bit) is not working.
> The 32-bit Platform variable is set to x86, resulting in the first error.
>
> "Project" C: \ dll \ postgres \ pgsql.sln "on node 1 (default targets).
> C: \ dll \ postgres \ pgsql.sln.metaproj: error MSB4126: The specified solution configuration "Release | x86" is
invalid.Plea
 
> if specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe
Solution.sl
> n / p: Configuration = Debug / p: Platform = "Any CPU") or leave those properties blank to use the default solution
configurati
> on. [C: \ dll \ postgres \ pgsql.sln]
> Done Building Project "C: \ dll \ postgres \ pgsql.sln" (default targets) - FAILED. "
>
> This is because the Sub DeterminePlatform function of the Solution.pm program uses the following expression:
> "my $ output =` cl /? 2> & 1`; "
> The result of msvc 2019 (32bits) is:
> "Microsoft (R) C / C ++ Optimizing Compiler Version 19.24.28315 for x86"
>
> By setting the Platform variable manually to WIn32, the compilation process continues until it stops at:
> "Generating configuration headers ..."
>
> Where the second error occurs:
> unused defines: HAVE_STRUCT_CMSGCRED
> USE_NAMED_POSI ... etc ...
> ALIGNOF_DOUBLE USE_DEV_URANDOM at C: \ dll \ postgres \ src \ tools \ msvc / Mkvcbuild.pm line 842.
>

Try by removing src/include/pg_config.

> Question:
> Will Postgres continue to support 32-bit client?
>

I am not aware of any discussion related to stopping the support of
32-bit client.

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com



Re: Postgres 32 bits client compilation fail. Win32 bits client is supported?

From
Craig Ringer
Date:
On Sun, 9 Feb 2020 at 15:35, Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> On Sat, Feb 8, 2020 at 8:05 AM Ranier Vilela <ranier.vf@gmail.com> wrote:
> >
> > Hi,
> > I am migrating my applications that use postgres client from msvc 2010 (32bits) to msvc 2019 (32 bits).
> > Compilation using msvc 2019 (64 bits), works very well.
> > But the build using msvc 2019 (32 bit) is not working.
> > The 32-bit Platform variable is set to x86, resulting in the first error.
> >
> > "Project" C: \ dll \ postgres \ pgsql.sln "on node 1 (default targets).
> > C: \ dll \ postgres \ pgsql.sln.metaproj: error MSB4126: The specified solution configuration "Release | x86" is
invalid.Plea
 
> > if specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe
Solution.sl
> > n / p: Configuration = Debug / p: Platform = "Any CPU") or leave those properties blank to use the default solution
configurati
> > on. [C: \ dll \ postgres \ pgsql.sln]
> > Done Building Project "C: \ dll \ postgres \ pgsql.sln" (default targets) - FAILED. "
> >
> > This is because the Sub DeterminePlatform function of the Solution.pm program uses the following expression:
> > "my $ output =` cl /? 2> & 1`; "
> > The result of msvc 2019 (32bits) is:
> > "Microsoft (R) C / C ++ Optimizing Compiler Version 19.24.28315 for x86"
> >
> > By setting the Platform variable manually to WIn32, the compilation process continues until it stops at:
> > "Generating configuration headers ..."
> >
> > Where the second error occurs:
> > unused defines: HAVE_STRUCT_CMSGCRED
> > USE_NAMED_POSI ... etc ...
> > ALIGNOF_DOUBLE USE_DEV_URANDOM at C: \ dll \ postgres \ src \ tools \ msvc / Mkvcbuild.pm line 842.
> >
>
> Try by removing src/include/pg_config.
>
> > Question:
> > Will Postgres continue to support 32-bit client?
> >
>
> I am not aware of any discussion related to stopping the support of
> 32-bit client.

Buildfarm member whelk reports for 32-bit Windows.

https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=whelk&br=HEAD

https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=whelk&br=REL_12_STABLE

It says it uses Microsoft Visual C++ 2010 .

I don't see any other members building for 32-bit. But it should work
and as you say, nothing's been discussed about removing it.

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 2ndQuadrant - PostgreSQL Solutions for the Enterprise



Re: Postgres 32 bits client compilation fail. Win32 bits client issupported?

From
Michael Paquier
Date:
On Mon, Feb 10, 2020 at 11:55:09AM +0800, Craig Ringer wrote:
> I don't see any other members building for 32-bit. But it should work
> and as you say, nothing's been discussed about removing it.

Yes, it works normally AFAIK and there is no reason to remove this
support either.  My guess is that the repository was not cleaned up
properly when attempting the 32b compilation after a 64b compilation
was completed.
--
Michael

Attachment

Re: Postgres 32 bits client compilation fail. Win32 bits client is supported?

From
Ranier Vilela
Date:
Hi guys, thank you for the answers.

Em seg., 10 de fev. de 2020 às 03:38, Michael Paquier <michael@paquier.xyz> escreveu:
On Mon, Feb 10, 2020 at 11:55:09AM +0800, Craig Ringer wrote:
> I don't see any other members building for 32-bit. But it should work
> and as you say, nothing's been discussed about removing it.

Yes, it works normally AFAIK and there is no reason to remove this
support either.  My guess is that the repository was not cleaned up
properly when attempting the 32b compilation after a 64b compilation
was completed.
I tried from fresh source install.

Craig, the buildfarm uses msvc 2013.

Amit, your suggestion worked, thank you.
I removed pg_config.h and compiled it libpq.dll, but the tool reported
    8 Warning(s)
    55 Error(s)

The first error is:
"adminpack.obj : error LNK2019: sφmbolo externo indefinido _Int64GetDatum referenciado na funτπo _pg_file_write [C:\dll\postgres\adminpack.vcxproj]
.\Release\adminpack\adminpack.dll : fatal error LNK1120: 1 externo nπo resolvidos [C:\dll\postgres\adminpack.vcxproj]
Done Building Project "C:\dll\postgres\adminpack.vcxproj" (default targets) -- FAILED."

Unfortunately, i will have to live with 32 bits clients for a long time yet.
I still have customers using Windows XP yet ...

best regards,
Ranier Vilela

Re: Postgres 32 bits client compilation fail. Win32 bits client is supported?

From
Craig Ringer
Date:
On Mon, 10 Feb 2020 at 20:14, Ranier Vilela <ranier.vf@gmail.com> wrote:
>
> "adminpack.obj : error LNK2019: sφmbolo externo indefinido _Int64GetDatum referenciado na funτπo _pg_file_write
[C:\dll\postgres\adminpack.vcxproj]
> .\Release\adminpack\adminpack.dll : fatal error LNK1120: 1 externo nπo resolvidos [C:\dll\postgres\adminpack.vcxproj]
> Done Building Project "C:\dll\postgres\adminpack.vcxproj" (default targets) -- FAILED."

You are almost certainly trying to build with a mismatched
configuration vs toolchain. See "postgres.h" for the definition of
Int64GetDatum. It's a macro if you're on a 64-bit arch where we can
pass 64-bit fields by-value efficiently; otherwise it's a function.
You're probably trying to link 32-bit extensions against a 64-bit
postgres.

Clean everything. Completely. Set up a totally clean MSVC environment
and ensure you have ONLY the 32-bit toolchain on the PATH, only 32-bit
libraries, etc. Then retry.

Rather than building via MSVC's user interface, use msbuild.exe with
the project files PostgreSQL generates for you.

See if that helps.

I've seen many mangled setups when there are mixes of different MSVC
toolchains versions on a machine. I now maintain isolated VMs with
exactly one MSVC version on each to address the amazing level of
breakage and incompatibility that MS's various toolchains seem to
deliver.

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 2ndQuadrant - PostgreSQL Solutions for the Enterprise



Re: Postgres 32 bits client compilation fail. Win32 bits client is supported?

From
Ranier Vilela
Date:

Em seg., 10 de fev. de 2020 às 10:53, Craig Ringer <craig@2ndquadrant.com> escreveu:
On Mon, 10 Feb 2020 at 20:14, Ranier Vilela <ranier.vf@gmail.com> wrote:
>
> "adminpack.obj : error LNK2019: sφmbolo externo indefinido _Int64GetDatum referenciado na funτπo _pg_file_write [C:\dll\postgres\adminpack.vcxproj]
> .\Release\adminpack\adminpack.dll : fatal error LNK1120: 1 externo nπo resolvidos [C:\dll\postgres\adminpack.vcxproj]
> Done Building Project "C:\dll\postgres\adminpack.vcxproj" (default targets) -- FAILED."

You are almost certainly trying to build with a mismatched
configuration vs toolchain. See "postgres.h" for the definition of
Int64GetDatum. It's a macro if you're on a 64-bit arch where we can
pass 64-bit fields by-value efficiently; otherwise it's a function.
You're probably trying to link 32-bit extensions against a 64-bit
postgres.

Clean everything. Completely. Set up a totally clean MSVC environment
and ensure you have ONLY the 32-bit toolchain on the PATH, only 32-bit
libraries, etc. Then retry.

Rather than building via MSVC's user interface, use msbuild.exe with
the project files PostgreSQL generates for you.

See if that helps.

I've seen many mangled setups when there are mixes of different MSVC
toolchains versions on a machine. I now maintain isolated VMs with
exactly one MSVC version on each to address the amazing level of
breakage and incompatibility that MS's various toolchains seem to
deliver.

You know those times when you feel like you haven't done your job. This is one of them.
Thanks Craig and Michael, my mistake, the 32 bits project build was done complete.
There was really a mixing problem between 32 and 64 bits compilations.
After downloading the current full version of the sources again and starting the 32 bits compilation, everything went well.
It's great to know that Postgres compiles and runs all regression tests in 32 bits (all 196).

best regards,
Ranier Vilela

Re: Postgres 32 bits client compilation fail. Win32 bits client issupported?

From
Andrew Dunstan
Date:
On 2/10/20 7:13 AM, Ranier Vilela wrote:
>
>
> Unfortunately, i will have to live with 32 bits clients for a long
> time yet.
> I still have customers using Windows XP yet ...
>
>


AFAIK we don't support WinXP past Postgres Release 10 because of the
lack of huge page support. That won't affect clients, but it does mean
we won't build or test later releases on XP.


cheers


andrew


-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




Re: Postgres 32 bits client compilation fail. Win32 bits client is supported?

From
Ranier Vilela
Date:
Em ter., 11 de fev. de 2020 às 18:08, Andrew Dunstan <andrew.dunstan@2ndquadrant.com> escreveu:

On 2/10/20 7:13 AM, Ranier Vilela wrote:
>
>
> Unfortunately, i will have to live with 32 bits clients for a long
> time yet.
> I still have customers using Windows XP yet ...
>
>


AFAIK we don't support WinXP past Postgres Release 10 because of the
lack of huge page support. That won't affect clients, but it does mean
we won't build or test later releases on XP.

Oh yes of course, I understand.
I support 32 bits clients that still use WIndows XP, with version 9.6, for both client and server.
Unfortunately, the notorious Windows 7 32 bits is still in use.
For these I am migrating to version 12, both for client and server.

regards,
Ranier Vilela