[R-sig-Geo] Issues installing rgeos on linux server

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed Jun 21 10:31:56 CEST 2017


Would it be helpful if we kept a docker file somewhere, that shows how
to install rgeos/rgdal with custom installed libraries? For sf, I
maintain one here:

https://github.com/edzer/sfr/tree/master/inst/docker/custom

On 20/06/17 22:35, Matthew Simpson wrote:
> Thank you, this was very helpful. It turned out the issue was that I was
> using the development version - I had cloned the github repository and
> installed from there. Downloading the tarball for the latest stable release
> solved the problem. I went ahead and did the same thing for GDAL and proj.4
> and reinstalled rgdal just to be safe. And sure enough, before reinstalling
> rgdal was complaining about missing proj_defs.dat, even though it existed
> in the proj.4/share folder. But now it's working just fine.
> 
> For posterity, my full commands to get GEOS, GDAL, proj.4, rgdal, and rgeos
> installed from source on a linux server (CentOS 7.3.1611) are below.
> 
> cd /path/to/src/geos/
> wget http://download.osgeo.org/geos/geos-3.6.1.tar.bz2
> tar -vxjf geos-3.6.1.tar.bz2
> cd geos-3.6.1
> ./configure --prefix=/path/to/install/geos
> make
> make check
> make install
> 
> cd /path/to/src/gdal
> wget http://download.osgeo.org/gdal/2.2.0/gdal-2.2.0.tar.gz
> tar -xvzf gdal-2.2.0.tar.gz
> cd gdal-2.2.0
> ./autogen.sh
> ./configure --prefix=/path/to/install/gdal
> make
> ## there is no make check
> make install
> 
> cd /path/to/src/proj.4/
> wget http://download.osgeo.org/proj/proj-4.9.3.tar.gz
> tar -xvzf proj-4.9.3.tar.gz
> cd proj-4.9.3
> ./configure --prefix=/path/to/install/proj.4
> make
> make check
> make install
> 
> echo 'export
> PATH=/path/to/install/gdal/bin:/path/to/install/proj.4/bin:/path/to/install/geos/bin:$PATH'
>>> ~/.bash_profile
> echo 'export
> LD_LIBRARY_PATH=/path/to/install/gdal/lib:/path/to/install/proj.4/lib:/path/to/install/geos/lib:$LD_LIBRARY_PATH'
>>> ~/.bash_profile
> . ~/.bash_profile
> 
> ## in R run:
> ## need this installed from source to prevent some compiler issues that
> would cause R to segfault if rgdal was loaded and you tried to install
> certain packages
> install.packages("Rcpp", type = "source", repos = "
> https://cloud.r-project.org")
> 
> install.packages("rgdal", type = "source", repos = "
> https://cloud.r-project.org",
> configure.args = "--with-proj-include=/path/to/install/proj.4/include
> --with-proj-lib=/path/to/install/proj.4/lib
> --with-proj-share=/path/to/install/proj.4/share/proj
> --with-gdal-config=/path/to/install/gdal/bin/gdal-config")
> 
> install.packages("rgeos", type = "source", repos = "
> https://cloud.r-project.org",
>          configure.args =
> "--with-geos-config=/path/to/install/geos/bin/geos-config")
> 
> 
> Note that --with-proj-share=/path/to/install/proj.4/share did NOT work.
> 
> 
> On Tue, Jun 20, 2017 at 4:26 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
> 
>> On Tue, 20 Jun 2017, Matthew Simpson wrote:
>>
>> I'm installing some spatial packages on a linux server and due to
>>> university constraints, cannot install anything using a package manager.
>>> I've managed to get rgdal installed successfully, but rgeos is causing
>>> problems.
>>>
>>> I've installed the geos library already, but when I attempt to install
>>> rgeos within R, it complains that that it cannot run C compiled programs.
>>>
>>
>> Could you please say how you installed GEOS? Could you try out geos-config
>> with each of the settings? Do you need 3.7.0dev (I haven't tried this as a
>> source of difficulty as it seems implausible, but neither rgeos nor sf need
>> bleeding edge functionality from GEOS)? Could you try to install sf from
>> source (it also uses GEOS)? Is this the GEOS geos-config -m library bug
>> (probably not)? Unpacking rgeos, running ./configure in the package root, I
>> see (Fedora 25, R 3.4.0):
>>
>> $ ./configure
>> configure: CC: gcc
>> configure: CXX: g++
>> configure: rgeos: 0.3-23
>> checking for /usr/bin/svnversion... yes
>> configure: svn revision: 547
>> checking for geos-config... /usr/local/bin/geos-config
>> checking geos-config usability... yes
>> configure: GEOS version: 3.6.1
>> checking geos version at least 3.2.0... yes
>> checking geos-config clibs... yes
>> checking for gcc... gcc
>> checking whether the C compiler works... yes
>> checking for C compiler default output file name... a.out
>> checking for suffix of executables...
>> checking whether we are cross compiling... no
>> checking for suffix of object files... o
>> checking whether we are using the GNU C compiler... yes
>> checking whether gcc accepts -g... yes
>> checking for gcc option to accept ISO C89... none needed
>> checking how to run the C preprocessor... gcc -E
>> checking for grep that handles long lines and -e... /usr/bin/grep
>> checking for egrep... /usr/bin/grep -E
>> checking for ANSI C header files... yes
>> checking for sys/types.h... yes
>> checking for sys/stat.h... yes
>> checking for stdlib.h... yes
>> checking for string.h... yes
>> checking for memory.h... yes
>> checking for strings.h... yes
>> checking for inttypes.h... yes
>> checking for stdint.h... yes
>> checking for unistd.h... yes
>> checking geos_c.h usability... yes
>> checking geos_c.h presence... yes
>> checking for geos_c.h... yes
>> checking geos: linking with libgeos_c... yes
>> configure: PKG_CPPFLAGS:  -I/usr/local/include
>> configure: PKG_LIBS:  -L/usr/local/lib -lgeos -L/usr/local/lib -lgeos_c
>> configure: creating ./config.status
>> config.status: creating src/Makevars
>>
>> but you fail about half-way down at the standard croos-compilation test.
>> For rgdal/configure - you said your rgdal install on the same system
>> succeeded, I see:
>>
>> ...
>> checking for gcc... gcc
>> checking whether the C compiler works... yes
>> checking for C compiler default output file name... a.out
>> checking for suffix of executables...
>> checking whether we are cross compiling... no
>> checking for suffix of object files... o
>> checking whether we are using the GNU C compiler... yes
>> checking whether gcc accepts -g... yes
>> checking for gcc option to accept ISO C89... none needed
>> checking how to run the C preprocessor... gcc -E
>> ...
>>
>> What do you see (just running ./configure in the package root)?
>>
>> Roger
>>
>>
>>> I've also tried downloading the tarball myself and running R CMD check,
>>> and
>>> it gives me the same complaint.
>>>
>>> I've successfully reinstalled Rcpp from source, but that seemed to do
>>> nothing.
>>>
>>> Below is: 1) the console input from the attempted installation, 2) shell
>>> output from running R CMD check, and 3) my sessionInfo()
>>>
>>> Any help would be appreciated.
>>>
>>> Matt
>>>
>>> 1) Here is the result of attempted installation: (note: removing type =
>>> "source" changes nothing):
>>>
>>> install.packages("rgeos", type = "source",
>>>>
>>> +         configure.args =
>>> "--with-geos-config=/group/stsn/shared_libs/geos/bin/geos-config",
>>> +         repos = "https://cloud.r-project.org")
>>> Installing package into ‘/home/msimpson/R/x86_64-pc-li
>>> nux-gnu-library/3.3’
>>> (as ‘lib’ is unspecified)
>>> trying URL 'https://cloud.r-project.org/src/contrib/rgeos_0.3-23.tar.gz'
>>> Content type 'application/x-gzip' length 257486 bytes (251 KB)
>>> ==================================================
>>> downloaded 251 KB
>>>
>>> * installing *source* package ‘rgeos’ ...
>>> ** package ‘rgeos’ successfully unpacked and MD5 sums checked
>>> configure: CC: /usr/bin/gcc -std=gnu99
>>> configure: CXX: /usr/bin/g++
>>> configure: rgeos: 0.3-23
>>> checking for /usr/bin/svnversion... no
>>> configure: svn revision: 546
>>> configure: geos-config set to /group/stsn/shared_libs/geos/b
>>> in/geos-config
>>> checking geos-config exists... yes
>>> checking geos-config executable... yes
>>> checking geos-config usability... yes
>>> configure: GEOS version: 3.7.0dev
>>> checking geos version at least 3.2.0... yes
>>> checking geos-config clibs... yes
>>> checking for gcc... /usr/bin/gcc -std=gnu99
>>> checking whether the C compiler works... yes
>>> checking for C compiler default output file name... a.out
>>> checking for suffix of executables...
>>> checking whether we are cross compiling... configure: error: in
>>> `/tmp/RtmppP5J2b/R.INSTALL236bb22fea27c/rgeos':
>>> configure: error: cannot run C compiled programs.
>>> If you meant to cross compile, use `--host'.
>>> See `config.log' for more details
>>> ERROR: configuration failed for package ‘rgeos’
>>> * removing ‘/home/msimpson/R/x86_64-pc-linux-gnu-library/3.3/rgeos’
>>>
>>> The downloaded source packages are in
>>>        ‘/tmp/RtmpwkU04N/downloaded_packages’
>>> Warning message:
>>> In install.packages("rgeos", type = "source", configure.args =
>>> "--with-geos-config=/group/stsn/shared_libs/geos/bin/geos-config",  :
>>>  installation of package ‘rgeos’ had non-zero exit status
>>>
>>> 2) Here's the result from running R CMD check:
>>>
>>> R CMD check
>>> --install-args='--configure-args=--with-geos-config=/group/
>>> stsn/shared_libs/geos/bin/geos-config'
>>> rgeos_0.3-23.tar.gz
>>> * using log directory ‘/group/stsn/src/test/rgeos.Rcheck’
>>> * using R version 3.3.1 (2016-06-21)
>>> * using platform: x86_64-pc-linux-gnu (64-bit)
>>> * using session charset: UTF-8
>>> * checking for file ‘rgeos/DESCRIPTION’ ... OK
>>> * this is package ‘rgeos’ version ‘0.3-23’
>>> * checking package namespace information ... OK
>>> * checking package dependencies ... OK
>>> * checking if this is a source package ... OK
>>> * checking if there is a namespace ... OK
>>> * checking for executable files ... OK
>>> * checking for hidden files and directories ... OK
>>> * checking for portable file names ... OK
>>> * checking for sufficient/correct file permissions ... OK
>>> * checking whether package ‘rgeos’ can be installed ... ERROR
>>> Installation failed.
>>> See ‘/group/stsn/src/test/rgeos.Rcheck/00install.out’ for details.
>>> * DONE
>>>
>>> Status: 1 ERROR
>>> See
>>>  ‘/group/stsn/src/test/rgeos.Rcheck/00check.log’
>>> for details.
>>>
>>> cat /group/stsn/src/test/rgeos.Rcheck/00install.out
>>> * installing *source* package ‘rgeos’ ...
>>> ** package ‘rgeos’ successfully unpacked and MD5 sums checked
>>> configure: CC: /usr/bin/gcc -std=gnu99
>>> configure: CXX: /usr/bin/g++
>>> configure: rgeos: 0.3-23
>>> checking for /usr/bin/svnversion... no
>>> configure: svn revision: 546
>>> configure: geos-config set to /group/stsn/shared_libs/geos/b
>>> in/geos-config
>>> checking geos-config exists... yes
>>> checking geos-config executable... yes
>>> checking geos-config usability... yes
>>> configure: GEOS version: 3.7.0dev
>>> checking geos version at least 3.2.0... yes
>>> checking geos-config clibs... yes
>>> checking for gcc... /usr/bin/gcc -std=gnu99
>>> checking whether the C compiler works... yes
>>> checking for C compiler default output file name... a.out
>>> checking for suffix of executables...
>>> checking whether we are cross compiling... configure: error: in
>>> `/group/stsn/src/test/rgeos.Rcheck/00_pkg_src/rgeos':
>>> configure: error: cannot run C compiled programs.
>>> If you meant to cross compile, use `--host'.
>>> See `config.log' for more details
>>> ERROR: configuration failed for package ‘rgeos’
>>> * removing ‘/group/stsn/src/test/rgeos.Rcheck/rgeos’
>>>
>>> 3) And here's my session info:
>>>
>>> sessionInfo()
>>> R version 3.3.1 (2016-06-21)
>>> Platform: x86_64-pc-linux-gnu (64-bit)
>>> Running under: CentOS Linux 7 (Core)
>>>
>>> locale:
>>> [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>> [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>>> [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>>> [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>>> [9] LC_ADDRESS=C               LC_TELEPHONE=C
>>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>>
>>> attached base packages:
>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> 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, Norwegian School of Economics,
>> Helleveien 30, N-5045 Bergen, Norway.
>> voice: +47 55 95 93 55; e-mail: Roger.Bivand at nhh.no
>> Editor-in-Chief of The R Journal, https://journal.r-project.org/index.html
>> http://orcid.org/0000-0003-2392-6140
>> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics  (ifgi),  University of Münster
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170621/42521e3c/attachment.sig>


More information about the R-sig-Geo mailing list