[英]Does ADAPTIVE Communication Environment (ACE) C++ library has support for iOS and Android?
[英]Building Adaptive Communication Environment (ACE) using MinGW
我正在按照http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/ACE-INSTALL.html#mingw 中的步驟使用MinGW
構建自適應通信環境 (ACE) 6.4.2。 我使用 Windows10 64 位操作系統。 我對構建 C++ 項目很陌生。
我從https://sourceforge.net/projects/mingw/files/安裝了 MinGW。 我相信它是一個 32 位版本。 我使用 MinGW 安裝管理器下載所有包。
我從http://download.dre.vanderbilt.edu/下載了 ACE 6.4.2 並解壓到 E:/dependencies/ACE-6.4.2
我包括 E:/dependencies/MinGW/bin 和 E:/dependencies/MinGW/msys/1.0/bin 到系統變量path
。
我做了以下步驟:
打開一個MSYS shell
。 將PATH
環境變量設置為 MinGW 的 bin 目錄:
export PATH=/e/dependencies/MinGW/bin:$PATH
添加了指向 ACE 包裝器源代碼樹根的ACE_ROOT
環境變量:
export ACE_ROOT=/e/dependencies/ACE-6.4.2/ACE_wrappers
在$ACE_ROOT/ace
目錄中創建了一個名為config.h
的文件,其中包含: #include "ace/config-win32.h"
在$ACE_ROOT/include/makeinclude
目錄中創建了一個名為platform_macros.GNU
的文件,其中包含:
include $(ACE_ROOT)/include/makeinclude/platform_mingw32.GNU INSTALL_PREFIX=/e/dependencies/ACE-6.4.2-install
在MSYS
外殼中,
cd $ACE_ROOT/ace make
我所了解的是,將使用MinGW
中的g++
。
和錯誤日志
make[3]: Entering directory 'e:/dependencies/ACE-6.4.2/ACE_wrappers/ace'
GNUmakefile: /e/dependencies/ACE-6.4.2/ACE_wrappers/ace/GNUmakefile.ACE MAKEFLAGS=w
g++ -Wnon-virtual-dtor -O3 -g -mthreads -mtune=pentiumpro -fno-strict-aliasing -Wall -W -Wpointer-arith -pipe -DACE_HAS_CUSTOM_EXPORT_MACROS=0 -Wno-unknown-pragmas -Ie:/dependencies/ACE-6.4.2/ACE_wrappers -DACE_NO_INLINE -I.. -DACE_BUILD_DLL -c -o .shobj/Local_Name_Space.o Local_Name_Space.cpp
In file included from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/os_include/os_sched.h:25:0,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/OS_NS_Thread.h:30,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Thread_Mutex.h:29,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Log_Category.h:18,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Malloc.h:22,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Malloc_T.h:16,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Local_Name_Space.h:18,
from Local_Name_Space.cpp:1:
e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/os_include/os_time.h:56:16: error: redefinition of 'struct timespec'
typedef struct timespec
^
In file included from e:\dependencies\mingw\include\sys\time.h:3:0,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/os_include/sys/os_time.h:28,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/os_include/sys/os_resource.h:25,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/os_include/sys/os_wait.h:26,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/os_include/os_stdlib.h:27,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Basic_Types.h:54,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Log_Msg.h:26,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Log_Category.h:17,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Malloc.h:22,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Malloc_T.h:16,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Local_Name_Space.h:18,
from Local_Name_Space.cpp:1:
e:\dependencies\mingw\include\time.h:102:8: error: previous definition of 'struct timespec'
struct timespec
^
In file included from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Local_Name_Space_T.cpp:15:0,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Local_Name_Space_T.h:259,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Local_Name_Space.h:126,
from Local_Name_Space.cpp:1:
e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/OS_NS_unistd.h:322:45: warning: 'useconds_t' is deprecated [-Wdeprecated-declarations]
useconds_t interval = 0);
^
In file included from e:\dependencies\mingw\include\wchar.h:66:0,
from e:\dependencies\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:44,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/ace_wchar.h:43,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/config-lite.h:33,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/ACE_export.h:10,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Malloc.h:16,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Malloc_T.h:16,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Local_Name_Space.h:18,
from Local_Name_Space.cpp:1:
e:\dependencies\mingw\include\sys\types.h:221:23: note: declared here
typedef unsigned long useconds_t __MINGW_ATTRIB_DEPRECATED;
^
In file included from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Local_Name_Space_T.cpp:15:0,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Local_Name_Space_T.h:259,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Local_Name_Space.h:126,
from Local_Name_Space.cpp:1:
e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/OS_NS_unistd.h:322:45: warning: 'useconds_t' is deprecated [-Wdeprecated-declarations]
useconds_t interval = 0);
^
e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/OS_NS_unistd.h:322:45: warning: 'useconds_t' is deprecated [-Wdeprecated-declarations]
e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/OS_NS_unistd.h:326:78: warning: 'useconds_t' is deprecated [-Wdeprecated-declarations]
const ACE_Time_Value &tv_interval = ACE_Time_Value::zero);
^
In file included from e:\dependencies\mingw\include\wchar.h:66:0,
from e:\dependencies\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:44,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/ace_wchar.h:43,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/config-lite.h:33,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/ACE_export.h:10,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Malloc.h:16,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Malloc_T.h:16,
from e:/dependencies/ACE-6.4.2/ACE_wrappers/ace/Local_Name_Space.h:18,
from Local_Name_Space.cpp:1:
e:\dependencies\mingw\include\sys\types.h:221:23: note: declared here
typedef unsigned long useconds_t __MINGW_ATTRIB_DEPRECATED;
^
e:/dependencies/ACE-6.4.2/ACE_wrappers/include/makeinclude/rules.local.GNU:188: recipe for target '.shobj/Local_Name_Space.o' failed
make[3]: *** [.shobj/Local_Name_Space.o] Error 1
make[3]: Leaving directory 'e:/dependencies/ACE-6.4.2/ACE_wrappers/ace'
GNUmakefile:45: recipe for target 'ACE' failed
make: *** [ACE] Error 2
最終,我必須使用 QT Creator 使用 ACE 進行應用程序開發。 而且我只能找到 QT 構建的 MinGw 32 位版本。 這就是為什么我選擇 MinGW 32 位來構建 ACE。
我在重新定義timespec
遇到了同樣的問題。 我正在使用tdm-gcc-5.1.0-3
和git-bash
。 就我而言,問題是timespec
在pthread.h
和ace/os_include/os_time.h
中都定義了。 解決它的一種方法是編輯ace/config.h
:
// Get 'timespec' explicitly from here.
#include <pthread.h>
// Tell ACE to do not declare 'timespec'.
#define ACE_HAS_POSIX_TIME 1
// Tell ACE to declare 'timespec_t' alias.
#define ACE_LACKS_TIMESPEC_T 1
// Default windows config, see ACE install manual.
#include "ace/config-win32.h"
使用HAVE_STRUCT_TIMESPEC
的方法在我的情況下不起作用。 一般來說,這不是一個好的解決方案。
如果您使用從mingw-get
安裝的mingw
+ msys
,那么您將獲得time.h
定義的timespec
。 解決方法類似:
// Tell ACE to do not declare 'timespec'.
#define ACE_HAS_POSIX_TIME 1
// Tell ACE to declare 'timespec_t' alias.
#define ACE_LACKS_TIMESPEC_T 1
// Default windows config, see ACE install manual.
#include "ace/config-win32.h"
如果沒有幫助,請查看ace/os_include/os_time.h
。 您可能會找到適合您問題的特定宏。
作為旁注,我在使用tdm
和git-bash
時出現鏈接錯誤。 看起來很奇怪,我還不知道為什么會這樣。 例如,
對於ACE-6.3.2
:
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: cannot find .: Permission denied
collect2.exe: error: ld returned 1 exit status
對於ACE-6.4.0
:
g++.exe: error: .shobj/Filecac: No such file or directory
對於ACE-6.4.6
:
g++.exe: error: .shobj/Co: No such file or directory
而mingw
和msys
提供了成功的構建。
我做了完全相同的事情並遇到了同樣的錯誤。 我知道這是一個開源。 但是,該指令需要更新或至少指定用於進行構建的版本。 在 config.h 文件中添加“#define ACE_HAS_POSIX_TIME 1”確實修復了錯誤。 struct timespec 在 mingw/include/time.h 中定義。 (我的 g++.exe 版本為 6.3.0)。 如果 ACE_HAS_POSIX_TIME 沒有定義,那么 $ACE_ROOT/ace/os_include/os_time.h 將嘗試重新定義它,因此錯誤來了。
您可以按照錯誤消息,在您的示例中:
ace/os_include/os_time.h:56:16: error: redefinition of 'struct timespec'
typedef struct timespec
如果在該行打開文件,typedef 會被#if defined XXX宏包圍,從中可以看出需要define 或undef XXX。 對於我的類似問題,例如,我必須按以下方式修改我的 config.h:
#define ACE_HAS_POSIX_TIME 1
#define ACE_LACKS_TIMESPEC_T 1
#include "ace/config-win32.h"
#undef ACE_LACKS_CLOCKID_T
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.