在Window下編譯OpenH323(上)編譯PWLib

前言:
        本文只提供VC6.0的編譯說明,如果想知道VC.Net下的編譯過程請參看原文。
原文 :
         http://www.voxgratia.org/docs/pwlib_windows.html#msvc_headers

作者 :Craig Southeren
翻譯  : Richard
原文更新日期:2004年11月16日


正文:

1.簡介
  在OpenH323.org上所寫的 在windows下編譯PWLib的過程是非常簡單的。而這篇文章提供了非常詳細的用VC6.0編譯PWLib的過程。(原文還提供了VS.net2003下的編譯過程,因爲沒有用過VC.net,所以這裏不提供說明)

2.先決條件
  如果你準備編譯PWLib源代碼你必須先有以下幾個條件:
  a.VC6.0
  b.PWLib源代碼。
  c.一個解壓程序,比如說Winzip

3.下載和安裝PWLib源代碼
  你從[url=http://sourceforge.net/project/showfiles.php?group_id=80674]這裏[/url]或者從CVS上下載,然後解壓到install/PWLIB

4.編譯前的準備
  在編譯PWlib之前有許編譯工作,一但你完全這些工作之後,再編譯它進就不再需要了。

 4a.安裝GNU bison
     GNU bison工具是編譯PWLib所必須的.而GNU flex 並不是所有的人需要,除非你想重新編譯"asnparser"工具(asnparser是用來改變OpenH323提供的ASN文件的).
     [url=http://www.voxgratia.org/bin/flexbison.zip]這裏[/url]提供這兩個工具的預編譯版本。下面是工具的安裝步驟:
     解壓這2個預編譯工具在"C:/"下(或者你選擇的目錄),這樣就會創建"C:/Tools"這個目錄,並在這個目錄下有"FLEX.EXE"和"BISON.EXE"兩個文件,並在"C:/TOOLS/SHARE"目錄下有"BISON.SIMPLE"和"BISON.HAIRY".

重要提示:
       你可以安裝bison到除C:/Tools以外的別的目錄中,但是如果目錄名中存在空格的話就會出現問題。除非你確信你能正確的做到所有的事情,否剛不要設置像"C:/Documents and Settings" 這樣的目錄名。
    。在VC6.0裏面,從Tool菜單中選擇Options,然後把C:/Tools中到可執行的目錄下面。
     

    4b.檢查VC頭文件
   在VC6.0中對STL支持的頭文件有許多缺陷。這些缺陷對那些依賴於全局靜態變量的正確行爲的程序是足以致命的。幸運的是,STL的作者爲MSVC新發布的文件正確的解決了大多數的問題。
    PWLib所在的程序會檢查機器中所安裝的VC6.0的頭文件,並升級他所需的。爲了運行這個程序,你必須先找到installdir/MSVC_UPGRADE.BAT 並運行它。如果你的機器中沒有找到這個,你可以從[url=http://www.voxgratia.org/releases/msvc6chk.zip]這裏[/url]下載。然後用命令" msvc6chk upgrad"運行msvc6chk程序。
   然後,你將看到類似下面的屏幕:
   PWLIB File Upgrader v1.0
     Copyright (C) 2004 by Post Increment

     WARNING: the following file requires upgrading:
     C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/XTREE

     The files presented here are copyright ? 1995-2000 by P.J. Plauger.
     All rights reserved. They are for use only in conjunction with a valid
     license for Microsoft Visual C++ V5.0 or V6.0. Microsoft Corporation is in
     no way involved with the production or release of these files. The files are
     offered on an `as is" basis. DINKUMWARE, LTD. AND P.J. PLAUGER MAKE NO
     REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THESE FILES, EITHER
     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
     DINKUMWARE, LTD. AND P.J. PLAUGER SHALL NOT BE LIABLE FOR ANY DAMAGES
     SUFFERED BY LICENSEE AS A RESULT OF USING THESE FILES.

     Upgrade file (y/n) ?

    按"Y"升級MSVC的頭文件,接着下面的屏幕會出現:
  Upgrade file (y/n) ? y
    The following files have been upgraded
    C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/XTREE
    The previous version of the file has been renamed to
     C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/XTREE.backup

在升級的過程中,你將被問到,很多次是否升級,我們的建義是如果你沒有什麼很好的理由,請全部升級它們。
如果文件已經升級,你將會看到:
    PWLIB File Upgrader v1.0
   Copyright (C) 2004 by Post Increment
   C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/XTREE already upgraded
    Press any key to continue . . .

如果想知道更多的關於升級的信息,請看http://www.dinkumware.com/vc_fixes.html。

5.配製目錄
從"Tool"菜單中選擇"Option",然後按下面的要求設置目錄:
。將insallDir/PWLib/include加入Include directory
。將installDir/PWlib/LIB加入Executable directory
。將installDir/PWlib/Lib加入Library directory

6.安裝可選的文件。
   PWlib的創建過程中會自動尋找系統所安裝的文件。在你開始建立PWLib工程前,你可以選擇你以下的文件包進行安裝。
   OpenSSL, OpenLDAP, expat, SDL, IPV6,MicroSoft Speech API, DNS resolver

7.編譯
  不管你怎麼設置的環境,有3個不同的工程你需要建立(不管是debug版或Release版)
   工程名                                  描述                      Debug版               Release版
  console                                    PWlib的基本靜態庫            ptlibsd.lib                    ptlibs.lib
   console Components               包含PWlib庫                  ptclibd.lib                     ptclib.lib
   PTLib                                        包含PWlib庫                  ptlidb.lib&ptlibd.dll       ptlib.lib&ptlib.dll

    靜態庫可以獨立編譯,但是要建立DLL需要先建立“MERGESYM"工具。

編譯步驟:
1. 打開 installdir/PWLIB/PWLIB.DSW
2. 在Workspace中選擇"File View"
3. 在Build toolbar中選擇編譯類型"Win32 Release" 或者"Win32 Debug"。
4. 右鍵點擊"Console files" ,然後從菜單中選擇"Build"建立ptlibs.lib。
 
5.接着會出現以下的顯示(由於欠的環境配製會有所不同)
       --------------------Configuration: Console - Win32 Release--------------------
Configuring Build Options
PWLIB File Upgrader v1.0
Copyright (C) 2004 by Post Increment
C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/XTREE already upgraded
Located Open LDAP at D:/openldap/
Located Expat XML at D:/expat/
Located Speech API at D:/Program Files/Microsoft Speech SDK 5.1/
Searching C:/
Located DNS Resolver at C:/Program Files/Microsoft Visual Studio/VC98/
Searching D:/
Located Cyrus SASL at D:/cyrus-sasl-2.1.12/
Located Open SSL at D:/openssl-0.9.7/
Searching E:/
Byte Order set to PLITTLE_ENDIAN
Semaphore Support enabled
DNS Resolver enabled
Cyrus SASL enabled
Open LDAP enabled
Open SSL enabled
Expat XML enabled
Speech API enabled
IPv6 Support disabled
QoS Support disabled
Simple DirectMedia Layer disabled
Configuration completed.
Performing Custom Build Step on ../common/getdate.y
../common/getdate.y contains 8 shift/reduce conflicts and 18 reduce/reduce conflicts.
Compiling...
assert.cxx
Compiling...
collect.cxx
contain.cxx
ethsock.cxx

    ...lines deleted....

regexec.c
regfree.c
Generating Code...
Creating library...

ptlibd.lib - 0 error(s), 1 warning(s)

重要提示:
 1. 如果你安裝了Miscrosof Platform SDK, 你也許會看到:
  Compiling...
assert.cxx
C:/Program Files/Microsoft SDK/include/winsock2.h(1218) : error C2061: syntax error : identifier "DWORD_PTR"
C:/Program Files/Microsoft SDK/include/winsock2.h(1262) : error C2146: syntax error : missing ";" before identifier "Key"
C:/Program Files/Microsoft SDK/include/winsock2.h(1262) : error C2501: "ULONG_PTR" : missing storage-class or type specifiers
....

如果發生這種情況,你應該從"Tools"目錄中選擇"Option",然後在include directory中將Platform SDK加到
VC98 inlcude之前:
       

2。如果出現在下面情況:
    --------------------Configuration: Console - Win32 Release--------------------
Configuring Build Options
PWLIB File Upgrader v1.0
Copyright (C) 2004 by Post Increment
WARNING: the following file requires upgrading:
C:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/XTREE
Please run "msvc6chk upgrade" to upgrade this file
Error executing c:/winnt/system32/cmd.exe.

ptlibs.lib - 1 error(s), 1 warning(s)

請重新閱讀第4步

然後像上面那樣,編譯"Console componnets files"。
再編譯"PTLib files "

如果都編譯成功後,你就可以編譯"PWlib files"了。

8。編譯ASNParser
   如果你用的是PWlib1.7/Openh323 1.4以後的程序,或者是Janus patch 4, 你就可以跳過這一步
 (本文提供的下載地址是不用這一步的)
 如果是以前的版本你需要編譯ASNParser,如果你沒有編譯它將會出現以下的錯誤:
  This program cannot be run in DOS mode.
Error executing c:/windows/system32/cmd.exe.

asnparser.exe - 1 error(s), 0 warning(s)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章