[R-sig-Geo] cannot install rgeos

Roger Bivand Roger.Bivand at nhh.no
Sat Aug 18 19:11:26 CEST 2012


On Sat, 18 Aug 2012, Martin Ivanov wrote:

> Dear Prof. Pebesma,
>
> sp and proj4 install just fine. I am having trouble with rgeos and rgdal.

Both require C++ libraries, and require that they are the same versions as 
the GEOS and GDAL binaries, as well as the rgeos and rgdal binaries. It 
looks as though C++ isn't deployed across the cluster consistently, and 
isn't the same as on your local machine. Start by getting rgdal and rgeos 
installed and running correctly locally.

An alternative is to try to build static binary packages, by removing the 
gdal and geos shared objects, so that the rgeos and rgdal configure steps 
revert to static - read the rgdal/configure.ac file for some indications. 
You'll need GDAL only static, with PROJ.4 static-linked; the same for 
GEOS. This is what is done for OSX; Windows package binaries are also 
static, but do not use configure.ac. For rgeos, you may need to add 
-lstdc++ manually. This isn't at all easy.

For GEOS, despite our using the C API consistently, the structure of GEOS 
itself requires linkage to the C++ GEOS ABI, and to libstdc++, so without 
static linkage, care is required. With rgdal, we do use the C++ API/ABI, 
but argably should go for a GSoC next year to move it to the C API, which 
is less problematic (hopefully).

I'm also curious that cluster use is important, given that neither of the 
packages is multithreaded nor parallelizable. Are you going to run 
simulations? Won't it be easier to re-jig your workflow to pre-process and 
post-process data on a single machine?

Roger

