build problems with 1.8, solaris and sparc options

D

Daniel Berger

Hi all,

Solaris 9
gcc 3.2.2
Ruby 1.8 (2003-07-07)
ld: Software Generation Utilities - Solaris Link Editors: 5.9-1.343
SunOS sp5wd-b1 5.9 Generic sun4u sparc SUNW,Sun-Blade-100

I decided to tinker with a couple of gcc options when building Ruby 1.8.
I used this as my $CFLAGS:

-g -O2 -m64 -mcpu=ultrasparc

Things seemed to go ok during make until it got to bigdecimal.c

...
compiling bigdecimal
gcc -fPIC -g -O2 -m64 -mcpu=ultrasparc -I. -I/usr/local/src/ruby
-I/usr/local/src/ruby -I/usr/local/src/ruby/ext/bigdecimal -c bigdecimal.c
gcc -Wl,-G -L"/usr/local/src/ruby" -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
*** Error code 1
make: Fatal error: Command failed for target `bigdecimal.so'
Current working directory /usr/local/src/ruby/ext/bigdecimal
*** Error code 1
make: Fatal error: Command failed for target `all'

Any ideas?

Regards,

Dan
 
D

Dan Debertin

This is compiled 64-bit:
gcc -fPIC -g -O2 -m64 -mcpu=ultrasparc -I. -I/usr/local/src/ruby
-I/usr/local/src/ruby -I/usr/local/src/ruby/ext/bigdecimal -c bigdecimal.c

This isn't:
gcc -Wl,-G -L"/usr/local/src/ruby" -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

You can't mix 32-bit and 64-bit libraries/object files. At the link
phase, ld doesn't know you're trying to make a 64-bit executable, so
it looks under /usr/lib for -ldl, -lm, etc., instead of
/usr/lib/64. (BTW, 'elfdump -e' can be invaluable in diagnosing
problems like this.)

An even nastier surprise is in store for you if you sneak -m64 into
the CFLAGS of the second command -- your libgcc_s is probably compiled
32-bit, preventing it from being used with any 64-bit libs or
programs.

At this point, using gcc to build 64-bit executables under Solaris is
IMO too much of an ordeal.


Dan
 
N

nobu.nokada

Hi,

At Thu, 10 Jul 2003 11:57:56 +0900,
Dan said:
This is compiled 64-bit:

This isn't:

You can't mix 32-bit and 64-bit libraries/object files. At the link
phase, ld doesn't know you're trying to make a 64-bit executable, so
it looks under /usr/lib for -ldl, -lm, etc., instead of
/usr/lib/64. (BTW, 'elfdump -e' can be invaluable in diagnosing
problems like this.)

Then, try configure with LDFLAGS=-m64, or with CC='gcc -m64'
instead of CFLAGS.
 
D

Daniel Berger

Hi,

At Thu, 10 Jul 2003 11:57:56 +0900,



Then, try configure with LDFLAGS=-m64, or with CC='gcc -m64'
instead of CFLAGS.

Ok - tried again with:

CC='gcc -g -O2 -m64 -mcpu=ultrasparc'
LDFLAGS='-m64'

Seemed to go alright, although I got several warnings from the Syck libs:

