ACE在Linux下编译安装

下载地址: http://download.dre.vanderbilt.edu/


ACE版本:ACE-6.2.2.tar.bz2


下载完成后解压路径为:/root/ACE/ACE_wrappers


设置环境变量

    vi .bashrc,添加的内容为:

export ACE_ROOT=/root/ACE/ACE_wrappers
export MPC_ROOT=$ACE_ROOT/MPC
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ACE_ROOT/ace:$ACE_ROOT/lib:/usr/local/lib
    保存后执行:

source .bashrc


编译ACE:

1.选择平台配置文件,本系统应该选择config-linux.h,进入$ACE_ROOT/ace,执行命令:

 cp config-linux.h config.h

2.选择平台宏定义文件,本系统选择platform_linux.GNU,在$ACE_ROOT/include/makeinclude 目录下新建 
platform_macros.GNU,但是该目录下面有platform_macros.GNU:

[root@vm makeinclude]# ll platform_macros.GNU
lrwxrwxrwx 1 root root 36 11-06 12:27 platform_macros.GNU -> ../../apps/gperf/platform_macros.GNU
然而../../apps/gperf/platform_macros.GNU不存在,即执行下面命令:

cp /root/ACE/ACE_wrappers/include/makeinclude/platform_linux.GNU /root/ACE/ACE_wrappers/apps/gperf/platform_macros.GNU

3.进入$(ACE_ROOT)/ace/, 输入编译命令:make -f GNUmakefile, 开始编译libACE.so和libACE.so.6.2.2


Linux使用ACE编程:

我写个简单的Hello World!的程序
1.新建个hello.cpp的文件:

#include "ace/Log_Msg.h"
int ACE_TMAIN(int argc, int argv[])
{
    ACE_DEBUG((LM_DEBUG, ACE_TEXT("Hello World!\n")));
    return 0;
}


2.创建hello.mpc文件:
project(hello) : aceexe{
exename = hello
Source_Files{
hello.cpp
}
Header_Files{
}
}


3.使用MPC实用工具生成Makefile。再创建一个可执行文件hc,可执行文件hc的文件内容为:
$ACE_ROOT/bin/mpc.pl -type make hello.mpc


4.运行hc后,产生Makefile.hello后,运行make -f Makefile.hello 生成hello的可执行文件

5.运行:

[root@vm ~]# ./hello
Hello World!

posted on 2013-11-06 13:55  胡永光  阅读(2331)  评论(0编辑  收藏  举报

导航