3

I am trying to install the sf package in a CentOS machine but I keep getting this error

proj_api.h not found in standard or given locations

Even though when I run locate proj_api.h it is found in /usr/local/include/proj_api.h

André Oviedo
  • 51
  • 1
  • 5
  • Can you include the versions of everything relevant and a transcript of the output from the install? – Spacedman Mar 19 '19 at 21:08
  • You should provide the command you are using to configure things. I am guessing it is an Autotools project. Set `PKG_CONFIG_PATH=/usr/local/lib/pkgconfig`, then run `./configure`. Alternately, if you are compiling and linking, then show your compile and link commands. In this case, add `-I/usr/local/include` to your `CFLAGS`, and add `-L/usr/local/lib` to your `LDFLAGS`. Maybe related, see [rgdal package installation](https://stackoverflow.com/q/15248815/608639) – jww Mar 20 '19 at 01:32
  • Have you tried installing sf from github directly? – Edzer Pebesma Apr 14 '19 at 14:28
  • solved it in fedora with `sudo dnf install proj-devel` plus `sqlite-devel` and `geos-devel` – Elio Diaz Jan 14 '23 at 03:37

3 Answers3

3

I my case help when I was set PKG_CONFIG_PATH envirmoment, and point them to place where was "proj.pc" file:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
BoBo
  • 31
  • 2
  • How do you point to the location of "proj.pc" in an installer argument, --with-proj-lib=/usr/local/lib/pkgconfig/proj.pc ? – akh22 Mar 04 '20 at 14:21
  • Like I mentioned above, You must set envirnonment variable: PKG_CONFIG_PATH with path to proj.pc in Your system, not in installer argument. – BoBo Mar 06 '20 at 08:32
  • I did setup PKG_CONFIG_PATH in my env but was not sure about your second step, "point them to place where was "proj.pc" file." – akh22 Mar 11 '20 at 13:39
1

Try this from the command line. It worked for me when I got the same error message on Mac Mojave:

R CMD INSTALL sf_0.7-4.tar.gz --configure-args='-with-gdal-config=/Library/Frameworks/GDAL.framework/Versions/2.4/unix/bin/gdal-config -with-geos-config=/Library/Frameworks/GEOS.framework/Versions/3B/unix/bin/geos-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'

You will need to confirm locations of gdal-config, geos-config, include, and lib for PROJ. and your most recent versions for each installation and the .tar.gz file. I found a similar issue and the answer here

Peter Pearman
  • 129
  • 1
  • 10
0

Recently the configure of sf changed a lot with regard to proj. Installing the development version from github solved the the failing configure in my case

remotes::install_github('r-spatial/sf')
rnuske
  • 83
  • 7
  • Still getting this error on macoS Catalina, R 3.6.2, even when trying the development version of sf (same with the CRAN release). Reinstalled proj and all dependencies to no avail ``` checking proj.h usability... yes checking proj.h presence... yes checking for proj.h... yes checking PROJ: checking whether PROJ and sqlite3 are available for linking:... no configure: error: libproj not found in standard or given locations. ``` – DanO Mar 26 '20 at 17:36