Geos installation in non-standard location

2019-06-06 00:43发布

问题:

I'm running on nitrous.io and trying to install the rgeo gem using ruby 2.0.0-p353.

I don't have sudo access, so I tried to compile and install geos from source.

Once I downloaded and untarred the source files, I cd into the source folder and run

mkdir /home/action/local && ./configure --prefix=/home/action/local
make && make install

This runs for a bit. I then run

gem install rgeo -- --with-geos-dir=/home/action/local

Things look alright, but if I hop into a terminal I get

RGeo::Geos.supported?
> false

Looking back over the mkmf.log file, I see these lines:

/usr/bin/ld: cannot find -lgeos                                                                                                                                                    
/usr/bin/ld: cannot find -lgeos_c                                                                                                                                                  
/usr/bin/ld: cannot find -lgeos                                                                                                                                                    
/usr/bin/ld: cannot find -lgeos_c

This blog post: http://blog.thefrontiergroup.com.au/page/2/ mentions creating symbolic links to fix this issue:

cd /usr/lib
sudo ln -s libgeos-3.3.3.so libgeos.so
sudo ln -s libgeos-3.3.3.so libgeos.so.1

libgeos isn't installed to usr/lib for me, it's in /home/action/local/lib and when I check that directory I see libgeos.so is already symlinked to libgeos-x.x.x.so.

If I switch ruby versions to 1.9.3-p392 and run the gem installation line, everything works as planned.

On my MacBook Pro I can successfully use rgeo with ruby 2.0.0-p395, but the geos library is installed by homebrew and therefore in a path rgeo is expecting.

Was there a change with ruby 2.0 that affects compiling gems?

I'm using RVM on all machines