Centos下完美安装ACE库以及TAO


原文地址:http://blog.sina.com.cn/s/blog_74d98ffe01012h5h.html

CentOS环境下ACE编译指南

1.环境说明:

(1)CentOS6.3

 (2) ACE6.10

2.编译步骤:

(1)定义环境变量:

ACE_ROOT=/root/work/cots/ACE_wrappers;export ACE_ROOT
LD_LIBRARY_PATH=$ACE_ROOT/lib;export LD_LIBRARY_PATH

也可以直接设置到~/.bashrc 中

export ACE_ROOT=***/ACE_wrappers
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ACE_ROOT/ace:$ACE_ROOT/lib
export TAO_ROOT=$ACE_ROOT/TAO

(2)新建config.h

     在ACE_wrappers/ace目录下新建config.h,包含下面一句话:

     #include "ace/config-linux.h"

 (3) 新建platform_macros.GNU

     在ACE_wrappers/include/makefileinclude目录下新建文件          platform_macros.GNU

     包含内容:

include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU

INSTALL_PREFIX = /usr/local

(4)make

(5)make install

3.验证ACE是否成功

进入$ACE_ROOT,然后make,漫长的等待后,没有报错停止的情况下,可以写一个小程序来测试一下,test.cpp:

#include "ace/Log_Msg.h"
             int  ACE_TMAIN( int  arg,ACE_TCHAR  argv[])
{
                            ACE_DEBUG((LM_DEBUG,ACE_TEXT("Hello Ace")));
                         return  0;
}
     编译连接程序,命令:gcc test.cpp -lACE -L $ACE_ROOT/lib 
                                     a.out
完成。

4、安装TAO
      cd $TAO_ROOT
     find . -name "*GNUmakefile*" | xargs rm
     重新生成Makefile文件: 

  $ACE_ROOT/bin/mwc.pl -type gnuace TAO_ACE.mwc
   $make
5. 启动命名服务
参见ACE_wrappers\TAO\docs\tutorials\Quoter\index.html 下文档“TAO's Naming Service”一项:
$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service  -ORBEndpoint iiop://199.3.13.7:12001 -m 1
6.启动事件服务
参见ACE_wrappers\TAO\docs\tutorials\Quoter\index.html 下文档“TAO's COS Event Service”一项:
$TAO_ROOT/orbsvcs/CosEvent_Service/CosEvent_Service
7.启动通知服务
参见ACE_wrappers\TAO\orbsvcs\Notify_Service\README:

$TAO_ROOT/orbsvcs/Notify_Service/Notify_Service -Factory NotifyEventChannelFactory -NameSvc -Channel NotifyEventChannel -ORBRunThreads 1  -ORBEndpoint iiop://199.3.13.7:12002 
8.检查服务运行状况
netstat -an | grep 1200

tcp             0 199.3.13.7:12001            0.0.0.0:*                   LISTEN      
tcp             0 199.3.13.7:12002            0.0.0.0:*                   LISTEN      
tcp             0 199.3.13.7:12001            199.3.13.7:33307            ESTABLISHED 
tcp             0 199.3.13.7:12001            199.3.13.7:33303            ESTABLISHED 
tcp             0 199.3.13.7:33307            199.3.13.7:12001            ESTABLISHED 
tcp             0 199.3.13.7:33303            199.3.13.7:12001            ESTABLISHED 
udp             0 224.9.9.2:12001             0.0.0.0:*               

9.测试
ACE_wrappers/TAO/TAO-INSTALL.html#build一节中描述,To test that the TAO release is properly configured, follow instructions on executing the various examples under $TAO_ROOT/tests. 所以这边就用下面的例子进行测试:
 $TAO_ROOT/orbsvcs/tests
    TAO要求see MPC USAGE document for details on how to generate build files for other compilers and tools.去生成makefile文件,参见\ACE_wrappers\MPC\USAGE文档说明:
     The most common way to use the Make Project Creator is to run the
workspace generator (mwc.pl).  This script will generate projects and a
single workspace that contains the generated projects.  If no input file
(.mwc file) is specified, it will recurse into the directory in which the
script was started.  It looks for .mpc files and generates a project or
projects for each one found.也就是说,通过mwc.pl命令及一个.mwc file的输入文件,就会产生默认的makefile文件,其中也是包括了install的选项。
该段语句说明,执行了“mwc.pl  某个.mwc” 以后,该脚本会搜寻当前及其所有的子目录的 .mpc文件(该文件每个例子中都有),根据此文件生成各个例子的makefile文件(实际为GNUmakefile文件)。
   mvc的文件并不是在每个例子中都有的,在$TAO_ROOT/orbsvcs/tests许多的测试例子里,只有$TAO_ROOT/orbsvcs /tests目录下有一个tests.mwc的文件,在$TAO_ROOT/orbsvcs/tests目录下执行:
        cd  $TAO_ROOT/orbsvcs/tests        
        $ACE_ROOT/bin/mwc.pl     tests.mwc  
        make         

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值