gcc -g -O2 -m64 -mcpu=ultrasparc -fPIC -g -O2 -I. -I/usr/local/src/ruby
-I/usr/local/src/ruby -I/usr/l
ocal/src/ruby/ext/syck -DHAVE_ST_H -c handler.c
handler.c: In function `syck_xprivate':
handler.c:125: warning: cast to pointer from integer of different size
handler.c: In function `syck_taguri':
handler.c:135: warning: cast to pointer from integer of different size
gcc -g -O2 -m64 -mcpu=ultrasparc -fPIC -g -O2 -I. -I/usr/local/src/ruby
-I/usr/local/src/ruby -I/usr/l
ocal/src/ruby/ext/syck -DHAVE_ST_H -c implicit.c
implicit.re: In function `syck_type_id_to_uri':
implicit.re:146: warning: cast to pointer from integer of different size
implicit.re:159: warning: cast to pointer from integer of different size
gcc -g -O2 -m64 -mcpu=ultrasparc -fPIC -g -O2 -I. -I/usr/local/src/ruby
-I/usr/local/src/ruby -I/usr/l
ocal/src/ruby/ext/syck -DHAVE_ST_H -c node.c
node.c: In function `syck_alloc_node':
node.c:20: warning: cast to pointer from integer of different size
node.c: In function `syck_alloc_map':
node.c:47: warning: cast to pointer from integer of different size
node.c:50: warning: cast to pointer from integer of different size
node.c:51: warning: cast to pointer from integer of different size
node.c: In function `syck_alloc_seq':
node.c:65: warning: cast to pointer from integer of different size
node.c:68: warning: cast to pointer from integer of different size
node.c: In function `syck_alloc_str':
node.c:82: warning: cast to pointer from integer of different size
node.c: In function `syck_new_str2':
node.c:104: warning: cast to pointer from integer of different size
node.c: In function `syck_map_add':
node.c:163: warning: cast to pointer from integer of different size
node.c:164: warning: cast to pointer from integer of different size
node.c: In function `syck_map_update':
node.c:192: warning: cast to pointer from integer of different size
node.c:193: warning: cast to pointer from integer of different size
node.c: In function `syck_seq_add':
node.c:272: warning: cast to pointer from integer of different size
gcc -g -O2 -m64 -mcpu=ultrasparc -fPIC -g -O2 -I. -I/usr/local/src/ruby
-I/usr/local/src/ruby -I/usr/l
ocal/src/ruby/ext/syck -DHAVE_ST_H -c rubyext.c
gcc -g -O2 -m64 -mcpu=ultrasparc -fPIC -g -O2 -I. -I/usr/local/src/ruby
-I/usr/local/src/ruby -I/usr/l
ocal/src/ruby/ext/syck -DHAVE_ST_H -c syck.c
syck.c: In function `syck_strndup':
syck.c:36: warning: cast to pointer from integer of different size
syck.c: In function `syck_parser_reset_cursor':
syck.c:132: warning: cast to pointer from integer of different size
syck.c: In function `syck_new_parser':
syck.c:166: warning: cast to pointer from integer of different size
syck.c:168: warning: cast to pointer from integer of different size
syck.c: In function `syck_parser_file':
syck.c:302: warning: cast to pointer from integer of different size
syck.c: In function `syck_parser_str':
syck.c:321: warning: cast to pointer from integer of different size
syck.c: In function `syck_parser_add_level':
syck.c:366: warning: cast to pointer from integer of different size
gcc -g -O2 -m64 -mcpu=ultrasparc -fPIC -g -O2 -I. -I/usr/local/src/ruby
-I/usr/local/src/ruby -I/usr/l
ocal/src/ruby/ext/syck -DHAVE_ST_H -c token.c
token.re: In function `yylex':
token.re:434: warning: cast to pointer from integer of different size
token.re:467: warning: cast to pointer from integer of different size
token.re:474: warning: cast to pointer from integer of different size
token.re:503: warning: cast to pointer from integer of different size
token.re:489: warning: cast to pointer from integer of different size
token.re:514: warning: cast to pointer from integer of different size
token.re:543: warning: cast to pointer from integer of different size
token.re:550: warning: cast to pointer from integer of different size
token.re:575: warning: cast to pointer from integer of different size
token.re:557: warning: cast to pointer from integer of different size
token.re:589: warning: cast to pointer from integer of different size
token.re:621: warning: cast to pointer from integer of different size
token.re:628: warning: cast to pointer from integer of different size
token.re:681: warning: cast to pointer from integer of different size
token.re:649: warning: cast to pointer from integer of different size
token.re:658: warning: cast to pointer from integer of different size
token.re:708: warning: cast to pointer from integer of different size
token.re:726: warning: cast to pointer from integer of different size
token.re:750: warning: cast to pointer from integer of different size
token.re:833: warning: cast to pointer from integer of different size
token.re:840: warning: cast to pointer from integer of different size
token.re:876: warning: cast to pointer from integer of different size
token.re:865: warning: cast to pointer from integer of different size

