Issue #10640 has been updated by Jon Forums.


This is strange as the mingw-w64 headers appear to have the same include chain for NET_LUID. I will try building trunk to confirm your update.

[iphlpapi.h](http://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/include/iphlpapi.h#l15)
  |
[iptypes.h](http://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/include/iptypes.h#l14)
  |
[ifdef.h](http://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/include/ifdef.h#l86)

----------------------------------------
Bug #10640: build fail with mingw-w64 gcc 4.9.2 due to configure NET_LUID check
https://bugs.ruby-lang.org/issues/10640#change-50624

* Author: Jon Forums
* Status: Third Party's Issue
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: build
* Target version: current: 2.2.0
* ruby -v: ruby 2.1.5p273 (2014-11-13 revision 48404) [i386-mingw32]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
On my Win8.1 x64 system I get the following build fail when building `ruby_2_1` and `ruby_2_2` using a 32bit gcc 4.9.2 toolchain from the mingw-w64 project [mingw-w64 32bit 4.9.2 toolchain](http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.2/threads-win32/sjlj/)

The build fail does not occur on `ruby_2_0_0`. I have not tried building `trunk`.

~~~ bash
# build using overridden rubyinstaller build recipe
rake ruby21 make_opt=-j8 local=C:\Users\Jon\Documents\RubyDev\ruby-git openssl=1.0.1j libffi=3.2.1 rbreadline=0.5.1 dkver=mingw64-32-4.9.2
...
compiling ../../../ruby-git/win32/win32.c
../../../ruby-git/win32/win32.c:3889:7: error: conflicting types for 'NET_LUID'
     } NET_LUID;
       ^
In file included from C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/iptypes.h:14:0,
                 from C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/iphlpapi.h:15,
                 from ../../../ruby-git/include/ruby/win32.h:41,
                 from ../../../ruby-git/include/ruby/defines.h:163,
                 from ../../../ruby-git/include/ruby/ruby.h:29,
                 from ../../../ruby-git/win32/win32.c:24:
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/ifdef.h:93:3: note: previous declaration of 'NET_LUID' was here
 } NET_LUID, *PNET_LUID;
   ^
Makefile:349: recipe for target 'win32/win32.o' failed
make: *** [win32/win32.o] Error 1
~~~

The following patch fixes the mingw-w64 build, but I have not tested it using a mingw.org based toolchain. Given [nobu's commit comment](https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41163/diff) I suspect this simple patch is not applicable to both mingw-w64 and mingw.org toolchains due to header file differences.

~~~ patch
diff --git a/configure.in b/configure.in
index e132076..4a25dde 100644
--- a/configure.in
+++ b/configure.in
@@ -1103,7 +1103,7 @@ main()
                { test "$target_cpu" = x64 && ac_cv_func___builtin_setjmp=no; }
                AC_CHECK_TYPE([NET_LUID], [], [],
                              [@%:@include <windows.h>
-                             @%:@include <iphlpapi.h>])
+                             @%:@include <ifdef.h>])
                if test x"$ac_cv_type_NET_LUID" = xyes; then
                    AC_DEFINE(HAVE_TYPE_NET_LUID, 1)
                fi
~~~



-- 
https://bugs.ruby-lang.org/