From: doug.hendricks@... (the_rev_dharma_roadkill) Date: 2003-07-24T13:51:28+09:00 Subject: Build crash of preview3 on alpha/osf5.1 AND POSSIBLE FIX I'm running Tru64 (osf1) 5.1 on an HP/Compaq/DEC alpha, and the ruby build 1.8.0 preview3 crashes in ext/socket: compiling socket cc -Dsocklen_t=int -DHAVE_GETADDRINFO -DINET6 -ieee -g -oldc -std -DENABLE_IPV6 -I. -I/u13/home/doug/ruby/ruby-1.8.0 -I/u13/home/doug/ruby/ruby-1.8.0 -I/u13/hom e/doug/ruby/ruby-1.8.0/ext/socket -DHAVE_NETINET_TCP_H -DHAVE_NETINET_UDP_H -DHA VE_ST_MSG_ACCRIGHTS -DHAVE_GETADDRINFO -DHAVE_GETNAMEINFO -DHAVE_SYS_UN_H -DHAVE _SYS_UIO_H -DHAVE_SOCKET -DHAVE_GETHOSTNAME -Dss_family=__ss_family -Dss_len=__ ss_len -c socket.c cc: Warning: socket.c, line 97: The redefinition of the macro "_SS_ALIGNSIZE" co nflicts with a current definition because the replacement lists differ. The red efinition is now in effect. (macroredef) #define _SS_ALIGNSIZE (sizeof(double)) -------------------------------^ cc: Warning: socket.c, line 98: The redefinition of the macro "_SS_PAD1SIZE" con flicts with a current definition because the replacement lists differ. The rede finition is now in effect. (macroredef) #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2) -----------------------------------------------^ cc: Warning: socket.c, line 99: The redefinition of the macro "_SS_PAD2SIZE" con flicts with a current definition because the replacement lists differ. The rede finition is now in effect. (macroredef) #define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) * 2 - \ ---------------------------------------^ ---------------------------------------^ cc: Error: socket.c, line 102: In this declaration, the struct "sockaddr_storage " is redefined. (redefstruct) struct sockaddr_storage { ^ *** Exit 1 Stop. I had to install a patch from Minero Aoki just to get this far. The problem is the line in ext/socket/extconf.rb: $CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len" which my system hates. Comment this line out and everything builds. But this line is required for other systems, so I propose this fix: we try_link for HAVE_SOCKADDR_STORAGE without the above line first. If it doesn't work, then try again with the line. Maybe this wouldn't work on the supported platforms, but can people check it out? I'm not a ruby source developer, I can't even get to the ruby cvs tree because of my company's firewall. There is probably a much prettier way to do this, but I don't have much experience in write multi-platform builds. my context diff: (.orig is the original file) *** extconf.rb.orig Thu Jul 24 15:42:26 2003 --- extconf.rb Thu Jul 24 15:50:08 2003 *************** *** 1,6 **** require 'mkmf' ! $CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len" case RUBY_PLATFORM when /bccwin32/ --- 1,7 ---- require 'mkmf' ! #$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len" ! # added later -- doug's fix case RUBY_PLATFORM when /bccwin32/ *************** *** 150,155 **** --- 151,179 ---- } EOF $CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS + else # doug's fix, NOW add -Dss_family... only if required! + $CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len" + if try_link(< + # include + #else + # include + # include + # include + # include + #endif + int + main() + { + struct sockaddr_storage ss; + + ss.ss_family; + return 0; + } + EOF + $CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS + end end if try_link(<