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
"_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))
-------------------------------^
"_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)
-----------------------------------------------^
"_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 -
---------------------------------------^
---------------------------------------^
“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

···

cc: Warning: socket.c, line 97: The redefinition of the macro
cc: Warning: socket.c, line 98: The redefinition of the macro
cc: Warning: socket.c, line 99: The redefinition of the macro
cc: Error: socket.c, line 102: In this declaration, the struct


*** 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(<<EOF)

  • #ifdef _WIN32

  • include <windows.h>

  • include <winsock.h>

  • #else

  • include <sys/types.h>

  • include <netdb.h>

  • include <string.h>

  • include <sys/socket.h>

  • #endif

  • int

  • main()

  • {

  • struct sockaddr_storage ss;

  • ss.ss_family;

  • return 0;

  • }

  • EOF

  • $CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS
    
  • end
    end

    if try_link(<<EOF)

end of context diff

I hope this works for other non-alpha people. That way, maybe
HP/Compaq Alpha can be fully supported by non-modified ruby builds.

Doug

Hi,

···

In message “Build crash of preview3 on alpha/osf5.1 AND POSSIBLE FIX” on 03/07/24, the_rev_dharma_roadkill doug.hendricks@tnzi.com writes:

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.

I will check this fix in preview4, which is going out several hours
later. Thank you, Doug.

						matz.

matz@ruby-lang.org (Yukihiro Matsumoto) wrote in message news:1059024003.511102.21055.nullmailer@picachu.netlab.jp

Hi,

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.

I will check this fix in preview4, which is going out several hours
later. Thank you, Doug.

  					matz.

Preview4 works for me! With no changes! Many thanks, matz. I still
get some disturbing compiler warnings, but the self-test and my (very
small) test works fine. I will post a very small summary of the
compiler warnings in another thread.

Doug

···

In message “Build crash of preview3 on alpha/osf5.1 AND POSSIBLE FIX” > on 03/07/24, the_rev_dharma_roadkill doug.hendricks@tnzi.com writes: