Thread: Error compiling Postgresql source code in Visual Studio 2010

Error compiling Postgresql source code in Visual Studio 2010

From
tubadzin
Date:
Hi.
1.I downloaded source code PostgreSql version 9.2.4. from  http://www.postgresql.org/ftp/source/
2.Next, I downloaded ActivePerl and installed it. Next, I used Visual Studio x64 Win64 command prompt 2010. Later I used visual studio command prompt for get into path source code :
"C:\Postgresql-9-2-4\src\tools\msvc" and I used "build" command like in instruction below.
http://www.postgresql.org/docs/9.0/static/install-windows-full.html#AEN23979
3.Ok, after 3 minutes source code compiled and I have visual studio with 112 projects, I was so optimistic:)
"C:\Postgresql-9-2-4\pgsql.sln"
4.And now I have a big problem:( I want to add new alghoritm to nodeHash.c in "Postgres" project in Visual Studio and later compile source code. But, on the beginning I did'n implement anything. On start, Visual Studio generates 1473 error like this (Can I omit this error to compile? Maybe any seetings in Visual Studio are required?):
 
Error   1498    IntelliSense: identifier "BLCKSZ" is undefined    C:\Postgresql-9-2-4\src\include\access\relscan.h    53    28  

Error    35    error C2466: cannot allocate an array of constant size 0    C:\Postgresql-9-2-4\src\backend\access\gin\ginentrypage.c    568    1    postgres

Error    675    error C2229: struct 'SpGistScanOpaqueData' has an illegal zero-sized array    C:\Postgresql-9-2-4\src\include\access\spgist_private.h    158    1    postgres

Error    180    error C2229: struct 'GISTScanOpaqueData' has an illegal zero-sized array    C:\Postgresql-9-2-4\src\include\access\gist_private.h    156    1    postgres

Error    402    error C2229: struct '<unnamed-tag>' has an illegal zero-sized array    C:\Postgresql-9-2-4\src\backend\access\heap\pruneheap.c    40    1    postgres

Error    1159    error C2198: '_tarWriteHeader' : too few arguments for call    C:\Postgresql-9-2-4\src\backend\replication\basebackup.c    758    1    postgres

Error    1009    error C2146: syntax error : missing ')' before identifier 'PG_MAJORVERSION'    C:\Postgresql-9-2-4\src\backend\catalog\catalog.c    189    1    postgres

Error    51    error C2133: 'vector' : unknown size    C:\Postgresql-9-2-4\src\backend\access\gin\gindatapage.c    481    1    postgres

Error    722    error C2133: 'toPlaceholder' : unknown size    C:\Postgresql-9-2-4\src\backend\access\spgist\spgvacuum.c    131    1    postgres

Error    1438    error C2099: initializer is not a constant    C:\Postgresql-9-2-4\src\backend\utils\misc\guc.c    2203    1    postgres

Error    885    error C2065: 'XLOG_SEG_SIZE' : undeclared identifier    C:\Postgresql-9-2-4\src\backend\access\transam\xlogfuncs.c    542    1    postgres

Error    990    error C2065: 'XLOG_BLCKSZ' : undeclared identifier    C:\Postgresql-9-2-4\src\backend\access\transam\xlog.c    4053    1    postgres

Error    1387    error C2065: 'FLOAT8PASSBYVAL' : undeclared identifier    C:\Postgresql-9-2-4\src\backend\utils\adt\float.c    1906    1    postgres

Error    13    error C2065: 'BLCKSZ' : undeclared identifier    C:\Postgresql-9-2-4\src\backend\access\gin\ginbtree.c    248    1    postgres

Error    1467    error C1189: #error :  BLCKSZ must be between 1KB and 1MB    C:\Postgresql-9-2-4\src\backend\utils\misc\guc.c    4809    1    postgres

Error    1147    error C1083: Cannot open source file: 'src\backend\replication\repl_gram.c': No such file or directory    C:\Postgresql-9-2-4\c1    postgres

Error    892    error C1083: Cannot open source file: 'src\backend\bootstrap\bootparse.c': No such file or directory    C:\Postgresql-9-2-4\c1    postgres

Re: Error compiling Postgresql source code in Visual Studio 2010

From
Amit kapila
Date:
On Saturday, July 20, 2013 9:53 PM tubadzin wrote:

> Hi.
> 1.I downloaded source code PostgreSql version 9.2.4. from  http://www.postgresql.org/ftp/source/
> 2.Next, I downloaded ActivePerl and installed it. Next, I used Visual Studio x64 Win64 command prompt 2010. Later I
usedvisual studio command prompt for get into path source code : 
> "C:\Postgresql-9-2-4\src\tools\msvc" and I used "build" command like in instruction below.
> http://www.postgresql.org/docs/9.0/static/install-windows-full.html#AEN23979
> 3.Ok, after 3 minutes source code compiled and I have visual studio with 112 projects, I was so optimistic:)
> "C:\Postgresql-9-2-4\pgsql.sln"
> 4.And now I have a big problem:( I want to add new alghoritm to nodeHash.c in "Postgres" project in Visual Studio and
latercompile source code. But, on the beginning I did'n implement anything.  
> On start, Visual Studio generates 1473 error like this (Can I omit this error to compile? Maybe any seetings in
VisualStudio are required?): 

If build works for you from command prompt, then change the source code and again build from command prompt, your
changeswill get compiled. 
However it should be built from visual studio as well, can u check by adding perl\bin path in
VC++ Directories for Executable files (Tools->Options->Projects and Solutions->VC++ Directories), also check if
platformsdk is present in path, and path for bison,flex executables. 

With Regards,
Amit Kapila.