Bug#741242: libgeos-3.3.3: Linking against libgeos fails

Tobias Megies megies at geophysik.uni-muenchen.de
Mon Mar 10 11:27:14 UTC 2014


Hi Sebastiaan,

here is the tail of the failing basemap build output:

"""
gcc -pthread -shared build/temp.linux-x86_64-2.7/src/_geoslib.o
-L/usr/lib -L/usr/lib64 -L/home/megies/local/lib -Wl,-R/usr/lib
-Wl,-R/usr/lib64 -lgeos_c -lgeos -lpython2.7 -o
build/lib.linux-x86_64-2.7/_geoslib.so

/usr/bin/ld: cannot find -lgeos

collect2: error: ld returned 1 exit status

/usr/bin/ld: cannot find -lgeos

collect2: error: ld returned 1 exit status

error: Command "gcc -pthread -shared
build/temp.linux-x86_64-2.7/src/_geoslib.o -L/usr/lib -L/usr/lib64
-L/home/megies/local/lib -Wl,-R/usr/lib -Wl,-R/usr/lib64 -lgeos_c -lgeos
-lpython2.7 -o build/lib.linux-x86_64-2.7/_geoslib.so" failed with exit
status 1
"""

in the basemap install routine (in Python) the offending piece reads:

"""
extensions.append(Extension("_geoslib",['src/_geoslib.c'],
                            library_dirs=geos_library_dirs,
                            runtime_library_dirs=geos_library_dirs,
                            include_dirs=geos_include_dirs,
                            libraries=['geos_c','geos']))
"""

If I follow your advice and simply remove 'geos' from the libraries
section, the linking/compiling works without the manually added link to
"/usr/lib/libgeos.so". I will notify the developer/maintainer of
matplotlib basemap of these circumstances/findings.

So, I am not an expert on linking and if you consider linking against
libgeos C++ library bad practice I guess you can close this bug report.

Thanks for the quick feedback.

best,
Tobias



On 03/10/2014 12:13 PM, Sebastiaan Couwenberg wrote:
> Hi Tobias,
> 
>> I was trying to compile matplotlib basemap
>> (http://sourceforge.net/projects/matplotlib/files/matplotlib-
>> toolkits/basemap-1.0.7/) which depends on libgeos.
>> The compilation fails because matplotlib basemap tries to link against
>> "libgeos.so" but in "/usr/lib" only "libgeos-3.3.3-so" is present.
>>
>> When manually creating a link ("sudo ln -s /usr/lib/libgeos-3.3.3.so
>> /usr/lib/libgeos.so"), the compilation/linking works without problems.
>>
>> I think during installation this link should be created.
> 
> Creating library symlinks manuall is seldomly a good idea.
> 
> libgeos-3.3.3.so is the C++ library, linking against this is discouraged.
> Applications should like to the C API (libgeos_c.so) which is considered
> stable.
> 
> In de documentation for mathplotlib basemaps they document linking to the
> C API:
> 
> "
> If you already have it on your system, just set the environment variable
> GEOS_DIR to point to the location of libgeos_c and geos_c.h (if libgeos_c
> is in /usr/local/lib and geos_c.h is in /usr/local/include, set GEOS_DIR
> to /usr/local).
> "
> 
> See: https://github.com/matplotlib/basemap
> 
> Please try the above procedure to build mathplotlibs basemap with the GEOS
> C API. You may need to install libgeos-c1 if it's not already installed.
> 
> Kind Regards,
> 
> Bas
> 
> 

-- 
Dipl.-Geophys. Tobias Megies

Geophysikalisches Observatorium
Ludwigshöhe 8
82256 Fürstenfeldbruck

Ludwig-Maximilians-Universität
Department für Geo- und Umweltwissenschaften
Sektion Geophysik
Theresienstrasse 41/IV
80333 München

Tel: +49 (0) 89 2180-73981
     +49 (0) 89 2180-4326
Mail: tobias.megies at geophysik.uni-muenchen.de



More information about the Pkg-grass-devel mailing list