Trouble building 64-bit Ruby 1.8.3 on Solaris 10/AMD64

T

Tony Arcieri

Hello, I'm attempting to build an AMD64 native Ruby interpreter on top
of Solaris 10 with gcc and have been running into a number of
problems.

The first is ensuring that the -m64 parameter, which instructs gcc to
build 64-bit executables, is passed correctly. It seems like LDFLAGS
is ignored.

If I ./configure CC=3Dgcc CFLAGS=3D-m64 LDFLAGS=3D-m64 and try to compile I=
get:

gcc -fPIC -m64 -I. -I../.. -I../../. -I../.././ext/bigdecimal -c bigdecimal=
c
gcc -Wl,-G -L'../..' -o ../../.ext/i386-solaris2.10/bigdecimal.so
bigdecimal.o -ldl -lm -lc
ld: fatal: file bigdecimal.o: wrong ELF class: ELFCLASS64

Because the -m64 parameter was not being passed during linking (same
behavior occurs if I set the CC/CFLAGS/LDFLAGS) environment variables.

As a workaround, I tried creating a wrapper script called "gcc64"
which contains the following:

#!/bin/sh

/usr/sfw/bin/gcc -m64 $*

And it compiles successfully, however:

# make test
make: Warning: Illegal dependency list for target `.DEFAULT'
not ok system 1 -- ./sample/test.rb:1643
not ok system 2 -- ./sample/test.rb:1644
not ok system 3 -- ./sample/test.rb:1650
not ok system 4 -- ./sample/test.rb:1651
not ok system 5 -- ./sample/test.rb:1658
not ok system 6 -- ./sample/test.rb:1668
not ok system 7 -- ./sample/test.rb:1669
sample/test.rb:2037: Invalid char `\377' in expression
not ok system 9 -- ./sample/test.rb:1711
test failed
*** Error code 1

Okay, not good. If I try to make install and install gems...

/root/rubygems-0.8.11/./post-install.rb:73:in `instance_eval': compile
error (SyntaxError)
/root/rubygems-0.8.11/./post-install.rb:73: Invalid char `\377' in
expression from setup.rb:583:in `try_run_hook'

For some reason there's a corrupt looking character at the bottom of
the file. If I edit the file with vim, it reports:

"post_install.rb" [Incomplete last line] 73 lines, 2018 characters

If I delete the offending line it solves *that* problem, but begins to
complain about other files in site_ruby having "Invalid char `\377' in
expression". It seems like virtually every file in site_ruby is
affected.

Any ideas?

Tony Arcieri
 
T

Tony Arcieri

Two important things I forgot to mention:

1. Yes, this is successfully building a 64-bit binary.

2. No, the problem does NOT occur when I build a 32-bit binary:

# make test
make: Warning: Illegal dependency list for target `.DEFAULT'
test succeeded

Tony Arcieri
 
N

nobuyoshi nakada

Hi,

At Wed, 28 Sep 2005 04:05:45 +0900,
Tony Arcieri wrote in [ruby-talk:157913]:
The first is ensuring that the -m64 parameter, which instructs gcc to
build 64-bit executables, is passed correctly. It seems like LDFLAGS
is ignored.

Try to use DLDFLAGS instead.
sample/test.rb:2037: Invalid char `\377' in expression

I hope it was fixed this morning.
 
T

Tony Arcieri

Hi,

At Wed, 28 Sep 2005 04:05:45 +0900,
Tony Arcieri wrote in [ruby-talk:157913]:
The first is ensuring that the -m64 parameter, which instructs gcc to
build 64-bit executables, is passed correctly. It seems like LDFLAGS
is ignored.

Try to use DLDFLAGS instead.

DLDFLAGS didn't do anything.
I hope it was fixed this morning.

I tried Ruby 1.8.2. It seemed to add the -m64 flag on its own. And
everything worked.

Something broke between Ruby 1.8.2. and 1.8.3, at least for Solaris 10/AMD6=
4.

I'll go ahead and stick with Ruby 1.8.2 I guess, especially since I
can add DTrace instrumentation.

Tony Arcieri
 
N

nobuyoshi nakada

Hi,

At Thu, 29 Sep 2005 04:13:50 +0900,
Tony Arcieri wrote in [ruby-talk:158130]:
DLDFLAGS didn't do anything.

I tried with DLDFLAGS=-m32 on cygwin and it worked fine.
Can't you show the config.log file? OK to even send directly
to (e-mail address removed).

Or you can do ./configure CC='gcc -m64'.
I tried Ruby 1.8.2. It seemed to add the -m64 flag on its own. And
everything worked.

I meant I committed a fix yesterday morning.

Wed Sep 28 08:12:18 2005 Nobuyoshi Nakada <[email protected]>

