[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

64-bit Ruby on Solaris?

Berger, Daniel

10/31/2003 12:04:00 AM

Hi all,

Solaris 9
gcc 3.3.1
Ruby 1.8.1 p2
Sunblade 100, UltraSparc IIe

As usual, I'm playing with things I don't truly understand. Anyway, I
thought I'd try building 1.8.1 p2 as 64 bit since I've upgraded my
compiler since last time.

After running configure, I manually added "-m64 -mcpu=ultrasparc" into
the CC line of the Makefile. I seemed to get further this time, and
died with a different error:

gcc -m64 -mcpu=ultrasparc -g -O2 -I. -I. -c io.c
io.c: In function `rb_read_pending':
io.c:259: error: structure has no member named `_cnt'
io.c: In function `rb_read_check':
io.c:266: error: structure has no member named `_cnt'
io.c: In function `rb_io_eof':
io.c:564: error: structure has no member named `_cnt'
io.c:565: error: structure has no member named `_cnt'
io.c: In function `rb_io_fread':
io.c:683: error: structure has no member named `_cnt'
io.c:686: error: structure has no member named `_cnt'
io.c: In function `read_all':
io.c:780: error: structure has no member named `_cnt'
io.c: In function `io_read':
io.c:842: error: structure has no member named `_cnt'
io.c: In function `appendline':
io.c:873: error: structure has no member named `_cnt'
io.c:875: error: structure has no member named `_ptr'
io.c: In function `swallow':
io.c:963: error: structure has no member named `_cnt'
io.c:965: error: structure has no member named `_ptr'
io.c: In function `rb_io_each_byte':
io.c:1222: error: structure has no member named `_cnt'
io.c: In function `rb_io_getc':
io.c:1254: error: structure has no member named `_cnt'
io.c: In function `rb_getc':
io.c:1277: error: structure has no member named `_cnt'
io.c: In function `rb_io_sysseek':
io.c:1515: error: structure has no member named `_cnt'
io.c: In function `rb_io_sysread':
io.c:1572: error: structure has no member named `_cnt'
io.c: In function `rb_f_select':
io.c:3256: error: structure has no member named `_cnt'
make: *** [io.o] Error 1

Here's my config.h file:
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#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_UNISTD_H 1
#define _FILE_OFFSET_BITS 64
#define HAVE_LONG_LONG 1
#define HAVE_OFF_T 1
#define SIZEOF_INT 4
#define SIZEOF_SHORT 2
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF___INT64 0
#define SIZEOF_OFF_T 8
#define SIZEOF_VOIDP 4
#define SIZEOF_FLOAT 4
#define SIZEOF_DOUBLE 8
#define HAVE_PROTOTYPES 1
#define TOKEN_PASTE(x,y) x##y
#define HAVE_STDARG_PROTOTYPES 1
#define NORETURN(x) x __attribute__ ((noreturn))
#define HAVE_DECL_SYS_NERR 0
#define HAVE_LIBCRYPT 1
#define HAVE_LIBDL 1
#define HAVE_DIRENT_H 1
#define STDC_HEADERS 1
#define HAVE_SYS_WAIT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_UNISTD_H 1
#define HAVE_LIMITS_H 1
#define HAVE_SYS_FILE_H 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_FCNTL_H 1
#define HAVE_SYS_FCNTL_H 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIMES_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_PWD_H 1
#define HAVE_GRP_H 1
#define HAVE_UTIME_H 1
#define HAVE_MEMORY_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_SYS_MKDEV_H 1
#define HAVE_SYS_UTIME_H 1
#define HAVE_FLOAT_H 1
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
#define HAVE_ST_BLKSIZE 1
#define HAVE_STRUCT_STAT_ST_BLOCKS 1
#define HAVE_ST_BLOCKS 1
#define HAVE_STRUCT_STAT_ST_RDEV 1
#define HAVE_ST_RDEV 1
#define GETGROUPS_T gid_t
#define RETSIGTYPE void
#define HAVE_ALLOCA_H 1
#define HAVE_ALLOCA 1
#define HAVE_FSEEKO 1
#define HAVE_FTELLO 1
#define HAVE_DUP2 1
#define HAVE_MEMMOVE 1
#define HAVE_MKDIR 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_STRERROR 1
#define HAVE_STRFTIME 1
#define HAVE_STRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOUL 1
#define HAVE_CRYPT 1
#define HAVE_VSNPRINTF 1
#define HAVE_ISNAN 1
#define HAVE_FINITE 1
#define HAVE_HYPOT 1
#define HAVE_ACOSH 1
#define HAVE_ERF 1
#define HAVE_FMOD 1
#define HAVE_KILLPG 1
#define HAVE_WAIT4 1
#define HAVE_WAITPID 1
#define HAVE_SYSCALL 1
#define HAVE_CHROOT 1
#define HAVE_FSYNC 1
#define HAVE_TRUNCATE 1
#define HAVE_TIMES 1
#define HAVE_UTIMES 1
#define HAVE_FCNTL 1
#define HAVE_LOCKF 1
#define HAVE_LSTAT 1
#define HAVE_SYMLINK 1
#define HAVE_READLINK 1
#define HAVE_SETITIMER 1
#define HAVE_SETEUID 1
#define HAVE_SETREUID 1
#define HAVE_SETEGID 1
#define HAVE_SETREGID 1
#define HAVE_ISSETUGID 1
#define HAVE_PAUSE 1
#define HAVE_LCHOWN 1
#define HAVE_GETPGRP 1
#define HAVE_SETPGRP 1
#define HAVE_GETPGID 1
#define HAVE_SETPGID 1
#define HAVE_INITGROUPS 1
#define HAVE_GETGROUPS 1
#define HAVE_SETGROUPS 1
#define HAVE_GETPRIORITY 1
#define HAVE_GETRLIMIT 1
#define HAVE_DLOPEN 1
#define HAVE_SIGPROCMASK 1
#define HAVE_SIGACTION 1
#define HAVE__SETJMP 1
#define HAVE_SETSID 1
#define HAVE_TELLDIR 1
#define HAVE_SEEKDIR 1
#define HAVE_FCHMOD 1
#define HAVE_MKTIME 1
#define HAVE_COSH 1
#define HAVE_SINH 1
#define HAVE_TANH 1
#define HAVE_SETUID 1
#define HAVE_SETGID 1
#define HAVE_TZNAME 1
#define HAVE_DAYLIGHT 1
#define NEGATIVE_TIME_T 1
#define POSIX_SIGNAL 1
#define GETPGRP_VOID 1
#define SETPGRP_VOID 1
#define WORDS_BIGENDIAN 1
#define RSHIFT(x,y) ((x)>>(int)y)
#define FILE_COUNT _cnt
#define FILE_READPTR _ptr
#define NEED_IO_SEEK_BETWEEN_RW 1
#define HUGE_ST_INO 1
#define STACK_GROW_DIRECTION -1
#define DEFAULT_KCODE KCODE_NONE
#define USE_ELF 1
#define DLEXT ".so"
#define RUBY_LIB "/opt/lib/ruby/1.8"
#define RUBY_SITE_LIB "/opt/lib/ruby/site_ruby"
#define RUBY_SITE_LIB2 "/opt/lib/ruby/site_ruby/1.8"
#define RUBY_PLATFORM "sparc-solaris2.9"
#define RUBY_ARCHLIB "/opt/lib/ruby/1.8/sparc-solaris2.9"
#define RUBY_SITE_ARCHLIB "/opt/lib/ruby/site_ruby/1.8/sparc-solaris2.9"

I tried messing with the LDFLAGS and CFLAGS settings as well but no
luck. Any ideas?

Regards,

Dan

4 Answers

slumos

10/31/2003 2:00:00 AM

0

Daniel Berger <djberge@qwest.com> writes:
> Hi all,
>
> Solaris 9
> gcc 3.3.1
> Ruby 1.8.1 p2
> Sunblade 100, UltraSparc IIe
>
> As usual, I'm playing with things I don't truly understand. Anyway, I
> thought I'd try building 1.8.1 p2 as 64 bit since I've upgraded my
> compiler since last time.
>
> After running configure, I manually added "-m64 -mcpu=ultrasparc" into
> the CC line of the Makefile. I seemed to get further this time, and
> died with a different error:
>
> gcc -m64 -mcpu=ultrasparc -g -O2 -I. -I. -c io.c
> io.c: In function `rb_read_pending':
> io.c:259: error: structure has no member named `_cnt'

It's because FILE on 64-bit Solaris is opaque. This patch is against
1.8.0, but hopefully somebody can adapt it. The patch to defines.h in
here is for a different problem and should probably be reviewed.

Steve

diff -u ruby-1.8.0/configure.in ruby-1.8.0.suncc/configure.in
--- ruby-1.8.0/configure.in 2003-07-29 18:57:26.000000000 -0700
+++ ruby-1.8.0.suncc/configure.in 2003-09-03 11:41:07.373229000 -0700
@@ -561,6 +561,9 @@
fi
fi

+AC_CHECK_HEADERS(stdio_ext.h)
+AC_CHECK_FUNCS(__fpending)
+
AC_DEFUN(RUBY_CHECK_IO_NEED,
[AC_CACHE_CHECK(whether need to [$1], [$2],
[AC_TRY_RUN([
diff -u ruby-1.8.0/defines.h ruby-1.8.0.suncc/defines.h
--- ruby-1.8.0/defines.h 2003-08-01 03:57:18.000000000 -0700
+++ ruby-1.8.0.suncc/defines.h 2003-09-03 12:24:45.552186000 -0700
@@ -141,6 +141,8 @@
{
# if defined(__sparc_v9__) || defined(__arch64__)
asm volatile ("flushw" : :);
+# elif defined(__sparcv9) /* Sun compiler */
+ asm ("flushw");
# elif defined(linux) || defined(__linux__)
asm volatile ("ta 0x83");
# else /* Solaris, OpenBSD, NetBSD, etc. */
diff -u ruby-1.8.0/io.c ruby-1.8.0.suncc/io.c
--- ruby-1.8.0/io.c 2003-08-03 22:28:50.000000000 -0700
+++ ruby-1.8.0.suncc/io.c 2003-09-03 11:42:07.958468000 -0700
@@ -132,6 +132,9 @@
#elif defined(FILE_READEND)
# define READ_DATA_PENDING(fp) ((fp)->FILE_READPTR < (fp)->FILE_READEND)
# define READ_DATA_PENDING_COUNT(fp) ((fp)->FILE_READEND - (fp)->FILE_READPTR)
+#elif defined(HAVE___FPENDING)
+# define READ_DATA_PENDING(fp) (__fpending(fp) > 0)
+# define READ_DATA_PENDING_COUNT(fp) (__fpending(fp))
#elif defined(__BEOS__)
# define READ_DATA_PENDING(fp) (fp->_state._eof == 0)
#elif defined(__VMS)
diff -u ruby-1.8.0/rubyio.h ruby-1.8.0.suncc/rubyio.h
--- ruby-1.8.0/rubyio.h 2003-04-14 02:04:43.000000000 -0700
+++ ruby-1.8.0.suncc/rubyio.h 2003-09-03 11:40:20.359152000 -0700
@@ -16,6 +16,10 @@
#include <stdio.h>
#include <errno.h>

+#ifdef HAVE_STDIO_EXT_H
+#include <stdio_ext.h>
+#endif
+
typedef struct OpenFile {
FILE *f; /* stdio ptr for read/write */
FILE *f2; /* additional ptr for rw pipes */

matz

10/31/2003 8:16:00 AM

0

Hi,

In message "64-bit Ruby on Solaris?"
on 03/10/31, Daniel Berger <djberge@qwest.com> writes:

|Solaris 9
|gcc 3.3.1
|Ruby 1.8.1 p2
|Sunblade 100, UltraSparc IIe
|
|As usual, I'm playing with things I don't truly understand. Anyway, I
|thought I'd try building 1.8.1 p2 as 64 bit since I've upgraded my
|compiler since last time.
|
|After running configure, I manually added "-m64 -mcpu=ultrasparc" into
|the CC line of the Makefile. I seemed to get further this time, and
|died with a different error:

Seems like configure failed to detect platform stdio information. I
hope you (or others) can help me to support newer Solaris.

matz.

Berger, Daniel

10/31/2003 10:06:00 PM

0

ts wrote:
>
> >>>>> "D" == Daniel Berger <djberge@qwest.com> writes:
>
> Here the reason, why it don't find _cnt and _ptr
>
> D> #ifdef _LP64
> D> #ifndef _FILE64_H
> D> struct __FILE_TAG {
> D> long __pad[16];
> D> };
> D> #endif /* _FILE64_H */
>
> Guy Decoux

Sorry if the attachment on that last post didn't come through properly -
ack.

In any case, I tried setting CFLAGS to '-m64 -mcpu=ultrasparc' (which I
thought I had done but apparently not) and then re-running configure.
The good news is that configure seems to work properly, i.e. I got past
io.c without incident. However, it died when I got here:

gcc -fPIC -m64 -mcpu=ultrasparc -I. -I/usr/local/src/ruby-1.8.1
-I/usr/local/src/ruby-1.8.1 -I/usr/local/src/ruby-1.8.1/ext/bigdecimal
-c bigdecimal.c
gcc -Wl,-G -L"/usr/local/src/ruby-1.8.1" -L"/opt/lib" -o bigdecimal.so
bigdecimal.o -ldl -lcrypt -lm -lc
ld: fatal: file bigdecimal.o: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to bigdecimal.so
collect2: ld returned 1 exit status
make[1]: *** [bigdecimal.so] Error 1
make[1]: Leaving directory `/usr/local/src/ruby-1.8.1/ext/bigdecimal'
make: *** [all] Error 1

I tried setting LDFLAGS to '-m64' but that didn't seem to help. Is
there some other env variable I need to set?

Regards,

Dan

ts

11/1/2003 1:29:00 PM

0

>>>>> "D" == Daniel Berger <djberge@qwest.com> writes:

D> ld: fatal: file bigdecimal.o: wrong ELF class: ELFCLASS64

What say file bigdecimal.o and what loader do you use (/usr/ccs/bin/ld
or ? )


Guy Decoux