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 <bascule / gmail.com> 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=gcc CFLAGS=-m64 LDFLAGS=-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
>
>