* io.c (read_buffered_data): check if reached EOF. fixed: [ruby-dev:27334]
 
T

Tony Arcieri

I tried with DLDFLAGS=3D-m32 on cygwin and it worked fine.
Can't you show the config.log file? OK to even send directly
to (e-mail address removed).

If you want I could do this for experimental purposes, but my
workaround got the job done. CC=3Dgcc -m64" would probably work too.
I meant I committed a fix yesterday morning.

Wed Sep 28 08:12:18 2005 Nobuyoshi Nakada <[email protected]>

* io.c (read_buffered_data): check if reached EOF. fixed: [ruby-=
dev:27334]

I'm building Ruby for use with a production Rails application, so I
wanted to use a stable version. It sounds like you found the bug, so
I'll just update after the next stable release. Plus I want to use
the DTrace patch which is only available for 1.8.2

Tony Arcieri
 
N

nobuyoshi nakada

Hi,

At Thu, 29 Sep 2005 15:05:04 +0900,
Tony Arcieri wrote in [ruby-talk:158196]:
If you want I could do this for experimental purposes, but my
workaround got the job done. CC=gcc -m64" would probably work too.

I'd like to know why DLDFLAGS can't be set only on Solaris.
I meant I committed a fix yesterday morning.

Wed Sep 28 08:12:18 2005 Nobuyoshi Nakada <[email protected]>

* io.c (read_buffered_data): check if reached EOF. fixed: [ruby-dev:27334]

I'm building Ruby for use with a production Rails application, so I
wanted to use a stable version. It sounds like you found the bug, so
I'll just update after the next stable release. Plus I want to use
the DTrace patch which is only available for 1.8.2

You mean [ruby-core:05557] and [ruby-core:05575]? Hmmm, I've
forgot it, but will post a patch for recent versions later.
 
T

ts

n> I'd like to know why DLDFLAGS can't be set only on Solaris.

With DLDFLAGS=-m64 it do

gcc -fPIC -g -O2 -I. -I../.. -I../../. -I../.././ext/bigdecimal -c bigdecimal.c
In file included from ../../ruby.h:24,
from bigdecimal.c:23:
../../config.h:17:1: warning: "_FILE_OFFSET_BITS" redefined
In file included from /usr/include/iso/ctype_iso.h:30,
from /usr/include/ctype.h:18,
from bigdecimal.c:16:
/usr/include/sys/feature_tests.h:96:1: warning: this is the location of the previous definition
gcc -Wl,-G -m64 -L'../..' -o ../../.ext/sparc-solaris2.8/bigdecimal.so bigdecimal.o -ldl -lcrypt -lm -lc
ld: fatal: file bigdecimal.o: wrong ELF class: ELFCLASS32

With CC="gcc -m64"

compiling bigdecimal
gcc -m64 -fPIC -g -O2 -I. -I../.. -I../../. -I../.././ext/bigdecimal -c bigdecimal.c
gcc -m64 -Wl,-G -m64 -L'../..' -o ../../.ext/sparc-solaris2.8/bigdecimal.so bigdecimal.o -ldl -lm -lc



Guy Decoux
 
N

nobuyoshi nakada

Hi,

At Thu, 29 Sep 2005 18:23:55 +0900,
ts wrote in [ruby-talk:158207]:
n> I'd like to know why DLDFLAGS can't be set only on Solaris.

With DLDFLAGS=-m64 it do

gcc -fPIC -g -O2 -I. -I../.. -I../../. -I../.././ext/bigdecimal -c bigdecimal.c
In file included from ../../ruby.h:24,
from bigdecimal.c:23:
../../config.h:17:1: warning: "_FILE_OFFSET_BITS" redefined
In file included from /usr/include/iso/ctype_iso.h:30,
from /usr/include/ctype.h:18,
from bigdecimal.c:16:
/usr/include/sys/feature_tests.h:96:1: warning: this is the location of the previous definition
gcc -Wl,-G -m64 -L'../..' -o ../../.ext/sparc-solaris2.8/bigdecimal.so bigdecimal.o -ldl -lcrypt -lm -lc
ld: fatal: file bigdecimal.o: wrong ELF class: ELFCLASS32

DLDFLAGS itself seems to work.
With CC="gcc -m64"

compiling bigdecimal
gcc -m64 -fPIC -g -O2 -I. -I../.. -I../../. -I../.././ext/bigdecimal -c bigdecimal.c
gcc -m64 -Wl,-G -m64 -L'../..' -o ../../.ext/sparc-solaris2.8/bigdecimal.so bigdecimal.o -ldl -lm -lc

Or both of CFLAGS and DLDFLAGS are needed.

OK, understood. Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top