在Window下编译OpenH323(上)---------编译PWLib

类别:VC语言 点击:0 评论:0 推荐:
前言:
        本文只提供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中到可执行的目录下面。
      450) {this.resized=true; this.width=450;}" border=0>

    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。
  450) {this.resized=true; this.width=450;}" border=0 resized="true">
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之前:
       450) {this.resized=true; this.width=450;}" border=0>

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)

后记:
   到此,在VC6.0中编译PWlib就完了,原文还有一些更详细的信息。如果你只是编译PWlib,看此文应该把成功编译。但机器要好一点,我在Duron600, 128M的内存上跑了差不多半小时,才编译完。
  祝大家好运。

本文地址:http://com.8s8s.com/it/it240.htm