I am building Adaptive Communication Environment (ACE) 6.4.2 using MinGW
following steps in http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/ACE-INSTALL.html#mingw . I use Windows10 64 bit Operating system. I am very new to building C++ projects.
I installed MinGW from https://sourceforge.net/projects/mingw/files/ . I believe it is a 32 bit version. I used MinGW installation Manager to download all packages.
I downloaded ACE 6.4.2 from http://download.dre.vanderbilt.edu/ and extracted to E:/dependencies/ACE-6.4.2
The root level folder structure of MinGW
is shown below.
I include E:/dependencies/MinGW/bin and E:/dependencies/MinGW/msys/1.0/bin to system variable path
.
I did the following steps:
Open a MSYS shell
. Set PATH
environment variable to MinGW's bin directory:
export PATH=/e/dependencies/MinGW/bin:$PATH
Added ACE_ROOT
environment variable pointing to the root of ACE wrappers source tree:
export ACE_ROOT=/e/dependencies/ACE-6.4.2/ACE_wrappers
Created a file called config.h
in the $ACE_ROOT/ace
directory that contains: #include "ace/config-win32.h"
Created a file called platform_macros.GNU
in the $ACE_ROOT/include/makeinclude
directory containing:
include $(ACE_ROOT)/include/makeinclude/platform_mingw32.GNU INSTALL_PREFIX=/e/dependencies/ACE-6.4.2-install
In the MSYS
shell,
cd $ACE_ROOT/ace make
What I have been understood is that g++
within MinGW
will be used.
And the error log
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
Ultimately, I have to use QT Creator for application development using ACE. And I could find only MinGw 32 bit versions of QT build. That is why I choose MinGW 32 bit for building ACE.
I encountered the same problem with timespec
redefinition. I'm using tdm-gcc-5.1.0-3
with git-bash
. In my case, the problem is that timespec
is defined in both pthread.h
and ace/os_include/os_time.h
. One way to solve it is to edit 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"
An approach to use HAVE_STRUCT_TIMESPEC
didn't work in my case. In general, it is not a good solution .
If you are using mingw
+ msys
both installed from mingw-get
, then you'll get timespec
defined in time.h
. Solution is similar:
// 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"
If it doesn't help, take a look at ace/os_include/os_time.h
. You may find particular macro suitable for your problem.
As a side note, I'm getting link error when using tdm
and git-bash
. It looks quite strange, I don't yet know why it's happening. For example,
for 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
for ACE-6.4.0
:
g++.exe: error: .shobj/Filecac: No such file or directory
for ACE-6.4.6
:
g++.exe: error: .shobj/Co: No such file or directory
While mingw
and msys
provide successful build.
I have done exactly the same thing and encountered the same error. I understand it is an open source. However, the instruction needs to be updated or at least specifies the versions that are used to make the build. Adding "#define ACE_HAS_POSIX_TIME 1" in the config.h file does fix the error. The struct timespec is defined in mingw/include/time.h. (my g++.exe is at version 6.3.0). If ACE_HAS_POSIX_TIME is not defined, then $ACE_ROOT/ace/os_include/os_time.h will try to define it again, hence the error comes.
You can follow the error message, in your example:
ace/os_include/os_time.h:56:16: error: redefinition of 'struct timespec'
typedef struct timespec
If you open the file at that line, the typedef will be surrounded by an #if defined XXX macro, from which you can see that you need to define or undef XXX. For my, kind of similar issues for example I had to modify my config.h the following way:
#define ACE_HAS_POSIX_TIME 1
#define ACE_LACKS_TIMESPEC_T 1
#include "ace/config-win32.h"
#undef ACE_LACKS_CLOCKID_T
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.