From: Heesob Park Date: 2010-10-13T14:43:15+09:00 Subject: [ruby-core:32769] Re: [Ruby-Bug#3802] freeaddrinfo not found in WS2_32.dll 2010/10/13 Luis Lavena : > On Tue, Oct 12, 2010 at 11:44 PM, U.Nakamura wrote: >> Hello, >> >>> Here is a patch for VC. >> >> Luis, how do you think this patch? >> > > While patch applies and solve the redefinition (good), it raises again > the broken IPv6 issue with undefined references: > >

> gcc -shared -s -o ../../.ext/i386-mingw32/socket.so init.o constants.o
> basicsocket.o socket.o ipsocket.o tcpsocket.o tcpserver.o
> sockssocket.o udpsocket.o unixsocket.o unixserver.o option.o ancdata.o
> raddrinfo.o getaddrinfo.o getnameinfo.o
> -L. -L../.. -L. ��-Wl,--enable-auto-image-base,--enable-auto-import
> socket-i386-mingw32.def ��-lmsvcrt-ruby191 -lws2_32 ��-lshell32 -lws2_32
> -limagehlp
> getaddrinfo.o: In function `get_addr':
> C:\Users\Luis\Projects\oss\oci\rubyinstaller\sandbox\ruby19_build\ext\socket/../../../../../../ruby/ext/socket/getaddrinfo.c:587:
> undefined reference to `getipnodebyname'
> getaddrinfo.o: In function `get_name':
> C:\Users\Luis\Projects\oss\oci\rubyinstaller\sandbox\ruby19_build\ext\socket/../../../../../../ruby/ext/socket/getaddrinfo.c:543:
> undefined reference to `getipnodebyaddr'
> C:\Users\Luis\Projects\oss\oci\rubyinstaller\sandbox\ruby19_build\ext\socket/../../../../../../ruby/ext/socket/getaddrinfo.c:555:
> undefined reference to `freehostent__compat'
> getaddrinfo.o: In function `get_addr':
> C:\Users\Luis\Projects\oss\oci\rubyinstaller\sandbox\ruby19_build\ext\socket/../../../../../../ruby/ext/socket/getaddrinfo.c:660:
> undefined reference to `freehostent__compat'
> C:\Users\Luis\Projects\oss\oci\rubyinstaller\sandbox\ruby19_build\ext\socket/../../../../../../ruby/ext/socket/getaddrinfo.c:590:
> undefined reference to `getipnodebyname'
> C:\Users\Luis\Projects\oss\oci\rubyinstaller\sandbox\ruby19_build\ext\socket/../../../../../../ruby/ext/socket/getaddrinfo.c:669:
> undefined reference to `freehostent__compat'
> getaddrinfo.o: In function `get_name':
> C:\Users\Luis\Projects\oss\oci\rubyinstaller\sandbox\ruby19_build\ext\socket/../../../../../../ruby/ext/socket/getaddrinfo.c:564:
> undefined reference to `freehostent__compat'
> getnameinfo.o: In function `getnameinfo__compat':
> C:\Users\Luis\Projects\oss\oci\rubyinstaller\sandbox\ruby19_build\ext\socket/../../../../../../ruby/ext/socket/getnameinfo.c:227:
> undefined reference to `getipnodebyaddr'
> C:\Users\Luis\Projects\oss\oci\rubyinstaller\sandbox\ruby19_build\ext\socket/../../../../../../ruby/ext/socket/getnameinfo.c:240:
> undefined reference to `freehostent__compat'
> C:\Users\Luis\Projects\oss\oci\rubyinstaller\sandbox\ruby19_build\ext\socket/../../../../../../ruby/ext/socket/getnameinfo.c:246:
> undefined reference to `freehostent__compat'
> collect2: ld returned 1 exit status
> 
> > Which I think was solved in r24517: > > http://redmine.ruby-lang.org/issues/show/1834 > > To quote your 3rd point in that ticket: > > "(3) link errors with --enable-wide-getaddrinfo is ruby's bug." > I can see the same error with VC9 with --enable-ipv6 It seems that getaddrinfo.c is not ready for Windows with ipv6 enabled. The quick and simple way is disable ipv6 for Windows platform. Here is a patch of ext/socket/extconf.rb --- extconf.rb 2010-10-13 14:33:14.000000000 +0900 +++ extconf.rb.new 2010-10-13 14:34:41.000000000 +0900 @@ -34,7 +34,7 @@ end ipv6 = false -default_ipv6 = /mswin|cygwin|beos|haiku/ !~ RUBY_PLATFORM +default_ipv6 = /mswin|mingw|cygwin|beos|haiku/ !~ RUBY_PLATFORM if enable_config("ipv6", default_ipv6) if checking_for("ipv6") {try_link(<