Slackware 14.2 64 位上的 ACE lib 编译错误

Cyn*_*neo 3 c++ linux compilation slackware ace

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

\n\n

我的Linux系统是Slackware 14.2 64位

\n\n

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

\n\n

在发布本文之前,我已按照从ACE web构建 ACE 的所有步骤进行操作。

\n\n

如何编译这个lib?

\n\n

这是错误:

\n\n
In file included from /home/cyneo/Downloads/ACE_wrappers/ace/OS_NS_Thread.h:32,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Guard_T.h:26,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Free_List.cpp:7,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Free_List.h:142,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Malloc_T.h:26,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Local_Name_Space.h:20,\n             from Local_Name_Space.cpp:3:\n/home/cyneo/Downloads/ACE_wrappers/ace/os_include/os_sched.h:47:6: error: conflicting declaration \xe2\x80\x98typedef struct cpu_set_t cpu_set_t\xe2\x80\x99\n} cpu_set_t;\n  ^~~~~~~~~\n\nIn file included from /usr/include/sched.h:44,\n             from /usr/include/pthread.h:23,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/os_include/os_pthread.h:51,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/OS_NS_Thread.h:31,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Guard_T.h:26,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Free_List.cpp:7,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Free_List.h:142,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Malloc_T.h:26,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Local_Name_Space.h:20,\n             from Local_Name_Space.cpp:3:\n/usr/include/bits/cpu-set.h:42:3: nota: previous declaration as \xe2\x80\x98typedef struct cpu_set_t cpu_set_t\xe2\x80\x99\n } cpu_set_t;\n\nIn file included from /home/cyneo/Downloads/ACE_wrappers/ace/TSS_T.h:261,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Singleton.h:24,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Service_Gestalt.h:30,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Service_Object.h:27,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Naming_Context.h:25,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Local_Name_Space_T.h:25,\n             from /home/cyneo/Downloads/ACE_wrappers/ace/Local_Name_Space.h:128,\n             from Local_Name_Space.cpp:3:\n/home/cyneo/Downloads/ACE_wrappers/ace/TSS_T.cpp: En la funci\xc3\xb3n miembro \xe2\x80\x98void ACE_TSS_Guard<ACE_LOCK>::init_key()\xe2\x80\x99:\n/home/cyneo/Downloads/ACE_wrappers/ace/TSS_T.cpp:357:39: error: no matching function for call to \xe2\x80\x98ACE_Thread::keycreate(ACE_thread_key_t*, void (*)(void*), void*)\xe2\x80\x99\n                      (void *) this);\n                                   ^\nmake[1]: *** [/home/cyneo/Downloads/ACE_wrappers/include/makeinclude/rules.local.GNU:189: .shobj/Local_Name_Space.o] Error 1\n
Run Code Online (Sandbox Code Playgroud)\n\n

我发现了这个,但我无法为我工作:

\n\n

https://bugs.gentoo.org/638606

\n\n

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

\n\n

编辑:

\n\n

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

\n\n
during GIMPLE pass: wrestrict\nEn la funci\xc3\xb3n miembro \xe2\x80\x98virtual int ACE_Configuration_Heap::open_section(const ACE_Configuration_Section_Key&, const ACE_TCHAR*, int, ACE_Configuration_Section_Key&)\xe2\x80\x99:\nen pp_format, en pretty-print.c:1378\nACE_Configuration_Heap::open_section (const ACE_Configuration_Section_Key& base,\n
Run Code Online (Sandbox Code Playgroud)\n

小智 5

我在使用 ACE 时遇到了同样的问题,但无法选择升级它。我通过在 ace/config.h 中添加以下内容并重新编译 ACE 来解决冲突的声明问题。

#ifndef __cpu_set_t_defined
#define __cpu_set_t_defined
#endif //!__cpu_set_t_defined
Run Code Online (Sandbox Code Playgroud)

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

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

希望这可以帮助!