1

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

enter image description here

The root level folder structure of MinGW is shown below. enter image description here

I include E:/dependencies/MinGW/bin and E:/dependencies/MinGW/msys/1.0/bin to system variable path.

I did the following steps:

  1. Open a MSYS shell. Set PATH environment variable to MinGW's bin directory:

    export PATH=/e/dependencies/MinGW/bin:$PATH

  2. 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

  3. Created a file called config.h in the $ACE_ROOT/ace directory that contains: #include "ace/config-win32.h"

  4. 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

  5. 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.

Thara
  • 489
  • 1
  • 8
  • 24
  • You probably need to look into this a bit more yourself. Have you a lot of experience compiling C++ code from sources? What version of MingW are you using with what version of GCC? Secondly, are you sure that you are reporting the first significant error? There may be earlier errors you simply missed that would explain the second error. Debugging the second or seventy second error in a build log is pointless. You could redirect the output of make to a log file and paste it to pastebin and then review. – Warren P Mar 13 '17 at 12:30
  • We compile daily ACE using MinGW-64 (see http://mingw-w64.org/doku.php) without errors. Please provide details about which ACE version, which MinGW, how you configured it, etc. – Johnny Willemsen Mar 13 '17 at 19:08
  • Probably you have a very new mingw version, what is the output of `g++ --version`? Try to add `#define ACE_HAS_POSIX_TIME 1` to the top of the ace/config.h file. – Johnny Willemsen Mar 14 '17 at 07:11
  • `g++ --version` outputs `g++ (x86_64-posix-sjlj, built by strawberryperl.com project) 4.9.2`. – Thara Mar 14 '17 at 08:00
  • Try https://mingw-w64.org/ as alternative compiler, we have much better results with that project – Johnny Willemsen Mar 14 '17 at 09:16
  • Thanks. Will try with `mingw-w64`. – Thara Mar 14 '17 at 09:27
  • I installed msys2 and used mingw64 for building ACE 6.4.2. The make command generates error `CPU you selected does not support x86-64 instruction set`. make[1]: *** [/C/ACE-6.4.2/ACE_wrappers/include/makeinclude/rules.local.GNU:189: .shobj/Local_Name_Space.o] Error 1. The command `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 -I/C/ACE-6.4.2/ACE_wrappers -DACE_NO_INLINE -I.. -DACE_BUILD_DLL -c -o .shobj/Local_Name_Space.o Local_Name_Space.cpp`. – Thara Mar 20 '17 at 11:28
  • 1
    `TCPU = generic` in platform_macros.GNU might help – J.J. Hakala Mar 24 '17 at 09:25

3 Answers3

1

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.

0

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.

wxhou
  • 1
0

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
Zsolt Z.
  • 592
  • 6
  • 17