Mantis - ruby
Viewing Issue Advanced Details
3445 regular use block always 2009-02-21 22:31 2009-03-10 00:51
mswatters  
bwalton  
normal  
closed  
ruby fixed  
none    
none  
0003445: Missing rb_hash_foreach
Configure scripts check if rb_hash_foreach function exists
using the following command. if it does not exist, it is assumed the release level is prior to 1.8.2.

$ /opt/csw/bin/ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [sparc-solaris2.8]

$ /opt/csw/bin/ruby -r mkmf -e 'have_func("rb_hash_foreach")'
checking for rb_hash_foreach()... no
/opt/csw/bin/ruby -r mkmf -e 'have_func("rb_hash_foreach")'
I need this to be able to compile the ruby language bindings for subversion.
Issue History
2009-02-21 22:31 mswatters New Issue
2009-02-22 01:15 bwalton Note Added: 0005558
2009-02-22 01:15 bwalton Assigned To => bwalton
2009-02-22 01:15 bwalton Status new => confirmed
2009-02-22 03:29 bwalton Note Added: 0005559
2009-02-22 14:23 bwalton Note Added: 0005561
2009-02-23 17:49 mwatters Note Added: 0005562
2009-02-23 18:02 bwalton Note Added: 0005563
2009-03-02 19:47 philadmin Note Added: 0005600
2009-03-10 00:50 bwalton Note Added: 0005616
2009-03-10 00:50 bwalton Status confirmed => resolved
2009-03-10 00:50 bwalton Resolution open => fixed
2009-03-10 00:51 bwalton Status resolved => closed

Notes
(0005558)
bwalton   
2009-02-22 01:15   
The have_func feature of mkmf is a header test. The function is defined in /opt/csw/lib/ruby/1.8/$arch-solaris2.8/intern.h. I'll determine why the test is failing to find this function.

Confirmed on solaris 10 x86 (other platforms not tested yet).

-Ben
(0005559)
bwalton   
2009-02-22 03:29   
have_func builds a small c extension that requires the rb_hash_foreach symbol. This is linked against ruby-static. The ruby-static library isn't included with the package. I'll resolve this asap.
(0005561)
bwalton   
2009-02-22 14:23   
Modified the GAR build to allow libruby-static.a to be bundled. Have verified the problem is resolved after including this file. I'll have packages in testing/ by days end.
(0005562)
mwatters   
2009-02-23 17:49   
I have tested it and ruby itself works fine.

however, the dependency list is wrong or there is still a bug ;)

I found that I actually needed the gcc binary itself and not just the libraries
for mkmf...have_func work correctly

The output of mkmf.log is below.
without gcc it rb_hash_foreach returns no and fails with the shell command {path to gcc}/gcc not found.

$ cat mkmf.log
have_func: checking for rb_hash_foreach()... -------------------- yes

"/opt/csw/gcc4/bin/gcc -o conftest -I. -I/opt/csw/lib/ruby/1.8/sparc-solaris2.8 -I. -I/opt/csw/include -D_FILE_OFFSET_BITS=64 -I/opt/csw/include -O2 -pipe -mcpu=v8 -I/opt/csw/include -fPIC conftest.c -L. -L/opt/csw/lib -Wl,-R/opt/csw/lib -L. -L/opt/csw/gcc4/lib -mcpu=v8 -L/opt/csw/lib -R/opt/csw/lib/\\\\\\$ISALIST -R/opt/csw/lib -lruby-static -lrt -lpthread -ldl -lcrypt -lm -lc"
conftest.c: In function 't':
conftest.c:3: error: 'rb_hash_foreach' undeclared (first use in this function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))rb_hash_foreach; return 0; }
/* end */

"/opt/csw/gcc4/bin/gcc -o conftest -I. -I/opt/csw/lib/ruby/1.8/sparc-solaris2.8 -I. -I/opt/csw/include -D_FILE_OFFSET_BITS=64 -I/opt/csw/include -O2 -pipe -mcpu=v8 -I/opt/csw/include -fPIC conftest.c -L. -L/opt/csw/lib -Wl,-R/opt/csw/lib -L. -L/opt/csw/gcc4/lib -mcpu=v8 -L/opt/csw/lib -R/opt/csw/lib/\\\\\\$ISALIST -R/opt/csw/lib -lruby-static -lrt -lpthread -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { rb_hash_foreach(); return 0; }
/* end */

--------------------
(0005563)
bwalton   
2009-02-23 18:02   
Looking at how Debian package ruby, they've split out a ruby-dev package which includes the headers, mkmf module and libruby stuff. I think that would be a better solution for us too, thus the gcc dependency would only affect people that want to build native extensions. Will try to get to this today.
(0005600)
philadmin   
2009-03-02 19:47   
Well, that's also a side issue to, "doing dev work with ruby, requires remembering to link in the gcc4 runtime lib, because it was compiled with gcc".

A reminder that if there is a way to compile ruby with SUN compilers, this issue goes away.

Another reminder, that if there is any equivalent to "pkg-config" for ruby, with some "ruby.pc" like file... that file should mention required link args of
-R/opt/csw/gcc4/lib -L/opt/csw/gcc4/lib -l[whatever]
(0005616)
bwalton   
2009-03-10 00:50   
This issue should be fixed by the updated packages that will hit mirrors shortly.
-Ben