[Gdal-dev] Ruby Bindings Update

Frank Warmerdam warmerdam at pobox.com
Mon Jun 26 19:05:20 EDT 2006


Charlie Savage wrote:
> 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.

Charlie,

When building without libtool the GDAL configure will try to add
-fPIC to CFLAGS if it works on the system.  Many systems, not just
SELinux, require this for proper operation.   However, with libtool
builds I think it is omitted and is provided internally by libtool.

I am afraid I am uncertain how the builds of some of the SWIG extensions
works.  If it uses the same build environment as GDAL then it should
inherit the correct settings either from CFLAGS or from libtool.  However,
if the logic is custom then something appropriate will need to be done.

I know that the python bindings use setup.py to build the extension and
this is completely distinct from the normal GDAL build system making it
hard to ensure that things are done properly.

> 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.

ok, cool.

> 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.

I have built with newer visual studios that produce manifest files, which
I understood needed to be stored in the same directory as the DLLs.  There
is some magic in the makefiles to handle this.  I haven't heard of mt.exe
before.   I think I'll need to setup a proper VS 2005 environment.

> 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.

I'd test it on my system but it is pretty ancient and it might not
be worth the trouble.

> 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.

Cool, thanks.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list