11

I'm trying to install the package rgeos on linux. I get the following error:

system("sudo apt-get update")
system("sudo apt install libgdal-dev -y")
install.packages("rgeos")
collect2: error: ld returned 1 exit status
configure: Install failure: compilation and/or linkage problems.
configure: error: initGEOS_r not found in libgeos_c.
ERROR: configuration failed for package ‘rgeos’

I have already install the dev libgdal and it returns the "already installed" info if I try to run the sudo again.

How can I fix this? Thanks in advance!

Neal Barsch
  • 2,810
  • 2
  • 13
  • 39
  • This might help https://stackoverflow.com/a/49181048/ – Tung Oct 22 '18 at 03:42
  • 1
    Same here on ubuntu 16.04 / R 3.5.1 and the solution in the thread linked by Tung didn't help, everything was already installed. – cmbarbu Oct 22 '18 at 11:37
  • 1
    Looks like it is something specific to 0.4-1 version of rgeos as 0.3-28 is running fine here but update cannot be done because of this issue. – cmbarbu Oct 22 '18 at 11:59
  • If it's an archive issue I'll try grabbing rgeos archive from CRAN via devtools::install_version – Neal Barsch Oct 23 '18 at 00:11
  • @cmbarbu, you are right, it's an issue with the 0.4-1 update from just four days ago. Archive version WORKS:`devtools::install_version("rgeos",version="0.3-28")` – Neal Barsch Oct 23 '18 at 01:12
  • 5
    It's a bug, developer has replied on this thread on the R-sig-geo mailing list. http://r-sig-geo.2731867.n2.nabble.com/Re-Unexpected-configure-error-following-recent-rgeos-release-td7592423.html – wildintellect Oct 23 '18 at 21:58
  • Also a problem in 0.4-2? – MichaelChirico Apr 11 '19 at 03:41

1 Answers1

13

It is a bug, you could use this to install lower stable version.

install.packages("devtools")
library(devtools)
install_version("rgeos", version = "0.3-28")

After this code all should be fine.

MichaelChirico
  • 33,841
  • 14
  • 113
  • 198
mark
  • 146
  • 1
  • 6