appelmar / gdalcubes

Creating and analyzing Earth observation data cubes in R
https://gdalcubes.github.io
Other
120 stars 28 forks source link

Configuration fails in linking PROJ #47

Closed girgink closed 2 years ago

girgink commented 2 years ago

On Ubuntu 20.04 I have PROJ installed through apt:

apt list --installed | grep libproj

libproj-dev/focal,now 6.3.1-1 amd64 [installed]
libproj15/focal,now 6.3.1-1 amd64 [installed,automatic]

Running install.packages("gdalcubes", repos = "https://cloud.r-project.org/") gives the following error:

checking gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /usr/local/share/gdal/pcs.csv readable... no
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available fur running:... yes
configure: GDAL: 3.2.3
configure: pkg-config proj exists, will use it
configure: using proj.h.
configure: PROJ: 6.3.1
checking PROJ: checking whether PROJ and sqlite3 are available for linking:... no
configure: error: libproj or sqlite3 not found in standard or given locations.
ERROR: configuration failed for package ‘gdalcubes’

I can confirm that both libproj and sqlite3 are installed properly by using the test code used in the Makefile:

cat > proj_conf_test.cpp <<_EOCONF
#include <stdio.h>
#include <stdlib.h>
#include <proj.h>
int main() {
    proj_context_create();
    exit(0);
}
_EOCONF

g++ -o proj_conf_test proj_conf_test.cpp -lproj -lsqlite3

./proj_conf_test

The code above builds without an error and test exists with code 0 as expected.

appelmar commented 2 years ago

Thanks for the report! Hard to say what goes wrong, are you able to install the sf package? Maybe there is more than one version of PROJ (e.g. in /usr/local/lib)?

girgink commented 2 years ago

Thanks for the reply! It looks like the issue was related to the location of PROJ, because it is not under /usr/local/lib, but under /usr/lib/aarch64-linux-gnu. Installation worked properly with the following command:

install.packages("gdalcubes", configure.args = c(gdalcubes = "--with-proj-lib=/usr/lib/aarch64-linux-gnu"), repos="https://cloud.r-project.org/")