Compile error with MSVC - Mailing list pgsql-patches

From Yoshiyuki Asaba
Subject Compile error with MSVC
Date
Msg-id 20070704.141228.57446947.y-asaba@sraoss.co.jp
Whole thread Raw
Responses Re: Compile error with MSVC
List pgsql-patches
Hi,

I tried to compile using Visual C++ 2005. But I got the following
errors.

  .\src\backend\parser\keywords.c(22) : fatal error C1083: 'parser/parse.h': No such file or directory


I saw src/tools/msvc/pgbison.bat. Why does it copy
src/backend/parser/parser.h to src/include/parser directory?

src/tools/msvc/pgbison.bat:14

  if "%1" == "src\backend\parser\gram.y" call :generate %1 src\backend\parser\gram.c src\include\parser\parse.h

I think we should add "src/backend" directory to include path. Because
if gram.c is newer than gram.y, include/parser/parse.h does not
copied.

Then, I saw clean.bat. It deletes the files generated by Bison. I
think we don't have to delete these files.

The attached patch for HEAD is fixed them.
Regards,
--
Yoshiyuki Asaba
y-asaba@sraoss.co.jp
Index: Mkvcbuild.pm
===================================================================
RCS file: /projects/cvsroot/pgsql/src/tools/msvc/Mkvcbuild.pm,v
retrieving revision 1.13
diff -c -r1.13 Mkvcbuild.pm
*** Mkvcbuild.pm    12 Jun 2007 18:31:28 -0000    1.13
--- Mkvcbuild.pm    4 Jul 2007 05:07:46 -0000
***************
*** 185,203 ****
--- 185,207 ----

      my $psql = AddSimpleFrontend('psql', 1);
      $psql->AddIncludeDir('src\bin\pg_dump');
+     $psql->AddIncludeDir('src\backend');
      $psql->AddFile('src\bin\psql\psqlscan.l');

      my $pgdump = AddSimpleFrontend('pg_dump', 1);
+     $pgdump->AddIncludeDir('src\backend');
      $pgdump->AddFile('src\bin\pg_dump\pg_dump.c');
      $pgdump->AddFile('src\bin\pg_dump\common.c');
      $pgdump->AddFile('src\bin\pg_dump\pg_dump_sort.c');

      my $pgdumpall = AddSimpleFrontend('pg_dump', 1);
      $pgdumpall->{name} = 'pg_dumpall';
+     $pgdumpall->AddIncludeDir('src\backend');
      $pgdumpall->AddFile('src\bin\pg_dump\pg_dumpall.c');

      my $pgrestore = AddSimpleFrontend('pg_dump', 1);
      $pgrestore->{name} = 'pg_restore';
+     $pgrestore->AddIncludeDir('src\backend');
      $pgrestore->AddFile('src\bin\pg_dump\pg_restore.c');

      my $zic = $solution->AddProject('zic','exe','utils');
***************
*** 293,298 ****
--- 297,303 ----
              if ($f =~ /\/keywords\.o$/)
              {
                  $proj->AddFile('src\backend\parser\keywords.c');
+                 $proj->AddIncludeDir('src\backend');
              }
              else
              {
Index: clean.bat
===================================================================
RCS file: /projects/cvsroot/pgsql/src/tools/msvc/clean.bat,v
retrieving revision 1.5
diff -c -r1.5 clean.bat
*** clean.bat    12 Jun 2007 11:07:34 -0000    1.5
--- clean.bat    4 Jul 2007 05:07:46 -0000
***************
*** 16,50 ****
  REM Delete files created with GenerateFiles() in Solution.pm
  call :del src\include\pg_config.h
  call :del src\include\pg_config_os.h
- call :del src\include\parser\parse.h
  call :del src\include\utils\fmgroids.h

  call :del src\backend\utils\fmgrtab.c
  call :del src\backend\catalog\postgres.bki
  call :del src\backend\catalog\postgres.description
  call :del src\backend\catalog\postgres.shdescription
- call :del src\backend\parser\gram.c
- call :del src\backend\bootstrap\bootparse.c
- call :del src\backend\bootstrap\bootstrap_tokens.h

  call :del src\bin\psql\sql_help.h

  call :del src\interfaces\libpq\libpq.rc
  call :del src\interfaces\libpq\libpqdll.def
  call :del src\interfaces\ecpg\include\ecpg_config.h
- call :del src\interfaces\ecpg\preproc\preproc.c
- call :del src\interfaces\ecpg\preproc\preproc.h

  call :del src\port\pg_config_paths.h

  call :del src\pl\plperl\spi.c
- call :del src\pl\plpgsql\src\pl_gram.c
- call :del src\pl\plpgsql\src\pl.tab.h
-
- call :del contrib\cube\cubeparse.c
- call :del contrib\cube\cubeparse.h
- call :del contrib\seg\segparse.c
- call :del contrib\seg\segparse.h

  if exist src\test\regress\tmp_check rd /s /q src\test\regress\tmp_check
  call :del contrib\spi\refint.dll
--- 16,37 ----
Index: pgbison.bat
===================================================================
RCS file: /projects/cvsroot/pgsql/src/tools/msvc/pgbison.bat,v
retrieving revision 1.6
diff -c -r1.6 pgbison.bat
*** pgbison.bat    17 Mar 2007 17:11:41 -0000    1.6
--- pgbison.bat    4 Jul 2007 05:07:46 -0000
***************
*** 11,17 ****
  goto nobison
  :bisonok

! if "%1" == "src\backend\parser\gram.y" call :generate %1 src\backend\parser\gram.c src\include\parser\parse.h
  if "%1" == "src\backend\bootstrap\bootparse.y" call :generate %1 src\backend\bootstrap\bootparse.c
src\backend\bootstrap\bootstrap_tokens.h
  if "%1" == "src\pl\plpgsql\src\gram.y" call :generate %1 src\pl\plpgsql\src\pl_gram.c src\pl\plpgsql\src\pl.tab.h
  if "%1" == "src\interfaces\ecpg\preproc\preproc.y" call :generate %1 src\interfaces\ecpg\preproc\preproc.c
src\interfaces\ecpg\preproc\preproc.h
--- 11,17 ----
  goto nobison
  :bisonok

! if "%1" == "src\backend\parser\gram.y" call :generate %1 src\backend\parser\gram.c src\backend\parser\parse.h
  if "%1" == "src\backend\bootstrap\bootparse.y" call :generate %1 src\backend\bootstrap\bootparse.c
src\backend\bootstrap\bootstrap_tokens.h
  if "%1" == "src\pl\plpgsql\src\gram.y" call :generate %1 src\pl\plpgsql\src\pl_gram.c src\pl\plpgsql\src\pl.tab.h
  if "%1" == "src\interfaces\ecpg\preproc\preproc.y" call :generate %1 src\interfaces\ecpg\preproc\preproc.c
src\interfaces\ecpg\preproc\preproc.h

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: [DOCS] rename of a view
Next
From: "Jacob Rief"
Date:
Subject: Re: SPI-header-files safe for C++-compiler