您好,登錄后才能下訂單哦!
一、軟件需求
Windows 7 旗艦版 sp1 X64
ActivePerl-5.22.3.2204-MSWin32-x64-401627.exe
diffutils-2.8.7-1.exe, 編譯之后回歸測試使用,需要手工添加bin路徑到PATH
visual studio ultimate 2013,VS2013_RTM_ULT_CHS.iso
visual assist,代碼格式化工具
postgresql-9.6.2.tar.gz,pg源碼
二、安裝IDE工具
1.安裝Perl
下載ActivePerl-5.22.3.2204-MSWin32-x64-401627.exe,雙擊安裝
單擊"next",選擇"接受協(xié)議",
單擊"next",安裝類型"Type",
安裝選項"Add Perl to the PATH environment variable","create Perl file extension association"
單擊"next",單擊"install",單擊"finish"
添加 bin目錄"C:\Perl64\bin",配置到系統(tǒng)環(huán)境變量PATH.
2.安裝Windows 平臺 diff工具,回歸測試使用
下載diffutils-2.8.7-1.exe安裝包,雙擊安裝
單擊"next",選擇"接受協(xié)議",默認配置,單擊"next",...,單擊"install",單擊"finish"
把軟件安裝的bin目錄"C:\Program Files (x86)\GnuWin32\bin",配置到系統(tǒng)環(huán)境變量PATH中.
3.安裝visual studio ultimate 2013
下載VS2013_RTM_ULT_CHS.iso,并解壓到VS2013_RTM_ULT_CHS目錄,解壓完成進入這個目錄
雙擊"vs_ultimate.exe"進行安裝,提示IE 8 不兼容建議IE 10 ,單擊"繼續(xù)",
選擇"同意許可",單擊"下一步"
選擇安裝功能,只選擇"用于C++的Microsoft基礎類",單擊"安裝"
安裝成功后,單擊"啟動",程序界面加載完成,幫助->注冊產(chǎn)品,輸入產(chǎn)品序列號
4.安裝visual assist
雙擊"VA_X_Setup2001.exe",只選擇"Microsoft visual studio 2013 RC",單擊"install"
單擊"確定",安裝成功
5.獲取postgresql源碼
解壓postgresql-9.6.2.tar.gz到F 盤根目錄
6. 編譯安裝數(shù)據(jù)庫
開始->所有程序->visual studio 2013->visual studio tools
目錄中雙擊"VS2013 x64 本機工具命令提示",打開visual studio 2013命令行窗口
轉(zhuǎn)到"F:\postgresql-9.6.2\src\tools\msvc"目錄,
1) 編譯數(shù)據(jù)庫
執(zhí)行perl build.pl DEBUG(DEBUG,代表調(diào)試模式,如果不加表示非調(diào)試模式)
2) 回歸測試,
perl vcregress.pl check
.............
test event_trigger ... ok
test stats ... ok
============== shutting down postmaster ==============
============== removing temporary instance ==============
=======================
All 167 tests passed.
=======================
3) 安裝數(shù)據(jù)庫
F:\postgresql-9.6.2\src\tools\msvc>perl install.pl f:\pg962
Installing version 9.6 for debug in f:\pg962
Copying build output files......................................................
..........................................................................
Copying config files......
Copying Import libraries...
Copying contrib data files......................................................
................................................................................
...........................................................................
Copying Public headers......
Copying Libpq headers..
Copying Libpq internal headers..
Copying Internal headers...
Copying Server headers....
Copying Grammar header.
......................
Copying PL/pgSQL header.
復制了 63 個文件
復制了 1 個文件
復制了 78 個文件
復制了 33 個文件
復制了 9 個文件
復制了 1 個文件
復制了 48 個文件
復制了 6 個文件
復制了 2 個文件
復制了 7 個文件
復制了 13 個文件
復制了 1 個文件
復制了 19 個文件
復制了 25 個文件
復制了 21 個文件
復制了 41 個文件
復制了 2 個文件
復制了 10 個文件
復制了 5 個文件
復制了 14 個文件
復制了 7 個文件
復制了 34 個文件
復制了 50 個文件
復制了 6 個文件
復制了 7 個文件
復制了 77 個文件
Copying ECPG headers...............
Copying ECPG informix headers...
Copying timezone names..........
Copying timezone sets...
Copying BKI files...
Copying SQL files..
Copying Information schema data.
Generating conversion proc script...
Generating timezone files...
Generating tsearch script..................
Copying Stopword files..............
Copying Dictionaries sample files.........
Copying PL Extension files...
Installation complete.
F:\postgresql-9.6.2\src\tools\msvc>
4) 初始化數(shù)據(jù)庫
F:\postgresql-9.6.2\src\tools\msvc>cd /d f:\pg962\bin
f:\pg962\bin>initdb.exe -D ../data
The files belonging to this database system will be owned by user "Administrator
".
This user must also own the server process.
The database cluster will be initialized with locale "Chinese (Simplified)_Peopl
e's Republic of China.936".
Encoding "GBK" implied by locale is not allowed as a server-side encoding.
The default database encoding will be set to "UTF8" instead.
initdb: could not find suitable text search configuration for locale "Chinese (S
implified)_People's Republic of China.936"
The default text search configuration will be set to "simple".
Data page checksums are disabled.
creating directory ../data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... windows
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
"pg_ctl" -D "../data" -l logfile start
f:\pg962\bin>
5) 啟動數(shù)據(jù)庫
f:\pg962\bin>pg_ctl.exe -D "../data" -l logfile start
server starting
pg數(shù)據(jù)庫已經(jīng)編譯安裝并運行起來了,可以正常使用.
執(zhí)行select version();查看下版本
f:\pg962\bin>psql postgres
psql (9.6.2)
Type "help" for help.
postgres=# \du
List of roles
Role name | Attributes | Me
mber of
---------------+------------------------------------------------------------+---
--------
Administrator | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
postgres=# select version();
version
-------------------------------------------------------------
PostgreSQL 9.6.2, compiled by Visual C++ build 1800, 64-bit
(1 row)
postgres=#
問題解答:
裝上后再跑執(zhí)行 perl build.pl報如下錯誤: Unable to determine Visual Studio version: The nmake version could not be determined. at src/tools/msvc/Mkvcbuild.pm line 86. 這是perl腳本中不能正常識別vs版本造成,該問題歷史悠久,不知道pg為什么不修復,要修正很簡單,打開msvc目錄中 VSObjectFactory.pm文件,把該文件最下面的 DetermineVisualStudioVersion 函數(shù)中 if ($output =~ /(\d+)\.(\d+)\.\d+(\.\d+)?$/m) 這行改成if ($output =~ /(\d+)\.(\d+)\.\d+(\.\d+).*$/m) ,實際就是將 ? 改成.* 即可。
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。