Re: [HACKERS] forward vs backward slashes in msvc build code
On Mon, Apr 27, 2015 at 10:59 AM, Andrew Dunstan and...@dunslane.net wrote: Yeah. I've pushed this with tiny fixes to avoid Leaning Toothpick Syndrome (man perlop for definition). I had to Google that. Then I had to think about it. Then I laughed. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
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
Re: [HACKERS] forward vs backward slashes in msvc build code
On Mon, Apr 27, 2015 at 9:25 PM, Peter Eisentraut pete...@gmx.net wrote: On 4/27/15 2:09 AM, Michael Paquier wrote: 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. What's the difference between MS and VC? MS uses vcxproj specs, and VC vcproj specs... If VC doesn't accept forward slashes, doesn't that invalidate the premise of this patch? I don't think so. The point of the patch is to be able to run the Windows build script in a non-Windows environment to check that modifications in the Makefile stucture does not break some basics of the Windows build script, and this is not impacted. Is it worth attempting to maintain it? vcbuild (~2008) has been replaced by msbuild in MS 2010. Hence I imagine that it is still used a lot. Regards, -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On 4/27/15 2:09 AM, Michael Paquier wrote: 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. What's the difference between MS and VC? If VC doesn't accept forward slashes, doesn't that invalidate the premise of this patch? Is it worth attempting to maintain it? -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On 04/27/2015 08:46 AM, Michael Paquier wrote: On Mon, Apr 27, 2015 at 9:25 PM, Peter Eisentraut pete...@gmx.net wrote: On 4/27/15 2:09 AM, Michael Paquier wrote: 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. What's the difference between MS and VC? MS uses vcxproj specs, and VC vcproj specs... If VC doesn't accept forward slashes, doesn't that invalidate the premise of this patch? I don't think so. The point of the patch is to be able to run the Windows build script in a non-Windows environment to check that modifications in the Makefile stucture does not break some basics of the Windows build script, and this is not impacted. Is it worth attempting to maintain it? vcbuild (~2008) has been replaced by msbuild in MS 2010. Hence I imagine that it is still used a lot. Regards, Yeah. I've pushed this with tiny fixes to avoid Leaning Toothpick Syndrome (man perlop for definition). Thanks for your work on this. cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On Sun, Apr 26, 2015 at 10:29 AM, Andrew Dunstan and...@dunslane.net wrote: On 04/25/2015 08:01 PM, Michael Paquier wrote: On Sun, Apr 26, 2015 at 2:19 AM, Andrew Dunstan and...@dunslane.net wrote: On 04/25/2015 10:53 AM, Michael Paquier wrote: On Sat, Apr 25, 2015 at 9:58 PM, Peter Eisentraut wrote: On 4/24/15 12:22 AM, Michael Paquier wrote: Now that the stuff related to the move from contrib/ to src/bin/, modulescheck and tmp_install has been committed, shouldn't we give a new shot at this patch? Attached is a rebased version. done Thanks, bowerbird is running fine: http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbirddt=2015-04-25%2013%3A31%3A06 But currawong is not - it runs an older version of the MS build tools. See http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=currawongdt=2015-04-25%2016%3A31%3A12: Bad format filename 'src/backend/access/brin/brin.c' at src/tools/msvc/VCBuildProject.pm line 73. VCBuildProject::WriteFiles(VC2008Project=HASH(0x9a7274), *Project::F) called at src/tools/msvc/Project.pm line 363 Project::Save(VC2008Project=HASH(0x9a7274)) called at src/tools/msvc/Solution.pm line 539 Solution::Save(VS2008Solution=HASH(0xc00b7c)) called at src/tools/msvc/Mkvcbuild.pm line 656 Mkvcbuild::mkvcbuild(HASH(0xbed464)) called at build.pl line 36 Oops, attached is a patch that should make currawong happier.. OK, pushed. Argh. This is not enough: http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=currawongdt=2015-04-26%2006%3A00%3A01 The build is done in Debug mode, but it is failing to find some files under the label Release, which is incorrect. I guess that this is caused by the file detection in WriteFiles... TBH I don't have an environment at hand to reproduce the issue and do a proper fix. Hence I think that we should revert the patch for now, and come back to this stuff later on. Regards, -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On 04/26/2015 03:13 AM, Michael Paquier wrote: Oops, attached is a patch that should make currawong happier.. OK, pushed. Argh. This is not enough: http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=currawongdt=2015-04-26%2006%3A00%3A01 The build is done in Debug mode, but it is failing to find some files under the label Release, which is incorrect. I guess that this is caused by the file detection in WriteFiles... TBH I don't have an environment at hand to reproduce the issue and do a proper fix. Hence I think that we should revert the patch for now, and come back to this stuff later on. Well, currawong is mine. so I can try anything you want to suggest. But I don't think it's set up to build Debug. Setting up a VS2008 environment is hard these days, as MS seems to have removed the download :-( cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
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. cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
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. Regards, -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On 04/25/2015 08:01 PM, Michael Paquier wrote: On Sun, Apr 26, 2015 at 2:19 AM, Andrew Dunstan and...@dunslane.net wrote: On 04/25/2015 10:53 AM, Michael Paquier wrote: On Sat, Apr 25, 2015 at 9:58 PM, Peter Eisentraut wrote: On 4/24/15 12:22 AM, Michael Paquier wrote: Now that the stuff related to the move from contrib/ to src/bin/, modulescheck and tmp_install has been committed, shouldn't we give a new shot at this patch? Attached is a rebased version. done Thanks, bowerbird is running fine: http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbirddt=2015-04-25%2013%3A31%3A06 But currawong is not - it runs an older version of the MS build tools. See http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=currawongdt=2015-04-25%2016%3A31%3A12: Bad format filename 'src/backend/access/brin/brin.c' at src/tools/msvc/VCBuildProject.pm line 73. VCBuildProject::WriteFiles(VC2008Project=HASH(0x9a7274), *Project::F) called at src/tools/msvc/Project.pm line 363 Project::Save(VC2008Project=HASH(0x9a7274)) called at src/tools/msvc/Solution.pm line 539 Solution::Save(VS2008Solution=HASH(0xc00b7c)) called at src/tools/msvc/Mkvcbuild.pm line 656 Mkvcbuild::mkvcbuild(HASH(0xbed464)) called at build.pl line 36 Oops, attached is a patch that should make currawong happier.. OK, pushed. cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On 04/25/2015 10:53 AM, Michael Paquier wrote: On Sat, Apr 25, 2015 at 9:58 PM, Peter Eisentraut wrote: On 4/24/15 12:22 AM, Michael Paquier wrote: Now that the stuff related to the move from contrib/ to src/bin/, modulescheck and tmp_install has been committed, shouldn't we give a new shot at this patch? Attached is a rebased version. done Thanks, bowerbird is running fine: http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbirddt=2015-04-25%2013%3A31%3A06 But currawong is not - it runs an older version of the MS build tools. See http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=currawongdt=2015-04-25%2016%3A31%3A12: Bad format filename 'src/backend/access/brin/brin.c' at src/tools/msvc/VCBuildProject.pm line 73. VCBuildProject::WriteFiles(VC2008Project=HASH(0x9a7274), *Project::F) called at src/tools/msvc/Project.pm line 363 Project::Save(VC2008Project=HASH(0x9a7274)) called at src/tools/msvc/Solution.pm line 539 Solution::Save(VS2008Solution=HASH(0xc00b7c)) called at src/tools/msvc/Mkvcbuild.pm line 656 Mkvcbuild::mkvcbuild(HASH(0xbed464)) called at build.pl line 36 cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On Sun, Apr 26, 2015 at 2:19 AM, Andrew Dunstan and...@dunslane.net wrote: On 04/25/2015 10:53 AM, Michael Paquier wrote: On Sat, Apr 25, 2015 at 9:58 PM, Peter Eisentraut wrote: On 4/24/15 12:22 AM, Michael Paquier wrote: Now that the stuff related to the move from contrib/ to src/bin/, modulescheck and tmp_install has been committed, shouldn't we give a new shot at this patch? Attached is a rebased version. done Thanks, bowerbird is running fine: http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbirddt=2015-04-25%2013%3A31%3A06 But currawong is not - it runs an older version of the MS build tools. See http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=currawongdt=2015-04-25%2016%3A31%3A12: Bad format filename 'src/backend/access/brin/brin.c' at src/tools/msvc/VCBuildProject.pm line 73. VCBuildProject::WriteFiles(VC2008Project=HASH(0x9a7274), *Project::F) called at src/tools/msvc/Project.pm line 363 Project::Save(VC2008Project=HASH(0x9a7274)) called at src/tools/msvc/Solution.pm line 539 Solution::Save(VS2008Solution=HASH(0xc00b7c)) called at src/tools/msvc/Mkvcbuild.pm line 656 Mkvcbuild::mkvcbuild(HASH(0xbed464)) called at build.pl line 36 Oops, attached is a patch that should make currawong happier.. -- Michael diff --git a/src/tools/msvc/VCBuildProject.pm b/src/tools/msvc/VCBuildProject.pm index 513cfb5..dda662f 100644 --- a/src/tools/msvc/VCBuildProject.pm +++ b/src/tools/msvc/VCBuildProject.pm @@ -71,7 +71,7 @@ EOF foreach my $fileNameWithPath (sort keys %{ $self-{files} }) { confess Bad format filename '$fileNameWithPath'\n - unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.(c|cpp|y|l|rc)$/); + unless ($fileNameWithPath =~ m!^(.*)/([^/]+)\.(c|cpp|y|l|rc)$!); my $dir = $1; my $file = $2; -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On Sat, Apr 25, 2015 at 9:58 PM, Peter Eisentraut wrote: On 4/24/15 12:22 AM, Michael Paquier wrote: Now that the stuff related to the move from contrib/ to src/bin/, modulescheck and tmp_install has been committed, shouldn't we give a new shot at this patch? Attached is a rebased version. done Thanks, bowerbird is running fine: http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbirddt=2015-04-25%2013%3A31%3A06 -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On 4/24/15 12:22 AM, Michael Paquier wrote: On Fri, Mar 13, 2015 at 6:04 PM, Michael Paquier michael.paqu...@gmail.com wrote: On Fri, Mar 13, 2015 at 6:20 AM, Alvaro Herrera wrote: Peter Eisentraut wrote: This is contrib/chkpass not finding the crypt symbol, which is presumably in some library. But I can't see how it would normally find it, without my patch. It seems crypt is provided by libpgport. So chkpass should be mentioned in @contrib_uselibpgport, but isn't. Maybe the fix is just to add it there? I had a closer look at this patch, and yes indeed, the problem was exactly that. Now honestly I cannot understand why this dependency with libpgport was not necessary before... In any case, attached is a patch rebased on HEAD that builds correctly with MSVC. Now that the stuff related to the move from contrib/ to src/bin/, modulescheck and tmp_install has been committed, shouldn't we give a new shot at this patch? Attached is a rebased version. done -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On Fri, Mar 13, 2015 at 6:04 PM, Michael Paquier michael.paqu...@gmail.com wrote: On Fri, Mar 13, 2015 at 6:20 AM, Alvaro Herrera wrote: Peter Eisentraut wrote: This is contrib/chkpass not finding the crypt symbol, which is presumably in some library. But I can't see how it would normally find it, without my patch. It seems crypt is provided by libpgport. So chkpass should be mentioned in @contrib_uselibpgport, but isn't. Maybe the fix is just to add it there? I had a closer look at this patch, and yes indeed, the problem was exactly that. Now honestly I cannot understand why this dependency with libpgport was not necessary before... In any case, attached is a patch rebased on HEAD that builds correctly with MSVC. Now that the stuff related to the move from contrib/ to src/bin/, modulescheck and tmp_install has been committed, shouldn't we give a new shot at this patch? Attached is a rebased version. -- Michael From 3599bab7b0e37df2a47e497dc9049aa7d78a880b Mon Sep 17 00:00:00 2001 From: Michael Paquier mich...@otacoo.com Date: Thu, 23 Apr 2015 20:13:30 -0700 Subject: [PATCH] Replace backslashes by slash in MSVC build script This makes it easier to run on Linux to check file paths. --- src/tools/msvc/MSBuildProject.pm | 2 +- src/tools/msvc/Mkvcbuild.pm | 344 --- src/tools/msvc/Project.pm| 44 +++-- src/tools/msvc/Solution.pm | 138 4 files changed, 264 insertions(+), 264 deletions(-) diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm index 37958f9..a16f9ac 100644 --- a/src/tools/msvc/MSBuildProject.pm +++ b/src/tools/msvc/MSBuildProject.pm @@ -127,7 +127,7 @@ EOF foreach my $fileNameWithPath (sort keys %{ $self-{files} }) { confess Bad format filename '$fileNameWithPath'\n - unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.(c|cpp|y|l|rc)$/); + unless ($fileNameWithPath =~ m!^(.*)/([^/]+)\.(c|cpp|y|l|rc)$!); my $dir = $1; my $fileName = $2; if ($fileNameWithPath =~ /\.y$/ or $fileNameWithPath =~ /\.l$/) diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 8654bfe..2f0e837 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -33,10 +33,12 @@ 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'); @@ -44,8 +46,8 @@ my $contrib_extralibs = undef; my $contrib_extraincludes = { 'tsearch2' = ['contrib/tsearch2'], 'dblink' = ['src/backend'] }; my $contrib_extrasource = { - 'cube' = [ 'contrib\cube\cubescan.l', 'contrib\cube\cubeparse.y' ], - 'seg' = [ 'contrib\seg\segscan.l', 'contrib\seg\segparse.y' ], }; + 'cube' = [ 'contrib/cube/cubescan.l', 'contrib/cube/cubeparse.y' ], + 'seg' = [ 'contrib/seg/segscan.l', 'contrib/seg/segparse.y' ], }; my @contrib_excludes = ('pgcrypto', 'commit_ts', 'intagg', 'sepgsql'); # Set of variables for frontend modules @@ -59,12 +61,12 @@ my $frontend_extralibs = { 'pgbench'= ['ws2_32.lib'], 'psql' = ['ws2_32.lib'] }; my $frontend_extraincludes = { - 'initdb' = ['src\timezone'], - 'psql' = [ 'src\bin\pg_dump', 'src\backend' ] }; + 'initdb' = ['src/timezone'], + 'psql' = [ 'src/bin/pg_dump', 'src/backend' ] }; my $frontend_extrasource = { - 'psql' = ['src\bin\psql\psqlscan.l'], + 'psql' = ['src/bin/psql/psqlscan.l'], 'pgbench' = - [ 'src\bin\pgbench\exprscan.l', 'src\bin\pgbench\exprparse.y' ], + [ 'src/bin/pgbench/exprscan.l', 'src/bin/pgbench/exprparse.y' ], }; my @frontend_excludes = ('pgevent', 'pg_basebackup', 'pg_rewind', 'pg_dump', 'pg_xlogdump', 'scripts'); @@ -73,9 +75,9 @@ sub mkvcbuild { our $config = shift; - chdir('..\..\..') if (-d '..\msvc' -d '..\..\..\src'); + chdir('../../..') if (-d '../msvc' -d '../../../src'); die 'Must run from root or msvc directory' - unless (-d 'src\tools\msvc' -d 'src'); + unless (-d 'src/tools/msvc' -d 'src'); my $vsVersion = DetermineVisualStudioVersion(); @@ -114,37 +116,37 @@ sub mkvcbuild $libpgport = $solution-AddProject('libpgport', 'lib', 'misc'); $libpgport-AddDefine('FRONTEND'); - $libpgport-AddFiles('src\port', @pgportfiles); + $libpgport-AddFiles('src/port', @pgportfiles); $libpgcommon = $solution-AddProject('libpgcommon', 'lib', 'misc'); $libpgcommon-AddDefine('FRONTEND'); - $libpgcommon-AddFiles('src\common', @pgcommonfrontendfiles); + $libpgcommon-AddFiles('src/common', @pgcommonfrontendfiles); - $postgres = $solution-AddProject('postgres', 'exe', '', 'src\backend'); - $postgres-AddIncludeDir('src\backend'); - $postgres-AddDir('src\backend\port\win32'); - $postgres-AddFile('src\backend\utils\fmgrtab.c'); + $postgres = $solution-AddProject('postgres', 'exe', '', 'src/backend'); +
Re: [HACKERS] forward vs backward slashes in msvc build code
On Fri, Mar 13, 2015 at 6:20 AM, Alvaro Herrera wrote: Peter Eisentraut wrote: This is contrib/chkpass not finding the crypt symbol, which is presumably in some library. But I can't see how it would normally find it, without my patch. It seems crypt is provided by libpgport. So chkpass should be mentioned in @contrib_uselibpgport, but isn't. Maybe the fix is just to add it there? I had a closer look at this patch, and yes indeed, the problem was exactly that. Now honestly I cannot understand why this dependency with libpgport was not necessary before... In any case, attached is a patch rebased on HEAD that builds correctly with MSVC. -- Michael diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm index 37958f9..a16f9ac 100644 --- a/src/tools/msvc/MSBuildProject.pm +++ b/src/tools/msvc/MSBuildProject.pm @@ -127,7 +127,7 @@ EOF foreach my $fileNameWithPath (sort keys %{ $self-{files} }) { confess Bad format filename '$fileNameWithPath'\n - unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.(c|cpp|y|l|rc)$/); + unless ($fileNameWithPath =~ m!^(.*)/([^/]+)\.(c|cpp|y|l|rc)$!); my $dir = $1; my $fileName = $2; if ($fileNameWithPath =~ /\.y$/ or $fileNameWithPath =~ /\.l$/) diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 989a2ec..5634b3a 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -34,11 +34,11 @@ my $contrib_defines = { 'refint' = 'REFINT_VERBOSE' }; my @contrib_uselibpq = ('dblink', 'oid2name', 'pgbench', 'pg_upgrade', 'postgres_fdw', 'vacuumlo'); my @contrib_uselibpgport = ( - 'oid2name', 'pgbench', - 'pg_standby','pg_archivecleanup', - 'pg_test_fsync', 'pg_test_timing', - 'pg_upgrade','pg_xlogdump', - 'vacuumlo'); + 'chkpass', 'oid2name', + 'pgbench', 'pg_standby', + 'pg_archivecleanup', 'pg_test_fsync', + 'pg_test_timing','pg_upgrade', + 'pg_xlogdump', 'vacuumlo'); my @contrib_uselibpgcommon = ( 'oid2name', 'pgbench', 'pg_standby','pg_archivecleanup', @@ -49,10 +49,10 @@ my $contrib_extralibs = { 'pgbench' = ['ws2_32.lib'] }; my $contrib_extraincludes = { 'tsearch2' = ['contrib/tsearch2'], 'dblink' = ['src/backend'] }; my $contrib_extrasource = { - 'cube' = [ 'contrib\cube\cubescan.l', 'contrib\cube\cubeparse.y' ], + 'cube' = [ 'contrib/cube/cubescan.l', 'contrib/cube/cubeparse.y' ], 'pgbench' = - [ 'contrib\pgbench\exprscan.l', 'contrib\pgbench\exprparse.y' ], - 'seg' = [ 'contrib\seg\segscan.l', 'contrib\seg\segparse.y' ], }; + [ 'contrib/pgbench/exprscan.l', 'contrib/pgbench/exprparse.y' ], + 'seg' = [ 'contrib/seg/segscan.l', 'contrib/seg/segparse.y' ], }; my @contrib_excludes = ('pgcrypto', 'intagg', 'sepgsql'); # Set of variables for frontend modules @@ -63,18 +63,18 @@ my $frontend_extralibs = { 'pg_restore' = ['ws2_32.lib'], 'psql' = ['ws2_32.lib'] }; my $frontend_extraincludes = { - 'initdb' = ['src\timezone'], - 'psql' = [ 'src\bin\pg_dump', 'src\backend' ] }; -my $frontend_extrasource = { 'psql' = ['src\bin\psql\psqlscan.l'] }; + 'initdb' = [ 'src/timezone' ], + 'psql' = [ 'src/bin/pg_dump', 'src/backend' ] }; +my $frontend_extrasource = { 'psql' = ['src/bin/psql/psqlscan.l'] }; my @frontend_excludes = ('pgevent', 'pg_basebackup', 'pg_dump', 'scripts'); sub mkvcbuild { our $config = shift; - chdir('..\..\..') if (-d '..\msvc' -d '..\..\..\src'); + chdir('../../..') if (-d '../msvc' -d '../../../src'); die 'Must run from root or msvc directory' - unless (-d 'src\tools\msvc' -d 'src'); + unless (-d 'src/tools/msvc' -d 'src'); my $vsVersion = DetermineVisualStudioVersion(); @@ -101,37 +101,37 @@ sub mkvcbuild $libpgport = $solution-AddProject('libpgport', 'lib', 'misc'); $libpgport-AddDefine('FRONTEND'); - $libpgport-AddFiles('src\port', @pgportfiles); + $libpgport-AddFiles('src/port', @pgportfiles); $libpgcommon = $solution-AddProject('libpgcommon', 'lib', 'misc'); $libpgcommon-AddDefine('FRONTEND'); - $libpgcommon-AddFiles('src\common', @pgcommonfrontendfiles); + $libpgcommon-AddFiles('src/common', @pgcommonfrontendfiles); - $postgres = $solution-AddProject('postgres', 'exe', '', 'src\backend'); - $postgres-AddIncludeDir('src\backend'); - $postgres-AddDir('src\backend\port\win32'); - $postgres-AddFile('src\backend\utils\fmgrtab.c'); + $postgres = $solution-AddProject('postgres', 'exe', '', 'src/backend'); + $postgres-AddIncludeDir('src/backend'); + $postgres-AddDir('src/backend/port/win32'); + $postgres-AddFile('src/backend/utils/fmgrtab.c'); $postgres-ReplaceFile( - 'src\backend\port\dynloader.c', - 'src\backend\port\dynloader\win32.c'); - $postgres-ReplaceFile('src\backend\port\pg_sema.c', - 'src\backend\port\win32_sema.c'); - $postgres-ReplaceFile('src\backend\port\pg_shmem.c', - 'src\backend\port\win32_shmem.c'); - $postgres-ReplaceFile('src\backend\port\pg_latch.c', - 'src\backend\port\win32_latch.c'); -
Re: [HACKERS] forward vs backward slashes in msvc build code
Peter Eisentraut wrote: On 3/4/15 11:00 PM, Andrew Dunstan wrote: On 03/04/2015 10:37 PM, Peter Eisentraut wrote: I can't tell from just looking at the code how chkpass would normally find crypt. The msvc tools neither parse SHLIB_LINK nor have hardcoded knowledge. Any idea? Which library is it in? There are sections at the top of Mkvcbuild.pm for including various libraries in contrib modules that need them. This is contrib/chkpass not finding the crypt symbol, which is presumably in some library. But I can't see how it would normally find it, without my patch. It seems crypt is provided by libpgport. So chkpass should be mentioned in @contrib_uselibpgport, but isn't. Maybe the fix is just to add it there? -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On 3/4/15 11:00 PM, Andrew Dunstan wrote: On 03/04/2015 10:37 PM, Peter Eisentraut wrote: On 2/15/15 6:55 AM, Michael Paquier wrote: I tested quickly the second patch with MS 2010 and I am getting a build failure: chkpass cannot complete because of crypt missing. On master build passes. More details here: C:\Users\mpaquier\git\postgres\pgsql.sln (default target) (1) - C:\Users\mpaquier\git\postgres\chkpass.vcxproj (default target) (36) - (Link target) - chkpass.obj : error LNK2019: unresolved external symbol crypt referenced in function chkpass_in [C:\Users\ioltas\git\postgres\chkpass.vcxproj] .\Release\chkpass\chkpass.dll : fatal error LNK1120: 1 unresolved externals [C:\Users\mpaquier\git\postgres\chkpass.vcxproj] I can't tell from just looking at the code how chkpass would normally find crypt. The msvc tools neither parse SHLIB_LINK nor have hardcoded knowledge. Any idea? Which library is it in? There are sections at the top of Mkvcbuild.pm for including various libraries in contrib modules that need them. This is contrib/chkpass not finding the crypt symbol, which is presumably in some library. But I can't see how it would normally find it, without my patch. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On 03/04/2015 10:37 PM, Peter Eisentraut wrote: On 2/15/15 6:55 AM, Michael Paquier wrote: I tested quickly the second patch with MS 2010 and I am getting a build failure: chkpass cannot complete because of crypt missing. On master build passes. More details here: C:\Users\mpaquier\git\postgres\pgsql.sln (default target) (1) - C:\Users\mpaquier\git\postgres\chkpass.vcxproj (default target) (36) - (Link target) - chkpass.obj : error LNK2019: unresolved external symbol crypt referenced in function chkpass_in [C:\Users\ioltas\git\postgres\chkpass.vcxproj] .\Release\chkpass\chkpass.dll : fatal error LNK1120: 1 unresolved externals [C:\Users\mpaquier\git\postgres\chkpass.vcxproj] I can't tell from just looking at the code how chkpass would normally find crypt. The msvc tools neither parse SHLIB_LINK nor have hardcoded knowledge. Any idea? Which library is it in? There are sections at the top of Mkvcbuild.pm for including various libraries in contrib modules that need them. cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On 2/15/15 6:55 AM, Michael Paquier wrote: I tested quickly the second patch with MS 2010 and I am getting a build failure: chkpass cannot complete because of crypt missing. On master build passes. More details here: C:\Users\mpaquier\git\postgres\pgsql.sln (default target) (1) - C:\Users\mpaquier\git\postgres\chkpass.vcxproj (default target) (36) - (Link target) - chkpass.obj : error LNK2019: unresolved external symbol crypt referenced in function chkpass_in [C:\Users\ioltas\git\postgres\chkpass.vcxproj] .\Release\chkpass\chkpass.dll : fatal error LNK1120: 1 unresolved externals [C:\Users\mpaquier\git\postgres\chkpass.vcxproj] I can't tell from just looking at the code how chkpass would normally find crypt. The msvc tools neither parse SHLIB_LINK nor have hardcoded knowledge. Any idea? -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] forward vs backward slashes in msvc build code
On Sun, Feb 15, 2015 at 12:51 PM, Peter Eisentraut pete...@gmx.net wrote: I understand that on Windows, you can use forward slashes in path names interchangeably with backward slashes (except possibly in the shell). I have developed the attached patch to change the msvc build code to use forward slashes consistently. Together with the other attached patch, which is an unpolished hack, this allows me to run the build.pl script on not-Windows. It won't actually build, but it will create all the project files. That way, I can check whether some makefile hackery would break the Windows build. This sounds like a good idea to improve the checks of the scripts of Windows, like the presence of win32rc files, etc. Could someone verify this please? I tested quickly the second patch with MS 2010 and I am getting a build failure: chkpass cannot complete because of crypt missing. On master build passes. More details here: C:\Users\mpaquier\git\postgres\pgsql.sln (default target) (1) - C:\Users\mpaquier\git\postgres\chkpass.vcxproj (default target) (36) - (Link target) - chkpass.obj : error LNK2019: unresolved external symbol crypt referenced in function chkpass_in [C:\Users\ioltas\git\postgres\chkpass.vcxproj] .\Release\chkpass\chkpass.dll : fatal error LNK1120: 1 unresolved externals [C:\Users\mpaquier\git\postgres\chkpass.vcxproj] 0 Warning(s) 2 Error(s) Regards, -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
[HACKERS] forward vs backward slashes in msvc build code
I understand that on Windows, you can use forward slashes in path names interchangeably with backward slashes (except possibly in the shell). I have developed the attached patch to change the msvc build code to use forward slashes consistently. Together with the other attached patch, which is an unpolished hack, this allows me to run the build.pl script on not-Windows. It won't actually build, but it will create all the project files. That way, I can check whether some makefile hackery would break the Windows build. Could someone verify this please? From 46c7e31ee49f32fb373a8bd10c3bd5e777359053 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut pete...@gmx.net Date: Sat, 14 Feb 2015 22:42:41 -0500 Subject: [PATCH 1/2] Workarounds for lack of Win32 module --- src/tools/msvc/Mkvcbuild.pm | 2 +- src/tools/msvc/Project.pm | 2 +- src/tools/msvc/Solution.pm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index dba9b63..879589d 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -6,7 +6,7 @@ package Mkvcbuild; # src/tools/msvc/Mkvcbuild.pm # use Carp; -use Win32; +#use Win32; use strict; use warnings; use Project; diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm index b9b5a23..6d84d89 100644 --- a/src/tools/msvc/Project.pm +++ b/src/tools/msvc/Project.pm @@ -21,7 +21,7 @@ sub _new my $self = { name = $name, type = $type, - guid = Win32::GuidGen(), + guid = $^O eq 'MSWin32' ? Win32::GuidGen() : '{FIXME}', files = {}, references= [], libraries = [], diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index 39e41f6..9bd864c 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -562,7 +562,7 @@ EOF } if ($fld ne ) { - $flduid{$fld} = Win32::GuidGen(); + $flduid{$fld} = $^O eq 'MSWin32' ? Win32::GuidGen() : '{FIXME}'; print SLN EOF; Project({2150E333-8FDC-42A3-9474-1A3956D46DE8}) = $fld, $fld, $flduid{$fld} EndProject -- 2.3.0 From 1898bb7812920c64d19476a77db8adaaa54cba46 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut pete...@gmx.net Date: Sat, 14 Feb 2015 22:43:03 -0500 Subject: [PATCH 2/2] Use forward slash instead of backward slash in msvc build code --- src/tools/msvc/MSBuildProject.pm | 2 +- src/tools/msvc/Mkvcbuild.pm | 322 +++ src/tools/msvc/Project.pm| 41 +++-- src/tools/msvc/Solution.pm | 138 - 4 files changed, 250 insertions(+), 253 deletions(-) diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm index 37958f9..a16f9ac 100644 --- a/src/tools/msvc/MSBuildProject.pm +++ b/src/tools/msvc/MSBuildProject.pm @@ -127,7 +127,7 @@ EOF foreach my $fileNameWithPath (sort keys %{ $self-{files} }) { confess Bad format filename '$fileNameWithPath'\n - unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.(c|cpp|y|l|rc)$/); + unless ($fileNameWithPath =~ m!^(.*)/([^/]+)\.(c|cpp|y|l|rc)$!); my $dir = $1; my $fileName = $2; if ($fileNameWithPath =~ /\.y$/ or $fileNameWithPath =~ /\.l$/) diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 879589d..8820d3a 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -56,9 +56,9 @@ sub mkvcbuild { our $config = shift; - chdir('..\..\..') if (-d '..\msvc' -d '..\..\..\src'); + chdir('../../..') if (-d '../msvc' -d '../../../src'); die 'Must run from root or msvc directory' - unless (-d 'src\tools\msvc' -d 'src'); + unless (-d 'src/tools/msvc' -d 'src'); my $vsVersion = DetermineVisualStudioVersion(); @@ -85,36 +85,36 @@ sub mkvcbuild $libpgport = $solution-AddProject('libpgport', 'lib', 'misc'); $libpgport-AddDefine('FRONTEND'); - $libpgport-AddFiles('src\port', @pgportfiles); + $libpgport-AddFiles('src/port', @pgportfiles); $libpgcommon = $solution-AddProject('libpgcommon', 'lib', 'misc'); $libpgcommon-AddDefine('FRONTEND'); - $libpgcommon-AddFiles('src\common', @pgcommonfrontendfiles); + $libpgcommon-AddFiles('src/common', @pgcommonfrontendfiles); - $postgres = $solution-AddProject('postgres', 'exe', '', 'src\backend'); - $postgres-AddIncludeDir('src\backend'); - $postgres-AddDir('src\backend\port\win32'); - $postgres-AddFile('src\backend\utils\fmgrtab.c'); + $postgres = $solution-AddProject('postgres', 'exe', '', 'src/backend'); + $postgres-AddIncludeDir('src/backend'); + $postgres-AddDir('src/backend/port/win32'); + $postgres-AddFile('src/backend/utils/fmgrtab.c'); $postgres-ReplaceFile( - 'src\backend\port\dynloader.c', - 'src\backend\port\dynloader\win32.c'); - $postgres-ReplaceFile('src\backend\port\pg_sema.c', - 'src\backend\port\win32_sema.c'); - $postgres-ReplaceFile('src\backend\port\pg_shmem.c', - 'src\backend\port\win32_shmem.c'); -