【发布时间】:2017-08-03 11:18:19
【问题描述】:
我正在使用MinGW 按照http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/ACE-INSTALL.html#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_ROOT环境变量,指向ACE wrappers 源码树的根目录: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 -
在
MSYSshell 中,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 进行应用程序开发。而且我只能找到 MinGw 32 位版本的 QT 构建。这就是为什么我选择 MinGW 32 位来构建 ACE。
【问题讨论】:
-
您可能需要自己多研究一下。你有很多从源代码编译 C++ 代码的经验吗?您使用哪个版本的 MingW 和哪个版本的 GCC?其次,您确定要报告第一个重大错误吗?您可能错过了更早的错误,这些错误可以解释第二个错误。调试构建日志中的第二个或七十秒错误是没有意义的。您可以将 make 的输出重定向到日志文件并将其粘贴到 pastebin 然后查看。
-
我们每天使用 MinGW-64 编译 ACE(参见 mingw-w64.org/doku.php),没有错误。请提供有关哪个 ACE 版本、哪个 MinGW、如何配置等详细信息。
-
可能你有一个非常新的mingw版本,
g++ --version的输出是什么?尝试将#define ACE_HAS_POSIX_TIME 1添加到 ace/config.h 文件的顶部。 -
g++ --version输出g++ (x86_64-posix-sjlj, built by strawberryperl.com project) 4.9.2。 -
TCPU = genericin platform_macros.GNU 可能会有所帮助