bugmake - Bugs: bug #57152, Fix WINDOWS32 gcc build


bug #57152: Fix WINDOWS32 gcc build

Submitted by:  Ben <bwijen>
Submitted on:  Sat 02 Nov 2019 09:31:59 AM UTC  
Severity:  3 - Normal Item Group:  Build/Install
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.3 Operating System:  MS Windows
Fixed Release:  4.3 Triage Status:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Thu 26 Dec 2019 10:23:44 AM UTC, comment #6: 

Hi Paul,

Just to let you know: this is in fact working.
(x86_64-w64-mingw32-gcc emits _MINGW64_)



Ben <bwijen>
Wed 18 Dec 2019 04:42:26 PM UTC, comment #5: 

I don't have access to any Windows systems with any version of either cygwin or mingw installed (well, I have Git for Windows installed and it provides some aspects of mingw I believe), nor clang or GCC for windows: all I can test is the simple native MSVC compilation.

So based on your comment, it's likely my fix did not work :(

I'll let Ben check it and see.

Paul D. Smith <psmith>
Project Administrator
Wed 18 Dec 2019 04:06:28 PM UTC, comment #4: 

I don't have MinGW64 installed to try that, but if you tried it and it worked, then I guess it's fine.

The problem with _MINGW64_ is that AFAIK it isn't defined by the compiler, it is in some header file.  So if config.h is included before any MinGW64 header, the macro might not be defined.

What I usually do is this:

#include <_mingw.h>
#ifdef __MINGW32_VERSION
/* mingw.org */
/* MinGW64 */

(Thankfully, __MINGW32_VERSION is not defined in MinGW64.)

But again, if _MINGW64_ works for you, I'm fine with that.

Eli Zaretskii <eliz>
Project Member
Wed 18 Dec 2019 01:03:32 PM UTC, comment #3: 

Oh that's good to know.  I used _MINGW32_ which I guess is not right.  According to my research I guess I should use _MINGW64_ instead.

Paul D. Smith <psmith>
Project Administrator
Wed 18 Dec 2019 11:02:24 AM UTC, comment #2: 

Paul, please note that mingw.org's MinGW does provide the 'd_type' member of struct dirent, unlike MinGW64 which doesn't.  The config.h template is correct for mingw.org, and the change should not be unconditional, it should be conditioned with some MinGW64 specific condition.

Eli Zaretskii <eliz>
Project Member
Tue 17 Dec 2019 08:27:08 PM UTC, comment #1: 

The problem is not compiling with GCC per se, it's compiling with MINGW.

If built for native windows then GNU make provides its own implementation of dirent which DOES have d_type.  See src/w32/include/dirent.h.

However, this is disabled for MING32.  MING32 has its own dirent.h but that version doesn't support d_type.

Please be sure to include all relevant details such as which installation of GCC you're using.

This will be fixed in the next release; thanks for the report!

Paul D. Smith <psmith>
Project Administrator
Sat 02 Nov 2019 09:31:59 AM UTC, original submission:  

Running `bootstrap.bat` and `build_w32.bat gcc` from tag `4.2.92` results in:
src/dir.c: In function 'dir_contents_file_exists_p':
src/dir.c:736:23: error: 'struct dirent' has no member named 'd_type'
  736 |           df->type = d->d_type;
      |                       ^~

The attached patch is:

  • Fix for this issue

Tested with gcc 9.2.0 (mingw-w64-x86_64-)

Ben <bwijen>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by eliz (Posted a comment)
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by bwijen (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-12-17 psmith StatusNone => Fixed
        Open/ClosedOpen => Closed
        Fixed ReleaseNone => 4.3
    2019-11-02 bwijen Attached File- => Added 0001-Fix-WINDOWS32-gcc-build.patch, #47779

    Back to the top

    Powered by Savane 3.7