1. Use the flex and yacc scripts for source code download and preparation of PG lexical and Syntax Parsing respectively, that is, the. l and. y files in the source code are generated by them. c and.
1. Use the flex and yacc scripts for source code download and preparation of PG lexical and Syntax Parsing respectively, that is, the. l and. y files in the source code are generated by them. c and.
1. Source Code download and preparation
PostgreSQL uses the flex and yacc scripts respectively for lexical and Syntax Parsing, that is, the. l and. y files in the source code are generated by them. c and. H files.
For more details, see:
(Unfortunately, this website cannot be accessed directly. You can find a solution)
These two tools have not been completely completed in the Windows environment. In addition, considering their versions, I generate a syntax engine in Linux. For the operation steps, see (2 ).
References: Mechanical Industry Press of lex and yacc
(1) download the package. The advantage of this method is that you do not need to use flex and bison.
:
International Community
Domestic image ftp://www.highgo.com.cn/pub/mirrors/pgsql/source/
In step 2, you do not need to generate any files in Linux.
(2) The clone community git code library requires: git flex bison
Git is a powerful and confusing code management tool. Learn how to use it on the official website:
(Unfortunately, you can find a solution)
In Windows, Cygwin can be installed, git and openssh can be installed, and git can be used in the Cygwin environment.
Official Website:
Note that the compilation switch must be consistent. The following steps a-e must be executed in Linux.
A). Clone the code library
Git clone
B). To configure compilation parameters, you may need to install some Development kits and install them according to the error prompt.
./Configure -- prefix =/usr/local/pg93b1 \
-- Enable-nls = "zh_CN zh_TW "\
-- Without-perl \
-- Without-python \
-- Without-tcl \
-- Without-gssapi \
Without-krb5 \
-- Without-pam \
-- Without-ldap \
-- Without-bonjour \
-- With-openssl \
-- With-libxml -- with-libxslt \
-- Enable-thread-safety \
-- With-zlib \
-- Without-selinux
C) Compile the kernel
Make
D) Compile the peripheral modules.
Cd contrib & make
Cd ..
E) Compile the isolation test script
Cd src/test/isolation & make
F) copy the following file to the same location of the source code in Windows.
Src \ backend \ bootstrap \ bootparse. c
Src \ backend \ bootstrap \ bootpattern. c
Src \ backend \ parser \ gram. c
Src \ backend \ parser \ gram. h
Src \ backend \ parser \ scan. c
Src \ backend \ replication \ repl_gram.c
Src \ backend \ replication \ repl_scanner.c
Src \ backend \ utils \ misc \ guc-file.c
Src \ bin \ psql \ psqlscan. c
Contrib \ cube \ cubeparse. c
Contrib \ cube \ cubescan. c
Contrib \ seg \ segparse. c
Contrib \ seg \ segscan. c
Src \ interfaces \ ecpg \ preproc \ pgc. c
Src \ interfaces \ ecpg \ preproc. c
Src \ interfaces \ ecpg \ preproc. h
Src \ pl \ plpgsql \ src \ pl_gram.c
Src \ pl \ plpgsql \ src \ pl_gram.h
Src \ test \ isolation \ specparse. c
Src \ test \ isolation \ specw.c
2. Download and prepare Windows Development Kit
For the list of Development kits required for compiling PostgreSQL in Windows, see 16.1.1. Requirements.
Download OpenSSL, which is comprehensive here.
Ftp://ftp.zlatkovic.com/libxml/
Openssl is also available here, but the version is old.
Download iconv, libxml2, libxslt, and zlib from here. We recommend that you use
Download gettext here
The package update mentioned in this document lags far behind gnu, but it is still available.
Decompress the downloaded package to the c: \ pgbuild directory.
3. Download from Microsoft VC. The express version is sufficient for us and is free of charge.
After installation, we recommend that you install all patches.
4. Modify src \ tools \ msvc \ config_default.pl to point to the downloaded SDK.
Nls => "C: \ pgbuild \ gettext"
Openssl => "C: \ pgbuild \ OpenSSL"
Xml => "C :\\ pgbuild \ libxml2"
Xslt => "C :\\ pgbuild \ libxslt"
Iconv => "C: \ pgbuild \ iconv"
Zlib => "C: \ pgbuild \ zlib"
6. Download and install ActivePerl
7. Open the program menu "Microsoft Visual Studio 2010"-> "Visual Studio Tools"-> "Visual Studio Command Prompt (2010)"
If it is another version, it should be noted that it is a 32-bit version, but you cannot be sure of its attributes. The parameter x86 is behind vcvarsall. bat.
Set path = % path %; C: \ pgbuild \ iconv \ bin;
Set path = % path % C: \ ActivePerl-5.12.x \ bin;
Set path = % path % C: \ pgbuild \ gettext \ bin;
Go to the PostgreSQL source code src \ tools \ msvc and run build. bat.
Run: install. bat after compilation. <目标目录>
8. Now the compilation is complete, but some dll files need to be manually copied. Find the dll files in the development package directory in step 2 based on the file missing error prompt.