From: Jurko Gospodnetić <jurko.gospodnetic@pke.hr>
To: Michael Paquier <michael@paquier.xyz>
To: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
Cc: robionekenobi@bluewin.ch, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #16825: When building on Windows, cl /? retrun 'x64' not AMD64 and the build does not create x64 environment
Date: Fri, 22 Jan 2021 13:11:30 +0100
Message-ID: <30af0ea6-63c2-471e-601a-802174f9d7c6@pke.hr> (raw)
In-Reply-To: <YAji+9U1GY91sI5k@paquier.xyz>
References: <16825-c4f104bcebc67034@postgresql.org>
<CAC+AXB1hEoM+=c6OnNfeDNZzvKtQBuo4qo7W9AkUBNVYEjAqYg@mail.gmail.com>
<000001d6ecfd$a5fde810$f1f9b830$@bluewin.ch>
<CAC+AXB2u77E6jvhZmA0J5-6f=Lb9PyhrahNCt-POQ94aD4odLA@mail.gmail.com>
<YAZs4aHEg+VVL0pP@paquier.xyz>
<CAC+AXB0gdROT7Gd270wbFkC2uOUOPKFTWv=oZn=3WH_4k37xPw@mail.gmail.com>
<YAfav21sjbWJORCy@paquier.xyz>
<YAji+9U1GY91sI5k@paquier.xyz>
Hi.
On 21.1.2021. 3:12, Michael Paquier wrote:
> On Wed, Jan 20, 2021 at 04:24:47PM +0900, Michael Paquier wrote:
>> If there are no objections, I am planning to apply this patch to
>> HEAD.
>
> Done as of 733d670. There may be a point in back-patching and
> classifying that as a bug, but I have played it conservative as that's
> an improvement and nobody really complained about that AFAIK.
> --
> Michael
>
Thanks for patching this.
And actually I did report it a while ago, just hadn't found the time
to follow up and rebase the patch to develop:
------
Hi.
I'm not sure what the process is here so just attempting a polite ping.
I've posted a message (reattached to the bottom of this e-mail) about
this problem, including a fix for it, almost a month about and there has
thus far been no response nor can I see the change applied to
https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/tools/msvc/Solution.pm;hb=HEAD
Please let me know if I should be posting about this somewhere else.
Kind regards,
Jurko Gospodnetić
On 7.10.2020. 18:08, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 16660
> Logged by: Jurko Gospodnetić
> Email address: jurko.gospodnetic@pke.hr
> PostgreSQL version: 9.6.19
> Operating system: Windows
> Description:
>
> If you run the 64-bit postgres build from a virtual subst drive (see
> Windows `help subst` command), it will fail.
>
> Internally it will fail to detect that the used Visual C++ compiler
> executable `cl.exe` has been configured for producing 64-bit targets
> and will thus configure the generated Visual Studio projects &
> solution for building 32-bit targets even through the used compiler
> will actually be producing 64-bit ones.
>
> Even deeper, the original problem stems from `cl.exe` behaviour, which
> seems to produce no compiler option output when invoked as `cl /?`
> from a subst drive. On one occasion it was reported that it did show
> compiler options on some subst drives but not others, but this could
> not be reproduced later on so such behaviour can be at most considered
> random.
>
> Invoking the executable as `cl /help` works correctly on all tested
> drives. Go figure.
>
> Here's a patch fixing the problem based on the code in the 9.6.19
> distribution:
From a3ccfe68dbe5190f743cd13a4fc90faaf6478370 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= <jurko.gospodnetic@pke.hr>
Date: Wed, 7 Oct 2020 16:17:29 +0200
Subject: [PATCH] patch compiler architecture detection on virtual subst
drives
---
src/tools/msvc/Solution.pm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
inline patch 1: src/tools/msvc/Solution.pm (+3/-2 lines) download inline-1.patchdiff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pmindex 7ec7120..29ebab5 100644--- a/src/tools/msvc/Solution.pm+++ b/src/tools/msvc/Solution.pm@@ -75,8 +75,13 @@ sub DeterminePlatform
{
my $self = shift;
- # Examine CL help output to determine if we are in 32 or 64-bit mode.- my $output = `cl /? 2>&1`;+ # examine CL help output to determine if we are in 32 or 64-bit mode+ #+ # we intentionally use `cl /help` as opposed to `cl /?` as the former works
+ # when the current drive is a virtual `subst` drive (see `help
subst`) while
+ # the latter does not (noticed at least with compiler executable
version
+ # `Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27043 for
x64`)
+ my $output = `cl /help 2>&1`;
$? >> 8 == 0 or die "cl command not found";
$self->{platform} = ($output =~ /^\/favor:<.+AMD64/m) ? 'x64' :
'Win32';
print "Detected hardware platform: $self->{platform}\n";
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: jurko.gospodnetic@pke.hr, michael@paquier.xyz, juanjo.santamaria@gmail.com
Subject: Re: BUG #16825: When building on Windows, cl /? retrun 'x64' not AMD64 and the build does not create x64 environment
In-Reply-To: <30af0ea6-63c2-471e-601a-802174f9d7c6@pke.hr>
References: <16825-c4f104bcebc67034@postgresql.org> <CAC+AXB1hEoM+=c6OnNfeDNZzvKtQBuo4qo7W9AkUBNVYEjAqYg@mail.gmail.com> <000001d6ecfd$a5fde810$f1f9b830$@bluewin.ch> <CAC+AXB2u77E6jvhZmA0J5-6f=Lb9PyhrahNCt-POQ94aD4odLA@mail.gmail.com> <YAZs4aHEg+VVL0pP@paquier.xyz> <CAC+AXB0gdROT7Gd270wbFkC2uOUOPKFTWv=oZn=3WH_4k37xPw@mail.gmail.com> <YAfav21sjbWJORCy@paquier.xyz> <YAji+9U1GY91sI5k@paquier.xyz> <30af0ea6-63c2-471e-601a-802174f9d7c6@pke.hr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox