On Mon, Apr 27, 2015 at 9:20 AM, Michael Paquier <michael.paqu...@gmail.com> wrote: > On Mon, Apr 27, 2015 at 8:53 AM, Andrew Dunstan <and...@dunslane.net> wrote: >> >> On 04/26/2015 04:08 PM, Noah Misch wrote: >>> >>> On Sun, Apr 26, 2015 at 10:23:58AM -0400, Andrew Dunstan wrote: >>>> >>>> Setting up a VS2008 environment is hard these days, as MS seems to have >>>> removed the download :-( >>> >>> Visual C++ 2008 Express Edition: >>> http://go.microsoft.com/?linkid=7729279 >>> >> >> Oh, cool. Thanks. > > Thanks, I'll try to set up an environment and come up with a real > patch tested this time. > > What I suspect is that we need to correctly replace all the references > to backslaches like '\\' or $obj =~ s/\\/_/g; to make things work > correctly.
So, I have set up an environment with VC tools, and have been able to reproduce the failure. The problems were less trivial than I though first: 1) - The file tree list was not correctly generated, build script generating vcproj file missing tree dependencies when listing items in Filter. For example, for a path like src/backend/access, it missed to list "src", "backend" and "access", listing only the files in such paths. 2) I noticed that VC builds do not like *at all* file paths with forward slashes, perhaps it could be possible to use a Condition like hasForwardSlashes but it seems safer to simply enforce the file paths to use backslashes in the vcproj files. That's inconsistent with the vcxproj files, but it works and Mkvcbuild.pm works as before. 3) I found why chkpass was needed as a dependency with libpgport and libpgcommon, actually crypt.c needs to be listed as a unique file, so it needs a fake entry in vcproj and vcxproj files. All those things are corrected in the patch attached, tested with both MS and VC. The build is still failing because of cac76582 that introduced the transforms, but at least it will partially cure currawong and put it at the same level as the other machines. Regards, -- Michael
From ae02fa193dd281d95e6f802c49b4c3a650aafe61 Mon Sep 17 00:00:00 2001 From: Michael Paquier <mich...@otacoo.com> Date: Sun, 26 Apr 2015 22:49:09 -0700 Subject: [PATCH] Fix vcbuild failures and chkpass dependency caused by 854adb8 Switching the Windows build scripts to use forward slashes instead of backslashes has caused a couple of issues in VC builds: - The file tree list was not correctly generated, build script generating vcproj file missing tree dependencies when listing items in Filter. - VC builds do not accept file paths with forward slashes, perhaps it could be possible to use a Condition but it seems safer to simply enforce the file paths to use backslashes in the vcproj files. - chkpass had an unneeded dependency with libpgport and libpgcommon to make build succeed but actually it is not necessary as crypt.c is already listed for this project and should be replaced with a fake name as it is a unique file. --- src/tools/msvc/MSBuildProject.pm | 2 +- src/tools/msvc/Mkvcbuild.pm | 2 -- src/tools/msvc/VCBuildProject.pm | 33 +++++++++++++++++++-------------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm index a16f9ac..0c837f7 100644 --- a/src/tools/msvc/MSBuildProject.pm +++ b/src/tools/msvc/MSBuildProject.pm @@ -143,7 +143,7 @@ EOF # File already exists, so fake a new name my $obj = $dir; - $obj =~ s/\\/_/g; + $obj =~ s/\//_/g; print $f <<EOF; <ClCompile Include="$fileNameWithPath"> diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 344b75f..cfb9b24 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -33,12 +33,10 @@ my $contrib_defines = { 'refint' => 'REFINT_VERBOSE' }; my @contrib_uselibpq = ('dblink', 'oid2name', 'postgres_fdw', 'vacuumlo'); my @contrib_uselibpgport = ( - 'chkpass', 'oid2name', 'pg_standby', 'vacuumlo'); my @contrib_uselibpgcommon = ( - 'chkpass', 'oid2name', 'pg_standby', 'vacuumlo'); diff --git a/src/tools/msvc/VCBuildProject.pm b/src/tools/msvc/VCBuildProject.pm index dda662f..add7982 100644 --- a/src/tools/msvc/VCBuildProject.pm +++ b/src/tools/msvc/VCBuildProject.pm @@ -75,43 +75,48 @@ EOF my $dir = $1; my $file = $2; - # Walk backwards down the directory stack and close any dirs we're done with + # Walk backwards down the directory stack and close any dirs + # we're done with. while ($#dirstack >= 0) { - if (join('\\', @dirstack) eq - substr($dir, 0, length(join('\\', @dirstack)))) + if (join('/', @dirstack) eq + substr($dir, 0, length(join('/', @dirstack)))) { - last if (length($dir) == length(join('\\', @dirstack))); + last if (length($dir) == length(join('/', @dirstack))); last - if (substr($dir, length(join('\\', @dirstack)), 1) eq '\\'); + if (substr($dir, length(join('/', @dirstack)), 1) eq '/'); } print $f ' ' x $#dirstack . " </Filter>\n"; pop @dirstack; } # Now walk forwards and create whatever directories are needed - while (join('\\', @dirstack) ne $dir) + while (join('/', @dirstack) ne $dir) { - my $left = substr($dir, length(join('\\', @dirstack))); - $left =~ s/^\\//; - my @pieces = split /\\/, $left; + my $left = substr($dir, length(join('/', @dirstack))); + $left =~ s/^\///; + my @pieces = split /\//, $left; push @dirstack, $pieces[0]; print $f ' ' x $#dirstack . " <Filter Name=\"$pieces[0]\" Filter=\"\">\n"; } + # VC builds do not like file paths with forward slashes. + my $fileNameWithPathFormatted = $fileNameWithPath; + $fileNameWithPathFormatted =~ s/\//\\/g; + print $f ' ' x $#dirstack - . " <File RelativePath=\"$fileNameWithPath\""; + . " <File RelativePath=\"$fileNameWithPathFormatted\""; if ($fileNameWithPath =~ /\.y$/) { my $of = $fileNameWithPath; $of =~ s/\.y$/.c/; $of =~ -s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c}; +s{^src/pl/plpgsql/src/gram.c$}{src/pl/plpgsql/src/pl_gram.c}; print $f '>' . $self->GenerateCustomTool( 'Running bison on ' . $fileNameWithPath, - "perl src\\tools\\msvc\\pgbison.pl $fileNameWithPath", $of) + "perl src/tools/msvc/pgbison.pl $fileNameWithPath", $of) . '</File>' . "\n"; } elsif ($fileNameWithPath =~ /\.l$/) @@ -121,7 +126,7 @@ s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c}; print $f '>' . $self->GenerateCustomTool( 'Running flex on ' . $fileNameWithPath, - "perl src\\tools\\msvc\\pgflex.pl $fileNameWithPath", $of) + "perl src/tools/msvc/pgflex.pl $fileNameWithPath", $of) . '</File>' . "\n"; } elsif (defined($uniquefiles{$file})) @@ -129,7 +134,7 @@ s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c}; # File already exists, so fake a new name my $obj = $dir; - $obj =~ s/\\/_/g; + $obj =~ s/\//_/g; print $f "><FileConfiguration Name=\"Debug|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\debug\\$self->{name}\\$obj" . "_$file.obj\" /></FileConfiguration><FileConfiguration Name=\"Release|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\release\\$self->{name}\\$obj" -- 2.3.6
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers