On Sun, 30 Apr 2017, Marc Glisse wrote: > On Sun, 30 Apr 2017, David Gressett wrote: >> On Sun, 30 Apr 2017, Marc Glisse wrote: >> >> >>> On Sun, 30 Apr 2017, David Gressett wrote: >>> >>>> I'm working on getting the 32-bit MinGW platform on Windows updated >>>> to a newer gcc than the gcc 5.3.0 thst is provided by the 32-bit >>>> MinGW installer Iwas able to build gcc 5.4.0 and 6.3.0 with only >>>> minor\difficulties, but the 7.0.1 release candidates do not build. >>>> >>>> The problem occurs when xgcc attempts to compile this: >>>> >>>> libstdc++-v3/libsupc++/new_opa.cc >>> >>> The error messages are as follows: ... snip ... >> >> #include <malloc.h> has no effect. >Well, at this point, since you are the one with access to your system, >it is your job to find out where _aligned_malloc is declared, protected by >what flags, and most importantly what differs between the compilation of > new_opa.cc (see the command before the error message in the output of >make) and the test in libstdc++'s configure that determined that it could >define _GLIBCXX_HAVE__ALIGNED_MALLOC (see config.log in the right directory). I have solved the problem. Using #include <malloc.h> is necessary, but in the malloc.h provided by the 32-bit MinGW, _aligned_malloc is protected by #if __MSVCRT_VERSION__ >= 0x0700, and is not available by default. The MinGW 32-bit malloc.h does, however, provide an alternative that is not trapped inside the __MSVCRT_VERSION__ prison. This is __mingw_aligned_malloc I replaced the reference to __aligned_malloc with __mingw_aligned_malloc and new_opa.cc then compiled with no problems. The success immediately was followed by a similar failure with del_opa.cc, which had a similar fix: #include <malloc.h> and the use of __mingw_aligned_free. I could not discover how libstdc++'s configure determined that _aligned_malloc was available. It did so by compiling small test program that it did not preserve. The build is now proceeding, I expect that is will take at least as long as my 6.3.0 build, which took 6 hours on the same computer. If no other problems occur, I will submit a problem report to the gcc Bugzilla that contains a patch.