ROOT/Ruby 64-bit solution on Mac OS 10.5

Hi, all,
I have searched extensively on this forum and the web, and haven’t been able to find a solution to my problem.

Has anyone found a work-around for building ROOT with Ruby enabled in Mac OS? If I understand the problem correctly, the Ruby that ships in OS 10.5 is not 64-bit compatible. I have tried rebuilding ruby from source and then building ROOT, but no luck.

Can anyone advise, or am I stuck waiting for a 64-bit Ruby? I did find a thread about PYROOT that suggested the same problem, only with python.

Thanks much!
-Mike

Hi,

The 64bits and 32bits builds are not mixeable. So you either need to build ruby in 64bits or build root in 32 bits mode.

Cheers,
Philippe

Thanks! I realized that when I built ruby, I was neglecting the “–enable-shared” flag. Oops. SO, now I have all of the pieces that I need.

However, when I go to build root, i get errors. Configuring with:

This works fine, and root is able to find all of the nexessary ruby files.

When I then make

I get the following errors:

bin/rmkdepend -R -fmath/genvector/src/3DConversions.d -Y -w 1000 -- -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Iinclude   -D_REENTRANT -pthread -D__cplusplus -- math/genvector/src/3DConversions.cxx
g++ -O2 -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Iinclude   -D_REENTRANT -pthread  -o math/genvector/src/3DConversions.o -c math/genvector/src/3DConversions.cxx
bindings/ruby/src/drr.cxx: In function 'VALUE drr_init(int, VALUE*, VALUE)':
bindings/ruby/src/drr.cxx:686: error: invalid conversion from 'const char*' to 'char*'
bindings/ruby/src/drr.cxx: In function 'VALUE drr_const_missing(VALUE, VALUE)':
bindings/ruby/src/drr.cxx:727: error: invalid conversion from 'const char*' to 'char*'
bindings/ruby/src/drr.cxx: In function 'VALUE drr_method_missing(int, VALUE*, VALUE)':
bindings/ruby/src/drr.cxx:758: error: invalid conversion from 'const char*' to 'char*'
bindings/ruby/src/drr.cxx: In function 'VALUE drr_generic_method(int, VALUE*, VALUE)':
bindings/ruby/src/drr.cxx:867: error: invalid conversion from 'const char*' to 'char*'
make: *** [bindings/ruby/src/drr.o] Error 1
make: *** Waiting for unfinished jobs....
mcc root$ 

Any thoughts? I looked around in drr.cxx, but I wasn’t able to figure out what went wrong.

Is it possible that I’ve omitted some necessary build/compile flags? Note that when I build compile ROOT without ruby enabled, everything works fine.

Has anyone out there gotten this to work on 10.5?

Move to a more recent version (eg 5.21/06). This problem had already been fixed in June.

Rene

If you use the ROOT trunk you will get now a $ROOTSYS/bin/ruby64 which is a 64-bit version (like python64). When building Ruby make sure you use
–enable-explicitlink, see root.cern.ch/root/HowtoRuby.html

Cheers, Fons.

Hello!

I just built the ruby bindings for Root in my Mac. There are two main issues you have to look after:

(a) The target architecture. By default, at least Leopard, comes with Ruby for PPC and i386, so you should use macosx in Root and not macosx64. You can also try with the Mac ports and install a 64-bit enabled Ruby.

(b) You should link libRuby as a bundle. Apparently, Ruby can not load C extensions as a dylib. This is very weird, but I confirmed it using dtruss. Ruby is looking only for files ending in .rb and .bundle. So, the actual command I used was:

I had configured initially Root with: ./configure macosx --enable-ruby

elathan@velka:~/devel/root> g++ -O2 -bundle -single_module -undefined dynamic_lookup -o lib/libRuby.bundle bindings/ruby/src/TRuby.o bindings/ruby/src/drr.o bindings/ruby/src/G__Ruby.o -ldl -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -lruby -Llib -lHist -lMathCore -Llib -lCore -lCint

elathan@velka:~/devel/root> file lib/libRuby.bundle
lib/libRuby.bundle: Mach-O bundle i386

I don’t know if Root’s build system is flexible enough to support a patch that will allow only libRuby and only for Mac OS X to build as a bundle. I will certainly have a look, though.

Regards,
Elias

Hi Elias,

we could make a link from the libRuby.so to libRuby.bundle so ruby can load it, but really ruby should be fixed to also support .so as Mac OS’s .so’s can now be used as what used to be bundles. Can you report this to the ruby developers.

Cheers, Fons.

Hello!

Dear Fons, unfortunately, I am afraid that making a symlink to point to libRuby.so will not work. Apparently, ruby is refusing to load a binary that is not a bundle.

I will try to further investigate with the Ruby developers the reason for this.

Regards,
Elias

In principle we do not support creating (or rather I very much avoid) creating bundles now that it is not needed anymore in OS X (already since 10.4) so Ruby developers have had ample opportunity to fix their code.

Cheers, Fons.

Things are working just great now. Thanks much, Elias.
-Mike