(1)  gzip -d ACE-6.0.0.tar.gz

    解压缩后得到文件 ACE-6.0.0.tar

(2)  tar -xvf ACE-6.0.0.tar

解包后,生成了子目录ACE_wrappers

 

1、  设置环境变量

执行命令pwd得到当前工作目录的路径

export ACE_ROOT=$HOME/ACE_wrappers

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${ACE_ROOT}/build/ace/.libs

2、  添加配置文件

cd /home/ACE_wrappers/ace/

cp ./config-aix-5.x.h ./config.h

cd ../include/makeinclude/

ln -s platform_aix_ibm.GNU platform_macros.GNU

 

3、  ACE_wrappers下创建build子目录

mkdir build

cd build

4、  执行configure

../configure –prefix=${HOME}/sdk/ACE

 

Configure会自动生成Makefile文件

 

5、  修改Makefile文件,只编译ace

81DIST_SUBDIRS = ace ACEXML ASNMP apps bin netsvcs examples \

performance-tests tests protocols websvcs Kokyu

     只保留ace,删除后面的ACEXML等。

300行还有一处

SUBDIRS = ace ACEXML ASNMP apps bin netsvcs $(am__append_1) \

$(am__append_2) protocols websvcs Kokyu

 

6、  用命令makeBuild ACE

编译完成的库位于:${ACE_ROOT}/build/ace/.libs下。

文件名:libACE-6.0.0.solibACE.a

7、  建立一个测试目录,键入测试程序和Makefile

(1)    mkdir test1

(2)    cd test1

(3)    创建test1.cpp文件

#include <stdio.h>

#include "ace/Log_Record.h"

#include "ace/Log_Msg.h"

 

int main()

{

  printf("Hello world!\n");

  ACE_DEBUG((LM_ERROR, "This is my first Log!\n"));

}

(4)    创建Makefile

all:test1

 

test1:test1.o

  g++ -o test1 test1.o -L${ACE_ROOT}/build/ace/.libs/ -lACE

 

test1.o: test1.cpp #

  g++ -c -o test1.o -I${ACE_ROOT} test1.cpp

 

clean:

  rm -f test1 *.o

 

8、  编译执行

键入命令make开始编译执行。生成可执行文件test1

执行./test1可以得到正确的输出。

Hello world!

This is my first Log!

9、  至此安装测试完成