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

Couldn't load the GEOS CAPI library

awcassidy opened this issue · comments

I was wondering if anyone knew of a reason why the error "Couldn't load the GEOS CAPI library" would occur on a Windows x64 machine. GEOS is installed at C:\OSGeo4W64\bin and I already created the system environment variable pointing to that directory. I was trying to follow the instructions here:
https://stackoverflow.com/questions/22297117/rgeo-on-ruby-under-windows-how-to-enable-geos-support.

I installed ffi-geos and my code is just one line: require 'ffi-geos'

Here's what I get:

C:\Ruby22-x64\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/Users/Alecia/.RubyMine2017.1/config/scratches/scratch_6.rb
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/ffi-geos-1.2.0/lib/ffi-geos.rb:1074:in rescue in <module:FFIGeos>': Couldn't load the GEOS CAPI library. (LoadError) from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/ffi-geos-1.2.0/lib/ffi-geos.rb:1056:in module:FFIGeos'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/ffi-geos-1.2.0/lib/ffi-geos.rb:52:in <module:Geos>' from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/ffi-geos-1.2.0/lib/ffi-geos.rb:8:in <top (required)>'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:133:in require' from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:133:in rescue in require'
from C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:40:in require' from C:/Users/Alecia/.RubyMine2017.1/config/scratches/scratch_6.rb:1:in <top (required)>'
from -e:1:in load' from -e:1:in

'

Process finished with exit code 1

commented

Can you make sure that the GEOS_LIBRARY_PATH variable is definitely set and pointed to the right location? Maybe put a puts statement in there somewhere just inside of the search_paths method for instance? Just want to make sure that the env variable is getting through to the code that needs it.

Hi Dark-Panda,
Thank you so much! It was not recognizing the environment variable. Once I followed your instructions, I was able to realize the problem and correct the issue. THANKS!

commented

Excellent, glad it worked out. Have fun with your spatial work.

We're running into this issue as well but only on heroku.

We're successfully using RGEO with this build back https://github.com/cyberdelia/heroku-geo-buildpack

Awesome work and thank you for putting this together etc...

Any guidance would be hugely appreciated!