> I try to install rgdal with:
>
>  install.packages(pkgs="rgdal", 
> configure.args=c("LDFLAGS=-L/home-link/epaiv01/system/usr/lib64","PKG_CPPFLAGS=-I/home-link/epaiv01/system/usr/include", 
> "PKG_LIBS=-L/home-link/epaiv01/system/usr/lib64", 
> "--with-gdal-config=/home-link/epaiv01/system/usr/bin/gdal-config", 
> "--with-proj-lib=/home-link/epaiv01/system/usr/lib64", 
> "--with-proj-include=/home-link/epaiv01/system/usr/include"), type="source")
>
> it seems to compile ok, but at the testing whether the package can be 
> loaded it complains:
>
> ** testing if installed package can be loaded
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>   unable to load shared object 
> '/lustre/home/zdv/ep/epaiv01/R/x86_64-unknown-linux-gnu-library/2.15/rgdal/libs/rgdal.so':
>   /usr/java/default/jre/../lib/amd64/libstdc++.so.6: version 
> `GLIBCXX_3.4.14' not found (required by 
> /home-link/epaiv01/system/usr/lib64/libgdal.so.1)
> Error: loading failed
> Execution halted
> ERROR: loading failed
> * removing 
> â/lustre/home/zdv/ep/epaiv01/R/x86_64-unknown-linux-gnu-library/2.15/rgdalâ
>
> Is it possible that the compilation within R uses different compiler 
> than the one I loaded in the
> bash environment with:
> module load compiler/gnu/4.5 ?
> It seems to me that it is can be the case. How can I tell R to use 
> exactly the gnu/4.5 compiler
> and not something else?
>
> Best regards,
>
> Martin
>
>
> On 08/18/2012 05:11 PM, Edzer Pebesma wrote:
>> Hi,
>>
>> To me, this looks like an error in your gcc setup. Have you searched for
>> the error message you get? Do other packages, such as sp, install fine?
>>
>> On 08/18/2012 04:06 PM, Martin Ivanov wrote:
>>> Dear R users,
>>>
>>> I am having immense trouble trying to install the rgeos package on a
>>> Linux cluster. I have installed geos locally in the directory
>>> /home-link/epaiv01/system.
>>>
>>> The command
>>> install.packages(pkgs="rgeos",
>>> 
> configure.args=c("LDFLAGS=-L/home-link/epaiv01/system/usr/lib64","PKG_CPPFLAGS=-I/home-link/epaiv01/system/usr/include",
>>> "PKG_LIBS=-L/home-link/epaiv01/system/usr/lib64",
>>> "--with-geos-config=/home-link/epaiv01/system/usr/bin/geos-config"))
>>>
>>> fails with the complaint:
>>> checking for C compiler default output file name... configure: error: C
>>> compiler cannot create executables
>>> See `config.log' for more details.
>>> ERROR: configuration failed for package ârgeosâ
>>> * removing
>>> 
> â/lustre/home/zdv/ep/epaiv01/R/x86_64-unknown-linux-gnu-library/2.15/rgeosâ
>>>
>>> Oddly, if I get *into* the rgeos directory after unpacking it, and run:
>>> LDFLAGS=-L/home-link/epaiv01/system/usr/lib64
>>> PKG_CPPFLAGS=-I/home-link/epaiv01/system/usr/include
>>> PKG_LIBS=-L/home-link/epaiv01/system/usr/lib64 ./configure
>>> --with-geos-config=/home-link/epaiv01/system/usr/bin/geos-config
>>>
>>> the configure phase passes normally. I am attaching the two log files,
>>> which are identical until the command :
>>>
>>> configure:1761: gcc -std=gnu99 -march=core2 -O3 -I/usr/local/include
>>> -I/home-link/epaiv01/system/usr/include
>>> -I/home-link/epaiv01/system/usr/include -L/home-link/epaiv01/syste
>>> m/usr/lib64 conftest.c  -L/home-link/epaiv01/system/usr/lib64
>>> -L/home-link/epaiv01/system/usr/lib64 -lgeos
>>> -L/home-link/epaiv01/system/usr/lib64 -lgeos_c >&5
>>>
>>> which in the failed configure complains that:
>>>
>>> /home-link/epaiv01/system/usr/lib64/libgeos.so: undefined reference to
>>> `std::basic_ostream<char, std::char_traits<char> >&
>>> std::__ostream_insert<char, std::char_traits<char> >
>>> (std::basic_ostream<char, std::char_traits<char> >&, char const*,
>>> long)@GLIBCXX_3.4.9'
>>> /home-link/epaiv01/system/usr/lib64/libgeos.so: undefined reference to
>>> `std::_List_node_base::_M_unhook()@GLIBCXX_3.4.14'
>>> /home-link/epaiv01/system/usr/lib64/libgeos.so: undefined reference to
>>> `std::basic_ostream<char, std::char_traits<char> >&
>>> std::basic_ostream<char, std::char_traits<char> >::_
>>> M_insert<void const*>(void const*)@GLIBCXX_3.4.9'
>>> /home-link/epaiv01/system/usr/lib64/libgeos.so: undefined reference to
>>> `std::ctype<char>::_M_widen_init() const at GLIBCXX_3.4.11'
>>> /home-link/epaiv01/system/usr/lib64/libgeos.so: undefined reference to
>>> `std::basic_ostream<char, std::char_traits<char> >&
>>> std::basic_ostream<char, std::char_traits<char> >::_
>>> M_insert<unsigned long>(unsigned long)@GLIBCXX_3.4.9'
>>> /home-link/epaiv01/system/usr/lib64/libgeos.so: undefined reference to
>>> `std::basic_ostream<char, std::char_traits<char> >&
>>> std::basic_ostream<char, std::char_traits<char> >::_
>>> M_insert<double>(double)@GLIBCXX_3.4.9'
>>> /home-link/epaiv01/system/usr/lib64/libgeos.so: undefined reference to
>>> `std::_List_node_base::_M_hook(std::_List_node_base*)@GLIBCXX_3.4.14'
>>>
>>>
>>> I am really at a loss. I have no clue whatsoever what to try any further.
>>> Any suggestions will be appreciated.
>>> Best regards,
>>>
>>> -- 
>>> Dr. Martin Ivanov
>>> Eberhard-Karls-Universität Tübingen
>>> Mathematisch-Naturwissenschaftliche Fakultät
>>> Fachbereich Geowissenschaften
>>> Water & Earth System Science (WESS)
>>> Keplerstraße 17, 72074 Tübingen, Deutschland
>>> Tel. +4970712975023
>>>
>>>
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>
>
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list