dark-panda / ffi-geos

ffi-geos is an implementation of the GEOS Ruby bindings in Ruby via FFI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crashes out ruby environment at run time

georgepalmer opened this issue · comments

Hi,

I'm using this gem with RGeo. I'm able to install the gem fine and add it to my environment but when I call a method in RGeo that calls through to the library it crashes Ruby with the following error:

dyld: lazy symbol binding failed: Symbol not found: _initGEOS_r
  Referenced from: /Users/george/.rvm/gems/ruby-1.9.3-p327@propertydetective/gems/rgeo-0.3.19/lib/rgeo/geos/geos_c_impl.bundle
  Expected in: flat namespace

dyld: Symbol not found: _initGEOS_r
  Referenced from: /Users/george/.rvm/gems/ruby-1.9.3-p327@propertydetective/gems/rgeo-0.3.19/lib/rgeo/geos/geos_c_impl.bundle
  Expected in: flat namespace

/Users/george/.rvm/gems/ruby-1.9.3-p327@propertydetective/gems/rgeo-0.3.19/lib/rgeo/geos/capi_factory.rb:120: [BUG] Segmentation fault

My ruby version is bang up to date (ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.2.0]) and I've tried this with the latest rgeo too that calls through. So any ideas what's causing this? My initial thoughts are it's library related but then I'm confused as to why it would install in the first place. I've done some digging around on Google and debugging myself but after a few hours I'm completely lost as to where to look now. Any ideas of the cause?

George

commented

Can you check to make sure that you're actually using ffi-geos with rgeo? rgeo has multiple drivers for the GEOS library, one of which wraps around ffi-geos and one that wraps around a bundled library that comes with rgeo itself. The errors you mention above reference the built-in native wrapper that comes with rgeo rather than the ffi-geos wrapper from what I can tell. If that's the case, then you may want to post the ticket the rgeo tracker. I think you need to actually enable ffi-geos within rgeo, as the native interface is preferred over the ffi-based one. You actually have to call RGeo::Geos.preferred_native_interface = :ffi to have it override the defaults unless the native interface is completely unavailable, for instance.

There is a possibility that the GEOS libraries being used are getting mixed up, as I've seen that happen before where gem A was using one version of the GEOS library and gem B was using a different version and everything blew up, but it doesn't look like that's what's going on here.

Thanks - I tried to the preferred_native_interface option but it's still results in the same problem (although it is at least coming from RGeo c impl this time). Clearly this is an issue with the RGeo lib as ffi-geos isn't seen in the 1800 line stack trace (!) so I'll close the ticket here and open one there.

Thanks for your help