Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Trouble building 64-bit Ruby 1.8.3 on Solaris 10/AMD64

Reply
Thread Tools

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

 
 
Tony Arcieri
Guest
Posts: n/a
 
      09-27-2005
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


 
Reply With Quote
 
 
 
 
Tony Arcieri
Guest
Posts: n/a
 
      09-27-2005
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

On 9/27/05, Tony Arcieri <> wrote:
> 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 bigdecim=

al.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
>
>



 
Reply With Quote
 
 
 
 
nobuyoshi nakada
Guest
Posts: n/a
 
      09-28-2005
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.

--
Nobu Nakada


 
Reply With Quote
 
Tony Arcieri
Guest
Posts: n/a
 
      09-28-2005
On 9/27/05, nobuyoshi nakada <> wrote:
> 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.

> > sample/test.rb:2037: Invalid char `\377' in expression

>
> 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


 
Reply With Quote
 
nobuyoshi nakada
Guest
Posts: n/a
 
      09-29-2005
Hi,

At Thu, 29 Sep 2005 04:13:50 +0900,
Tony Arcieri wrote in [ruby-talk:158130]:
> > > 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 tried with DLDFLAGS=-m32 on cygwin and it worked fine.
Can't you show the config.log file? OK to even send directly
to .

Or you can do ./configure CC='gcc -m64'.

> > > sample/test.rb:2037: Invalid char `\377' in expression

> >
> > 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.


I meant I committed a fix yesterday morning.

Wed Sep 28 08:12:18 2005 Nobuyoshi Nakada <>

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

--
Nobu Nakada


 
Reply With Quote
 
Tony Arcieri
Guest
Posts: n/a
 
      09-29-2005
On 9/28/05, nobuyoshi nakada <> wrote:

> 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 .


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 <>
>
> * 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


 
Reply With Quote
 
nobuyoshi nakada
Guest
Posts: n/a
 
      09-29-2005
Hi,

At Thu, 29 Sep 2005 15:05:04 +0900,
Tony Arcieri wrote in [ruby-talk:158196]:
> > 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 .

>
> 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 <>
> >
> > * 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.

--
Nobu Nakada


 
Reply With Quote
 
ts
Guest
Posts: n/a
 
      09-29-2005
>>>>> "n" == nobuyoshi nakada <> writes:

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


 
Reply With Quote
 
nobuyoshi nakada
Guest
Posts: n/a
 
      09-29-2005
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.


--
Nobu Nakada


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
trouble building Python 2.5.1 on solaris 10 mg Python 0 07-09-2008 04:02 PM
Building on Solaris and trouble with missing libcrypt_d Justin Johnson Ruby 1 05-27-2008 10:55 PM
Building ruby on Solaris (without root permissions). Jonathan Ruby 4 03-09-2007 04:36 AM
building DB_File with BerkleyDB in 64 bit mode on Solaris 5.8 Mike Perl 0 04-08-2004 08:53 PM
Solaris 9, problem building Python 2.1.1 Dave Harrison Python 0 07-16-2003 12:34 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57