0

I am trying to install rgdal in my computer that runs ubuntu linux 14.04. The R version that I am using is: 3.3.1. I installed gdal and related packages from the regular ubuntu repository and also using the ubuntu-gis ppa (https://launchpad.net/~ubuntugis/+archive/ubuntu/ppa). In both cases, I've got the same error message while compiling:

gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal  -I"/home/magdiel/R/x86_64-pc-linux-gnu-library/3.3/sp/include"   -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c inverser.c -o inverser.o
inverser.c:3:22: fatal error: projects.h: No existe el archivo o el directorio
 #include <projects.h>
                      ^
compilation terminated.
make: *** [inverser.o] Error 1
ERROR: compilation failed for package ‘rgdal’

I had rgdal installed before without problem and was trying to update it to a newer version as required for R.

I will greatly appreciate any help

Martin Schmelzer
  • 23,283
  • 6
  • 73
  • 98
magablan
  • 9
  • 2
  • 1
    [Here is what worked for me](http://askubuntu.com/a/725675/458220), back in January of this year, with Ubuntu 14.04.2 and with R 3.2.2. If my solution doesn't work for you, perhaps see the other older answers over there, for additional ideas. Best of luck! – Josh O'Brien Jul 05 '16 at 21:46
  • @JoshO'Brien; it might be worth writing it up here as well ; I just tried your solution and it works (I also needed to install `libgdal-dev` and `libmysqlclient-dev`, but the dependency notices give these) – user20650 Jul 05 '16 at 22:12
  • 1
    Sure, why not. I don't think it can actually hurt to have it both places. – Josh O'Brien Jul 05 '16 at 22:19

1 Answers1

3

In February 2016, on Ubuntu 14.04.2 (and with R 3.2.2), I needed the following to get both rgdal and the complementary (and frequently very useful) gdalUtils package installed:

sudo apt-get update
sudo apt-get -y install libgdal1h
sudo apt-get -y install libgdal1-dev
sudo apt-get install libproj-dev
sudo apt-get install gdal-bin
Rscript 'install.packages(c("rgdal", "gdalUtils"))'
Josh O'Brien
  • 159,210
  • 26
  • 366
  • 455
  • Yeah. I should just remove my idle speculation. – IRTFM Jul 06 '16 at 15:38
  • 1
    I've noticed that it's often necessary to install `*-dev` versions on Linux which I assume is needed to support proper linkage with external applications. – IRTFM Jul 06 '16 at 16:05