[bug #57152] Fix WINDOWS32 gcc build

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #57152] Fix WINDOWS32 gcc build

anonymous
URL:
  <https://savannah.gnu.org/bugs/?57152>

                 Summary: Fix WINDOWS32 gcc build
                 Project: make
            Submitted by: bwijen
            Submitted on: Sat 02 Nov 2019 09:31:59 AM UTC
                Severity: 3 - Normal
              Item Group: Build/Install
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: SCM
        Operating System: MS Windows
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

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-)




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sat 02 Nov 2019 09:31:59 AM UTC  Name:
0001-Fix-WINDOWS32-gcc-build.patch  Size: 785B   By: bwijen

<http://savannah.gnu.org/bugs/download.php?file_id=47779>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57152>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #57152] Fix WINDOWS32 gcc build

anonymous
Update of bug #57152 (project make):

                  Status:                    None => Fixed                  
             Open/Closed:                    Open => Closed                
           Fixed Release:                    None => SCM                    

    _______________________________________________________

Follow-up 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!

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57152>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #57152] Fix WINDOWS32 gcc build

anonymous
Follow-up Comment #2, bug #57152 (project make):

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.



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57152>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #57152] Fix WINDOWS32 gcc build

anonymous
Follow-up Comment #3, bug #57152 (project make):

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.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57152>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #57152] Fix WINDOWS32 gcc build

anonymous
Follow-up Comment #4, bug #57152 (project make):

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 */
#else
/* MinGW64 */
#endif

(Thankfully, __MINGW32_VERSION is not defined in MinGW64.)

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


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57152>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #57152] Fix WINDOWS32 gcc build

anonymous
Follow-up Comment #5, bug #57152 (project make):

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.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57152>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #57152] Fix WINDOWS32 gcc build

anonymous
Follow-up Comment #6, bug #57152 (project make):

Hi Paul,

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


Thanks!

Ben...


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57152>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/