Issue #10640 has been updated by Jon Forums.


I still get the same NET_LUID conflict failure when building trunk at r48989.

Config.log shows this ugliness

~~~
It was created by configure, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ../../../ruby-git/configure --enable-shared --disable-install-doc debugflags=-g CPPFLAGS=-DFD_SETSIZE=2048 DLDFLAGS=-static-libgcc --prefix=C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/ruby21_mingw
...
configure:8794: checking for NET_LUID
configure:8794: gcc -c  -O3 -fno-omit-frame-pointer -fno-fast-math -g   -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT conftest.c >&5
In file included from C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:10:0,
                 from C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/iphlpapi.h:16,
                 from conftest.c:30:
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/ws2ipdef.h:71:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY si_family;
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/ws2ipdef.h:76:3: error: unknown type name 'SOCKADDR_STORAGE'
   SOCKADDR_STORAGE    gf_group;
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/ws2ipdef.h:79:3: error: unknown type name 'SOCKADDR_STORAGE'
   SOCKADDR_STORAGE    gf_slist[1];
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/ws2ipdef.h:84:3: error: unknown type name 'SOCKADDR_STORAGE'
   SOCKADDR_STORAGE gr_group;
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/ws2ipdef.h:89:3: error: unknown type name 'SOCKADDR_STORAGE'
   SOCKADDR_STORAGE gsr_group;
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/ws2ipdef.h:90:3: error: unknown type name 'SOCKADDR_STORAGE'
   SOCKADDR_STORAGE gsr_source;
   ^
In file included from C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/iphlpapi.h:16:0,
                 from conftest.c:30:
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:108:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY                 Family;
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:368:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY Family,
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:403:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY  Family,
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:416:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY  Family,
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:433:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY  Family,
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:438:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY  Family
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:446:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY  Family,
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:495:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY  Family,
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:508:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY  Family,
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:517:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY  Family,
   ^
In file included from C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/iphlpapi.h:16:0,
                 from conftest.c:30:
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:537:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY  Family,
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:547:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY Family,
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:555:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY  Family,
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:565:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY Family,
   ^
C:/Users/Jon/Documents/RubyDev/ri-git/sandbox/devkit/mingw/i686-w64-mingw32/include/netioapi.h:575:3: error: unknown type name 'ADDRESS_FAMILY'
   ADDRESS_FAMILY Family,
   ^
configure:8794: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define CANONICALIZATION_FOR_MATHN 1
| #define RUBY_MSVCRT_VERSION 60
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define RUBY_SYMBOL_EXPORT_BEGIN _Pragma("GCC visibility push(default)")
| #define RUBY_SYMBOL_EXPORT_END _Pragma("GCC visibility pop")
| /* end confdefs.h.  */
| #include <windows.h>
| 			      #include <ifdef.h>
| 			      #include <iphlpapi.h>
| 
| int
| main ()
| {
| if (sizeof (NET_LUID))
| 	 return 0;
|   ;
|   return 0;
| }
configure:8794: result: no
...
configure:23820: result: ruby library version = 2.2.0
configure:24011: creating ./config.status
...
ac_cv_type_NET_LUID=no
...

~~~

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

* 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/