在Slackware 14.2 64位上使用ACE lib编译错误

时间:2018-07-03 14:04:52

标签: c++ linux compilation ace slackware

我正在尝试编译ACE lib,但是编译时出错。

我的Linux系统是Slackware 14.2 64位

该库是ACE 6.1.4版(我需要编译的版本)

在发布此内容之前,我已经按照所有步骤从ACE web构建ACE。

如何编译此库?

这是错误:

In file included from /home/cyneo/Downloads/ACE_wrappers/ace/OS_NS_Thread.h:32,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Guard_T.h:26,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Free_List.cpp:7,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Free_List.h:142,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Malloc_T.h:26,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Local_Name_Space.h:20,
             from Local_Name_Space.cpp:3:
/home/cyneo/Downloads/ACE_wrappers/ace/os_include/os_sched.h:47:6: error: conflicting declaration ‘typedef struct cpu_set_t cpu_set_t’
} cpu_set_t;
  ^~~~~~~~~

In file included from /usr/include/sched.h:44,
             from /usr/include/pthread.h:23,
             from /home/cyneo/Downloads/ACE_wrappers/ace/os_include/os_pthread.h:51,
             from /home/cyneo/Downloads/ACE_wrappers/ace/OS_NS_Thread.h:31,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Guard_T.h:26,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Free_List.cpp:7,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Free_List.h:142,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Malloc_T.h:26,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Local_Name_Space.h:20,
             from Local_Name_Space.cpp:3:
/usr/include/bits/cpu-set.h:42:3: nota: previous declaration as ‘typedef struct cpu_set_t cpu_set_t’
 } cpu_set_t;

In file included from /home/cyneo/Downloads/ACE_wrappers/ace/TSS_T.h:261,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Singleton.h:24,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Service_Gestalt.h:30,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Service_Object.h:27,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Naming_Context.h:25,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Local_Name_Space_T.h:25,
             from /home/cyneo/Downloads/ACE_wrappers/ace/Local_Name_Space.h:128,
             from Local_Name_Space.cpp:3:
/home/cyneo/Downloads/ACE_wrappers/ace/TSS_T.cpp: En la función miembro ‘void ACE_TSS_Guard<ACE_LOCK>::init_key()’:
/home/cyneo/Downloads/ACE_wrappers/ace/TSS_T.cpp:357:39: error: no matching function for call to ‘ACE_Thread::keycreate(ACE_thread_key_t*, void (*)(void*), void*)’
                      (void *) this);
                                   ^
make[1]: *** [/home/cyneo/Downloads/ACE_wrappers/include/makeinclude/rules.local.GNU:189: .shobj/Local_Name_Space.o] Error 1

我已经找到了,但是我无法为我做工作:

https://bugs.gentoo.org/638606

https://638606.bugs.gentoo.org/attachment.cgi?id=532828

编辑:

我也尝试过编译ACE 6.5.0,但出现此错误:

during GIMPLE pass: wrestrict
En la función miembro ‘virtual int ACE_Configuration_Heap::open_section(const ACE_Configuration_Section_Key&, const ACE_TCHAR*, int, ACE_Configuration_Section_Key&)’:
en pp_format, en pretty-print.c:1378
ACE_Configuration_Heap::open_section (const ACE_Configuration_Section_Key& base,

3 个答案:

答案 0 :(得分:1)

最后,我为Slackware 14.2 64位编译了ACE 6.5.0。 它需要在“ ACE_wrappers / include / makeinclude / platform_macros.GNU”中添加一些参数:

INSTALL_PREFIX=/usr 
INSTALL_LIB=lib64
stl=1
gl=1
ssl=1
buildbits=64
dynamic_loader=1
insure=0
optimize=0
static_stdlibs=0
include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU

答案 1 :(得分:1)

我在ACE上遇到了同样的问题,但是没有选择升级它。通过在ace / config.h中添加以下代码并重新编译ACE,我设法解决了冲突的声明问题。

#ifndef __cpu_set_t_defined
#define __cpu_set_t_defined
#endif //!__cpu_set_t_defined

您可能会问为什么这有效?好吧,如果收到此错误,则表示glibc已声明cpu_set_t,但未定义ACE曾期望的__cpu_set_t_defined。因此,ACE也尝试声明cpu_set_t,并发生错误。 因此,通过定义__cpu_set_t_defined,可以告诉ACE不要再次声明__cpu_set_t_defined

但是请记住,这只是一种解决方法,仅当您没有更新ACE的选项时才应使用。

希望这会有所帮助!

答案 2 :(得分:0)

此ACE版本较旧,升级到ACE 6.5.0可以解决此问题。