[Gdal-dev] Ruby Bindings Update

Charlie Savage cfis at interserv.com
Fri Jun 23 16:32:16 EDT 2006


Summary
-----------

I've finally had a chance to look over the Ruby bindings again.  I 
noticed a few build issues that I wanted to run by the list, see below 
for more info.

Overall, the Ruby bindings seem in good shape to me for OGR and OSR. 
There is a full set of unit tests for these modules in the gdal autotest 
project.

However, they are not tested, and presumably do not work, for GDAL. 
Most likely there are a couple api calls that need a little SWIG 
tweaking.  Anyway, I don't have plans to do this since I only need the 
OGR part of the bindings.  So if someone wants to make a final push on 
GDAL let me know and I can point you in the right direction.

Onto the build issues....


Linux - Fedora Core 5, Dell Dimension machine
--------------------------

Compiling and installing the bindings works fine using the standard 
build system (./configure, make, make install).

Issue #1 - However, you can't use them due to selinux errors:

     Cannot restore segment prot after reloc

This has to do with text relocations.  The solution turns out to be 
fairly simple, add -fpic or -fPIC when building shared libraries (like 
the Ruby bindings).

Should I

a) add this parameter to CFLAGS in the RubyMakefile.mk

- or -

b) should this be added as a global build flag?  I'd imagine all the 
other SWIG extensions, and the gdal shared library itself, should run 
into the same issue.


Issue #2

Ruby 1.8.4 moved its extension library from 
/usr/lib/site-ruby/i386-linux to /usr/lib/ruby/site-ruby/i386-linux

No big deal, since I ask Ruby where the directory is on installation. 
However, it turns out that on a fresh ruby install the i386-linux 
directory doesn't exist.  So the makefile now has a check for this.


Windows - VC 2005 NET
--------------------------
Another library issue.  With VC.NET 2005 all dlls must include an 
embedded manifest at resource id #2.  Yeah, I know, why????  Anyway, 
more information then you'd ever want to know about this is here:

http://www.grimes.demon.co.uk/workshops/fusWSThirteen.htm

Here's the issue.  If you build with Visual Studio, the manifest gets 
embedded correctly.  If you use nmake, then it doesn't and you have to 
add it manually use mt.exe (see link above).  Once again, this is 
another global issue that would affect any SWIG built extension.  It 
ought to also affect gdal.dll, but that seems to work for me, don't know 
  why.


Windows - MingW
--------------------------
Works, no issues


Os X
-------
Ken-ichi has reported that the bindings don't build on the Mac. 
Unfortunately, I can't test that since I don't have one.  Not sure what 
to do about that.


SWIG Version
------------

Last - I vaguely remember that the SWIG generated wrappers for Ruby were 
  after swig 1.3.28 but before 1.3.29.  I see Ari has updated Perl to 
1.3.29, the latest SWIG release, so I'll make sure the Ruby bindings are 
at the same level.

Charlie



More information about the Gdal-dev mailing list