Bug #10640
closedbuild fail with mingw-w64 gcc 4.9.2 due to configure NET_LUID check
Description
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
The build fail does not occur on ruby_2_0_0
. I have not tried building trunk
.
# 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 I suspect this simple patch is not applicable to both mingw-w64 and mingw.org toolchains due to header file differences.
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
Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
- Status changed from Open to Third Party's Issue
As iphlpapi.h should include ifdef.h via iptypes.h, in fact both of Microsoft SDK's and cygwin mignw's do it, it seems a bug of that mingw-w64 header.
There are too many mingws.
Updated by jonforums (Jon Forums) almost 10 years ago
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.
Updated by jonforums (Jon Forums) almost 10 years ago
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
...
Updated by jonforums (Jon Forums) almost 10 years ago
This patch allows me to build trunk at r48993 and get #define HAVE_TYPE_NET_LUID 1
populated in config.h
diff --git a/configure.in b/configure.in
index ae08fa0..375ef55 100644
--- a/configure.in
+++ b/configure.in
@@ -1102,8 +1102,7 @@ main()
ac_cv_func_malloc_usable_size=no
{ test "$target_cpu" = x64 && ac_cv_func___builtin_setjmp=no; }
AC_CHECK_TYPE([NET_LUID], [], [],
- [@%:@include <windows.h>
- @%:@include <ifdef.h>
+ [@%:@include <winsock2.h>
@%:@include <iphlpapi.h>])
if test x"$ac_cv_type_NET_LUID" = xyes; then
AC_DEFINE(HAVE_TYPE_NET_LUID, 1)
Updated by nagachika (Tomoyuki Chikanaga) almost 10 years ago
- Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: UNKNOWN, 2.1: REQUIRED
see #10679
Updated by nagachika (Tomoyuki Chikanaga) almost 10 years ago
- Backport changed from 2.0.0: UNKNOWN, 2.1: REQUIRED to 2.0.0: UNKNOWN, 2.1: DONE
r44876,r47130,r48988,r48997 were backported into ruby_2_1 at r49356