Problem Compiling GEOS-3.4.2 for Saucy Salamander

Asked by Morgan Fraughton

I am trying to compile and install GEOS-3.4.2 for in Saucy Salamander (configured with PHP, PYTHON, and RUBY.) The problem arises when I try the "make" command and I get this message:

/usr/bin/ld: cannot find -llibruby-1.9.1.so.1.9.1
collect2: error: ld returned 1 exit status
make[5]: *** [geos.la] Error 1
make[5]: Leaving directory `/home/morgan/Downloads/geos-3.4.2/swig/ruby'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/home/morgan/Downloads/geos-3.4.2/swig/ruby'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/morgan/Downloads/geos-3.4.2/swig/ruby'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/morgan/Downloads/geos-3.4.2/swig'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/morgan/Downloads/geos-3.4.2'
make: *** [all] Error 2

Its says it "/usr/bin/ld: cannot find -llibruby-1.9.1.so.1.9.1" but libruby-1.9.1.so.1.9.1 exists as /usr/lib libruby-1.9.1.so.1.9.1. Just like every other library does.

Why cant /usr/bin/ld find libruby-1.9.1.so.1.9.1???

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu geos Edit question
Assignee:
No assignee Edit question
Solved by:
Mark Rijckenberg
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

https://launchpad.net/ubuntu/+ppas?name_filter=geos

No already compiled version here?

Revision history for this message
Manfred Hampl (m-hampl) said :
#2

Looks like a typo error in a configuration file causing ld to search for "-libruby" instead of "libruby".

What are the five lines preceding the "/usr/bin/ld: cannot find -llibruby-1.9.1.so.1.9.1" error message?

Revision history for this message
Mark Rijckenberg (markrijckenberg) said :
#3

First run these Terminal commands:

sudo apt-get update

sudo apt-get install proj libjson0-dev xsltproc docbook-mathml docbook-xsl

sudo apt-get install postgresql-server-dev-9.1

sudo apt-get install gettext dblatex openjdk-7-jre openjdk-7-jdk icedtea-7-plugin libxml2-dev

sudo apt-get install swig php5-dev phpunit openjpeg-tools libopenjpeg-dev libkml-dev

sudo apt-get install libpoppler-dev expat libexpat1-dev libxerces-c-dev

sudo apt-get install libpoppler19

sudo apt-get install libcurl4-openssl-dev

sudo apt-get install g++ python-dev ruby

sudo apt-get install apache2 python-psycopg2 postgresql build-essential libapache2-mod-python

sudo apt-get install postgresql-8.3-postgis

Source: http://northwestspatial.com/wp/?p=340
Source: https://code.djangoproject.com/wiki/GeoDjangoUbuntuInstall

Next, follow these instructions:

https://github.com/libgeos/libgeos/blob/svn-trunk/INSTALL

I quote:

"
Linux: Make sure that /usr/local/lib is added to /etc/ld.so.conf
       Make sure that you run /sbin/ldconfig afterwards "

I personally recommend adding /usr/local/lib and /usr/lib to /etc/ld.so.conf

Then run this command:

sudo ldconfig

Then run this Terminal command in your home folder:

git clone git://github.com/libgeos/libgeos.git

Then follow these build instructions:

https://github.com/libgeos/libgeos

I quote:

"
BUILDING, TESTING, INSTALLING
=============================

Unix
----

Using Autotools:
  ./autogen.sh # in ${srcdir}, if obtained from SVN
  ${srcdir}/configure # in build dir

Using CMake:
  cmake ${srcdir} # in build dir

Now, all versions:
  make
  make check
  sudo make install
  sudo ldconfig
"

Hope this helps.

Revision history for this message
Best Mark Rijckenberg (markrijckenberg) said :
#4

For your information:

This whole build procedure works for me, but only when replacing

./configure --enable-python --enable-php --enable-ruby

with

./configure --enable-python --enable-php

So I have the same libruby-1.9.1.so.1.9.1 issue as you do when adding the --enable-ruby configure option.

I suggest reporting a bug for this libruby-1.9.1.so.1.9.1 issue.

I am also using Ubuntu 13.10 64-bit edition.

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

I might be completely wrong, but it seems to me that the configure script sets a wrong value for RUBY_LIB_DIR (probably "-llibruby-1.9.1.so.1.9.1" instead of "libruby-1.9.1.so.1.9.1"). So the linker command ends up with a double -l prefix -l-llibruby...

from geos configue script:
RUBY_LIB_DIR=`$RUBY -rrbconfig -e 'puts RbConfig::CONFIG["libdir"] || Config::CONFIG["libdir"]'`

What is the output of
ruby -rrbconfig -e 'puts RbConfig::CONFIG["libdir"]')
ruby -rrbconfig -e 'puts Config::CONFIG["libdir"]')

What are the few lines preceding the "/usr/bin/ld: cannot find -llibruby-1.9.1.so.1.9.1" error message?

Revision history for this message
Morgan Fraughton (morganfraughton) said :
#6

Thanks Mark Rijckenberg, that solved my question.

Revision history for this message
Morgan Fraughton (morganfraughton) said :
#7

I have used the suggestion from Mark and got around my issue simply by not using RUBY. Thanks for your help guys!

Revision history for this message
J. Ryan Earl (oss-a) said :
#8

Here's a patch to fix ruby compilation:

diff -uNr geos-3.4.2-orig/swig/ruby/Makefile.am geos-3.4.2/swig/ruby/Makefile.am
--- geos-3.4.2-orig/swig/ruby/Makefile.am 2013-08-25 17:10:32.000000000 +0200
+++ geos-3.4.2/swig/ruby/Makefile.am 2013-12-06 05:24:12.751028564 +0100
@@ -22,7 +22,7 @@
 # Build Ruby module as shared library
 rubyextensiondir_LTLIBRARIES = geos.la
 geos_la_SOURCES = geos_wrap.cxx
-geos_la_LIBADD = $(top_builddir)/capi/libgeos_c.la -l$(RUBY_SO_NAME)
+geos_la_LIBADD = $(top_builddir)/capi/libgeos_c.la $(RUBY_SO_NAME)

 # Only need to grab the capi header files
 geos_la_CPPFLAGS = -I$(top_builddir)/capi
diff -uNr geos-3.4.2-orig/swig/ruby/Makefile.in geos-3.4.2/swig/ruby/Makefile.in
--- geos-3.4.2-orig/swig/ruby/Makefile.in 2013-08-25 17:10:45.000000000 +0200
+++ geos-3.4.2/swig/ruby/Makefile.in 2013-12-06 05:55:10.560028099 +0100
@@ -334,7 +334,7 @@
 # Build Ruby module as shared library
 @ENABLE_RUBY_TRUE@rubyextensiondir_LTLIBRARIES = geos.la
 @ENABLE_RUBY_TRUE@geos_la_SOURCES = geos_wrap.cxx
-@ENABLE_RUBY_TRUE@geos_la_LIBADD = $(top_builddir)/capi/libgeos_c.la -l$(RUBY_SO_NAME)
+@ENABLE_RUBY_TRUE@geos_la_LIBADD = $(top_builddir)/capi/libgeos_c.la $(RUBY_SO_NAME)

 # Only need to grab the capi header files
 @ENABLE_RUBY_TRUE@geos_la_CPPFLAGS = -I$(top_builddir)/capi