利用postgresql(PG9.1.1)源碼搭建win32調試環境

把以前寫的東西,在這裏整理一下,順便根據新代碼做些調整。

PG源碼

網站:www.Postgresql.org

 

文件夾:E:\PG\01-源碼\postgresql-9.1.1.tar.bz2

 

解壓到:E:\PG\PostgreSQL

 

解壓後的文件夾:E:\PG\PostgreSQL\postgresql-9.1.1

 

vs2005

自備

 

添加C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727到環境變量PATH

 

set path=%path%;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

 

命令行中,不區分大小寫,但僅限於會話級別有效。

開源工具

可以去下載,下載地址以後補充。

文件夾位置:E:\PG\pgdebug

工具:opensslPerlprogPython24Tcl

 

配置

文件位置:E:\PG\PostgreSQL\postgresql-9.1.1\src\tools\msvc\config_default.pl

 

使用UE打開

# Configuration arguments for vcbuild.

use strict;

use warnings;

 

our $config = {

    asserts=>0,             # --enable-cassert

    # integer_datetimes=>1,   # --enable-integer-datetimes - on is now default

    # float4byval=>1,         # --disable-float4-byval, on by default

    # float8byval=>0,         # --disable-float8-byval, off by default

    # blocksize => 8,         # --with-blocksize, 8kB by default

    # wal_blocksize => 8,     # --with-wal-blocksize, 8kB by default

    # wal_segsize => 16,      # --with-wal-segsize, 16MB by default

    ldap=>1,                      # --with-ldap

    nls=>undef,                   # --enable-nls=<path>

    tcl=>'E:\PG\pgdebug\tcl',                     # --with-tls=<path>

    perl=>'E:\PG\pgdebug\perl',              # --with-perl

    python=>'E:\PG\pgdebug\Python24',             # --with-python=<path>

    krb5=>'E:\PG\pgdebug\prog\pgsql\depend\krb5',             # --with-krb5=<path>

    openssl=>'E:\PG\pgdebug\openssl',             # --with-ssl=<path>

    #uuid=>undef,                 # --with-ossp-uuid

    xml=>'E:\PG\pgdebug\prog\pgsql\depend\libxml2',                      # --with-libxml=<path>

    xslt=>'E:\PG\pgdebug\prog\pgsql\depend\libxslt',               # --with-libxslt=<path>

    iconv=>'E:\PG\pgdebug\prog\pgsql\depend\iconv',                # (not in configure, path to iconv)

    zlib=>'E:\PG\pgdebug\prog\pgsql\depend\zlib'                   # --with-zlib=<path>

};

 

1;

 

 

配置perl環境變量

set path=E:\PG\pgdebug\Perl\bin;%path%

 

生成

cd /d E:\PG\PostgreSQL\postgresql-9.1.1\src\tools\msvc

perl build.pl DEBUG

 

cd /d E:\PG\PostgreSQL\postgresql-9.1.1\

mkdir main

 

cd /d E:\PG\PostgreSQL\postgresql-9.1.1\src\tools\msvc

perl install.pl E:\PG\PostgreSQL\postgresql-9.1.1\main

 

cd /d E:\PG\pgdebug\prog\pgsql\depend\krb5\bin

copy *.dll E:\PG\PostgreSQL\postgresql-9.1.1\main\bin\

 

cd /d E:\PG\PostgreSQL\postgresql-9.1.1\main\bin

initdb.exe --no-locale pgdb

 

 

詞法文件

修正9個詞法文件,取消其屬性中的執行指令和輸出文件。

src\backend\parser\scan.l

contrib\cube\cubescan.l

src\bin\psql\psqlscan.l

src\interfaces\ecpg\preproc\pgc.l

src\backend\bootstrap\bootscanner.l

src\backend\replication\repl_scanner.l

contrib\seg\segscan.l

src\backend\utils\misc\guc-file.l

src\test\isolation\specscanner.l

 

8個語法文件,做如上處理

src\backend\parser\gram.y
src\backend\bootstrap\bootparse.y
src\backend\replication\repl_gram.y
src\pl\plpgsql\src\gram.y
src\test\isolation\specparse.y
src\interfaces\ecpg\preproc\preproc.y
contrib\cube\cubeparse.y
contrib\seg\segparse.y

 

修正文件

修改下面文件中的代碼,註釋掉該行。

\src\backend\main\main.c 

//check_root(progname);


修改文件屬性

 

調試-->命令參數和工作目錄

-D pgdb

E:\PG\PostgreSQL\postgresql-9.1.1\main\bin

 

鏈接器-->常規-->輸出文件

E:\PG\PostgreSQL\postgresql-9.1.1\main\bin\postgres.exe

調試

 

經過註釋所有詞法和語法文件,可隨意重新生成exe文件。 

 

......

114>stem_ISO_8859_1_danish.c
114>api.c
114>dict_snowball.c
114>Generate DEF file
114>Not re-generating DICT_SNOWBALL.DEF, file already exists.
114>正在鏈接...
114>   正在創建庫 Debug\dict_snowball\dict_snowball.lib 和對象 Debug\dict_snowball\dict_snowball.exp
114>正在嵌入清單...
114>生成日誌保存在“file://e:\PG\PostgreSQL\postgresql-9.1.1\Debug\dict_snowball\BuildLog.htm”
114>dict_snowball - 0 個錯誤,0 個警告
========== 全部重新生成: 114 已成功, 0 已失敗, 0 已跳過 ========== 

 

 

出現調試後臺,即完成目的。



發佈了31 篇原創文章 · 獲贊 7 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章