No errors, though. However, when I run make test, this is the result:
make test
/usr/local/src/ruby/sample/test.rb:346:in `r': wrong number of
arguments(1 for 0) (ArgumentError)
from /usr/local/src/ruby/sample/test.rb:346
not ok assignment 68 -- /usr/local/src/ruby/sample/test.rb:113
not ok assignment 69 -- /usr/local/src/ruby/sample/test.rb:114
not ok assignment 70 -- /usr/local/src/ruby/sample/test.rb:115
not ok assignment 71 -- /usr/local/src/ruby/sample/test.rb:116
not ok assignment 72 -- /usr/local/src/ruby/sample/test.rb:117
not ok assignment 73 -- /usr/local/src/ruby/sample/test.rb:118
not ok assignment 74 -- /usr/local/src/ruby/sample/test.rb:119
not ok assignment 75 -- /usr/local/src/ruby/sample/test.rb:120
not ok assignment 77 -- /usr/local/src/ruby/sample/test.rb:123
not ok assignment 78 -- /usr/local/src/ruby/sample/test.rb:124
not ok assignment 80 -- /usr/local/src/ruby/sample/test.rb:126
not ok assignment 81 -- /usr/local/src/ruby/sample/test.rb:127
not ok assignment 82 -- /usr/local/src/ruby/sample/test.rb:129
not ok assignment 84 -- /usr/local/src/ruby/sample/test.rb:131
not ok assignment 85 -- /usr/local/src/ruby/sample/test.rb:132
not ok assignment 86 -- /usr/local/src/ruby/sample/test.rb:133
not ok assignment 87 -- /usr/local/src/ruby/sample/test.rb:134
not ok assignment 88 -- /usr/local/src/ruby/sample/test.rb:135
not ok assignment 89 -- /usr/local/src/ruby/sample/test.rb:136
not ok assignment 90 -- /usr/local/src/ruby/sample/test.rb:137
not ok assignment 91 -- /usr/local/src/ruby/sample/test.rb:138
not ok assignment 92 -- /usr/local/src/ruby/sample/test.rb:139
not ok assignment 94 -- /usr/local/src/ruby/sample/test.rb:142
not ok assignment 95 -- /usr/local/src/ruby/sample/test.rb:143
not ok assignment 96 -- /usr/local/src/ruby/sample/test.rb:144
not ok assignment 98 -- /usr/local/src/ruby/sample/test.rb:146
not ok assignment 99 -- /usr/local/src/ruby/sample/test.rb:147
not ok assignment 100 -- /usr/local/src/ruby/sample/test.rb:148
not ok assignment 101 -- /usr/local/src/ruby/sample/test.rb:149
not ok assignment 104 -- /usr/local/src/ruby/sample/test.rb:153
not ok assignment 106 -- /usr/local/src/ruby/sample/test.rb:155
not ok assignment 108 -- /usr/local/src/ruby/sample/test.rb:157
not ok assignment 110 -- /usr/local/src/ruby/sample/test.rb:159
not ok assignment 111 -- /usr/local/src/ruby/sample/test.rb:160
not ok assignment 113 -- /usr/local/src/ruby/sample/test.rb:163
not ok assignment 115 -- /usr/local/src/ruby/sample/test.rb:165
not ok assignment 119 -- /usr/local/src/ruby/sample/test.rb:169
not ok assignment 120 -- /usr/local/src/ruby/sample/test.rb:170
not ok assignment 123 -- /usr/local/src/ruby/sample/test.rb:174
not ok assignment 124 -- /usr/local/src/ruby/sample/test.rb:175
not ok assignment 125 -- /usr/local/src/ruby/sample/test.rb:176
not ok assignment 126 -- /usr/local/src/ruby/sample/test.rb:177
not ok assignment 127 -- /usr/local/src/ruby/sample/test.rb:178
not ok assignment 128 -- /usr/local/src/ruby/sample/test.rb:179
not ok assignment 129 -- /usr/local/src/ruby/sample/test.rb:180
not ok assignment 130 -- /usr/local/src/ruby/sample/test.rb:181
not ok assignment 132 -- /usr/local/src/ruby/sample/test.rb:184
not ok assignment 134 -- /usr/local/src/ruby/sample/test.rb:186
not ok assignment 136 -- /usr/local/src/ruby/sample/test.rb:188
not ok assignment 138 -- /usr/local/src/ruby/sample/test.rb:190
not ok assignment 139 -- /usr/local/src/ruby/sample/test.rb:191
not ok assignment 142 -- /usr/local/src/ruby/sample/test.rb:195
not ok assignment 143 -- /usr/local/src/ruby/sample/test.rb:196
not ok assignment 144 -- /usr/local/src/ruby/sample/test.rb:197
not ok assignment 145 -- /usr/local/src/ruby/sample/test.rb:198
not ok assignment 146 -- /usr/local/src/ruby/sample/test.rb:199
not ok assignment 147 -- /usr/local/src/ruby/sample/test.rb:200
not ok assignment 148 -- /usr/local/src/ruby/sample/test.rb:201
not ok assignment 149 -- /usr/local/src/ruby/sample/test.rb:202
not ok assignment 150 -- /usr/local/src/ruby/sample/test.rb:203
not ok assignment 152 -- /usr/local/src/ruby/sample/test.rb:206
not ok assignment 154 -- /usr/local/src/ruby/sample/test.rb:208
not ok assignment 156 -- /usr/local/src/ruby/sample/test.rb:210
not ok assignment 157 -- /usr/local/src/ruby/sample/test.rb:211
not ok assignment 159 -- /usr/local/src/ruby/sample/test.rb:213
not ok assignment 160 -- /usr/local/src/ruby/sample/test.rb:214
not ok assignment 163 -- /usr/local/src/ruby/sample/test.rb:218
not ok assignment 165 -- /usr/local/src/ruby/sample/test.rb:220
not ok assignment 167 -- /usr/local/src/ruby/sample/test.rb:222
not ok assignment 168 -- /usr/local/src/ruby/sample/test.rb:223
not ok assignment 170 -- /usr/local/src/ruby/sample/test.rb:225
not ok assignment 171 -- /usr/local/src/ruby/sample/test.rb:226
not ok assignment 173 -- /usr/local/src/ruby/sample/test.rb:229
not ok assignment 175 -- /usr/local/src/ruby/sample/test.rb:231
not ok assignment 178 -- /usr/local/src/ruby/sample/test.rb:234
not ok assignment 180 -- /usr/local/src/ruby/sample/test.rb:236
not ok assignment 181 -- /usr/local/src/ruby/sample/test.rb:237
test failed
*** Error code 1
make: Fatal error: Command failed for target `test'

