使用 CentOS 6 编译 ACE/TAO 1.2 库

Compiling ACE/TAO 1.2 libraries with CentOS 6

我在一台装有 g++ 4.4.7 的 64 位 CentOS 6.7 机器上,我正在尝试编译用 g++ 2.96 编译的 ACE TAO library 1.2

当我尝试使用 g++ 版本 4.4.7 进行编译时,出现以下错误(更完整的输出 here

g++ -W -Wall -Wpointer-arith -pipe -O3 -g -Wno-uninitialized -fno-implicit-templates   -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT   -I/home/oscarpelaoo/Downloads/ACE_wrappers -DACE_HAS_EXCEPTIONS  -c -fPIC -o .shobj/URL_Addr.o URL_Addr.cpp
In file included from /home/oscarpelaoo/Downloads/ACE_wrappers/ace/ACE.h:17,
                 from /home/oscarpelaoo/Downloads/ACE_wrappers/ace/INET_Addr.h:17,
                 from URL_Addr.h:20,
                 from URL_Addr.cpp:3:
/home/oscarpelaoo/Downloads/ACE_wrappers/ace/OS.h:3110:27: error: new.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/backward/strstream:47,
                 from /home/oscarpelaoo/Downloads/ACE_wrappers/ace/streams.h:70,
                 from /home/oscarpelaoo/Downloads/ACE_wrappers/ace/OS.h:3197,
                 from /home/oscarpelaoo/Downloads/ACE_wrappers/ace/ACE.h:17,
                 from /home/oscarpelaoo/Downloads/ACE_wrappers/ace/INET_Addr.h:17,
                 from URL_Addr.h:20,
                 from URL_Addr.cpp:3:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/backward/backward_warning.h:28:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated.
In file included from /home/oscarpelaoo/Downloads/ACE_wrappers/ace/OS_TLI.h:191,
                 from /home/oscarpelaoo/Downloads/ACE_wrappers/ace/OS.h:38,
                 from /home/oscarpelaoo/Downloads/ACE_wrappers/ace/ACE.h:17,
                 from /home/oscarpelaoo/Downloads/ACE_wrappers/ace/INET_Addr.h:17,
                 from URL_Addr.h:20,
                 from URL_Addr.cpp:3:
/home/oscarpelaoo/Downloads/ACE_wrappers/ace/OS_TLI.inl: In static member function ‘static int ACE_OS_TLI::t_accept(ACE_HANDLE, ACE_HANDLE, t_call*)’:
/home/oscarpelaoo/Downloads/ACE_wrappers/ace/OS_TLI.inl:12: warning: the address of ‘call’ will never be NULL
/home/oscarpelaoo/Downloads/ACE_wrappers/ace/OS_TLI.inl:13: warning: the address of ‘reshandle’ will never be NULL
/home/oscarpelaoo/Downloads/ACE_wrappers/ace/OS_TLI.inl:14: warning: the address of ‘handle’ will never be NULL
/home/oscarpelaoo/Downloads/ACE_wrappers/ace/OS_TLI.inl: In static member function ‘static char* ACE_OS_TLI::t_alloc(ACE_HANDLE, int, int)’:

经过一些研究,我发现 Red Hat 为 CentOS 6 here 提供了一些旧的 libstdc++ 库。

是否可以使用旧版本的 g++ 2.96,我认为它不支持 64 位,或者我可以以某种方式使用 g++ 4.4.7 的兼容性工具来尝试实现某些目标吗?

回答我自己的 post 因为我能够安装它。

安装相关的 32 位库后,需要添加 -m32 标志。然后我们需要添加一个 -DACE_LACKS_NEW_H 标志,因为我的系统不包含 <new.h> 文件。之后我只需要添加一个前向声明并编译库。