> それから、 > - libcに入っているgetaddrinfo(3)がIPv6 ready > - かつrubyに--enable-ipv6をつけなかった場合 > 関数の戻り値にsockaddr_in6を食らって困ることがあるのでそれも > 追ってdiffを出します。遅くなってごめんなさい。 これは1.5用のdiffです。1.4.xにも入ると嬉しいです。 前回のdiffも含めてまとめて添付しました。 > まだ少しsocket.soのdynamic linkまわりで苦しんでいます。 > なにがいけないんだかよくわからない... - libcにgetaddrinfo(3)が入ってる - 標準配布の状態で ./configure (ext/socketはダイナミックリンク) だけしてコンパイルすると、こういうことを言われます。 NetBSD-current/i386 (ELF)です。 symbolはrubyの中で正しく定義されているぽいのですが。 dynamic linkまわりに詳しくないのでよくわかりません。なにかヒントを 頂けませんか? >>/home/itojun/NetBSD/pkgsrc/lang/ruby/work/ruby-1.4.3/sample/dualstack-fetch.rb:6:in `require': ext/socket/socket.so: Undefined symbol "rb_eArgError" (reloc type = 6, symnum = 13) - ext/socket/socket.so (LoadError) >> from /home/itojun/NetBSD/pkgsrc/lang/ruby/work/ruby-1.4.3/sample/dualstack-fetch.rb:6 >% nm -o ruby ext/socket/socket.so | grep eArg >ruby:080bd2b8 B rb_eArgError >ext/socket/socket.so: U rb_eArgError itojun Index: ext/socket/extconf.rb =================================================================== RCS file: /home/cvs/ruby/ext/socket/extconf.rb,v retrieving revision 1.7 diff -c -r1.7 extconf.rb *** ext/socket/extconf.rb 1999/10/20 07:10:23 1.7 --- ext/socket/extconf.rb 2000/01/20 13:08:24 *************** *** 41,46 **** --- 41,47 ---- $ipv6type = nil $ipv6lib = nil $ipv6libdir = nil + $ipv6trylibc = nil if $ipv6 if egrep_cpp("yes", <<EOF) #include <netinet/in.h> *************** *** 59,64 **** --- 60,66 ---- $ipv6type = "kame" $ipv6lib="inet6" $ipv6libdir="/usr/local/v6/lib" + $ipv6trylibc=true $CFLAGS="-DINET6 "+$CFLAGS elsif File.directory? "/usr/inet6" $ipv6type = "linux" *************** *** 100,106 **** if $ipv6lib if File.directory? $ipv6libdir and File.exist? "#{$ipv6libdir}/lib#{$ipv6lib}.a" $LOCAL_LIBS = " -L#$ipv6libdir -l#$ipv6lib" ! else print <<EOS Fatal: no #$ipv6lib library found. cannot continue. --- 102,108 ---- if $ipv6lib if File.directory? $ipv6libdir and File.exist? "#{$ipv6libdir}/lib#{$ipv6lib}.a" $LOCAL_LIBS = " -L#$ipv6libdir -l#$ipv6lib" ! elsif !$ipv6trylibc print <<EOS Fatal: no #$ipv6lib library found. cannot continue. *************** *** 128,133 **** --- 130,152 ---- } EOF $CFLAGS="-DHAVE_SIN_LEN "+$CFLAGS + end + + if try_link(<<EOF) + #include <sys/types.h> + #include <netdb.h> + #include <string.h> + #include <sys/socket.h> + int + main() + { + struct sockaddr_storage ss; + + ss.ss_family; + return 0; + } + EOF + $CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS end if try_link(<<EOF) Index: ext/socket/socket.c =================================================================== RCS file: /home/cvs/ruby/ext/socket/socket.c,v retrieving revision 1.12 diff -c -r1.12 socket.c *** ext/socket/socket.c 2000/01/17 08:37:48 1.12 --- ext/socket/socket.c 2000/01/20 13:08:28 *************** *** 81,90 **** #define INET_SERVER 1 #define INET_SOCKS 2 ! #ifndef INET6 ! # undef ss_family ! # define sockaddr_storage sockaddr ! # define ss_family sa_family #endif #ifdef NT --- 81,107 ---- #define INET_SERVER 1 #define INET_SOCKS 2 ! #ifndef HAVE_SOCKADDR_STORAGE ! /* ! * RFC 2553: protocol-independent placeholder for socket addresses ! */ ! #define _SS_MAXSIZE 128 ! #define _SS_ALIGNSIZE (sizeof(long long)) ! #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2) ! #define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) * 2 - \ ! _SS_PAD1SIZE - _SS_ALIGNSIZE) ! ! struct sockaddr_storage { ! #ifdef HAVE_SA_LEN ! unsigned char ss_len; /* address length */ ! unsigned char ss_family; /* address family */ ! #else ! unsigned short ss_family; ! #endif ! char __ss_pad1[_SS_PAD1SIZE]; ! long long __ss_align; /* force desired structure storage alignment */ ! char __ss_pad2[_SS_PAD2SIZE]; ! }; #endif #ifdef NT