Thinking I could ignore the test failure I tried to install anyway:
make install
./miniruby ./instruby.rb --dest-dir="" --make="make" --mflags=""
--make-flags="" --mantype="man"
install -c -m 0755 ruby /opt/bin/ruby
/usr/local/src/ruby/lib/fileutils.rb:415:in `sysread': sysread for
buffered IO (IOError)
from /usr/local/src/ruby/lib/fileutils.rb:415:in `copy_stream'
from /usr/local/src/ruby/lib/fileutils.rb:403:in `copy_file'
from /usr/local/src/ruby/lib/fileutils.rb:402:in `open'
from /usr/local/src/ruby/lib/fileutils.rb:402:in `copy_file'
from /usr/local/src/ruby/lib/fileutils.rb:401:in `open'
from /usr/local/src/ruby/lib/fileutils.rb:401:in `copy_file'
from /usr/local/src/ruby/lib/fileutils.rb:643:in `install'
from /usr/local/src/ruby/lib/fileutils.rb:640:in `fu_each_src_dest'
from /usr/local/src/ruby/lib/fileutils.rb:640:in `install'
from ./instruby.rb:58:in `install'
from ./instruby.rb:58:in `install'
from ./instruby.rb:98
*** Error code 1
make: Fatal error: Command failed for target `install'

Nope. Any ideas?

Regards,

Dan
 
N

nobu.nokada

Hi,

At Fri, 11 Jul 2003 00:55:43 +0900,
Daniel said:
Seemed to go alright, although I got several warnings from the Syck libs:

These seem to be because syck.h lacks #include said:
No errors, though. However, when I run make test, this is the result:

Same as reported by Akira Yamada.
Thinking I could ignore the test failure I tried to install anyway:

./miniruby ./instruby.rb --dest-dir="" --make="make" --mflags=""
--make-flags="" --mantype="man"
install -c -m 0755 ruby /opt/bin/ruby
/usr/local/src/ruby/lib/fileutils.rb:415:in `sysread': sysread for
buffered IO (IOError)

How are FILE_COUNT and FILE_READEND defined in config.h?
 

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

Forum statistics

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

Latest Threads

Top