Search code examples
sqliteboostdependenciesrcppgdal

Rcpp and C++ dependencies to gdal, sqlite3 and boost


I am trying to make an hybrid C++/python/R project more easily available for non-programmers.

I am considering the possibility to wrap the C++ code with Rcpp to make it available within an R package and hopefully hide some of the complexity to the end-user.

This question aims to understand to which extend it would be actually easier.

For example, when trying to source my project.cpp, I get the following error:

fatal error: gdal_priv.h: No such file or directory #include <gdal_priv.h>
  • Is it possible to write something cross-platform similar to LinkingTo: BH, GDAL, sqlite3 ?

  • How to know what C++ libraries have been made compatible with Rcpp (like BH for Boost)?

  • The C++ sub-project works fine using cmake: can I somehow take advantage of these cmake files to help Rcpp finding the external dependencies ?


Solution

  • That's really three questions.

    For 1) I do not know if/how gdal and or sqlite3 export themselves as header-only libraries. I kinda doubt it; gdal is well-known, and also somewhat well-know as a source of "trouble" when building. GeoSpatial foks may know and can possibly help you.

    For 2), the question is ill-defined. What is "compatible with Rcpp" supposed to mean? There are currently over 1800 packages on CRAN using Rcpp; maybe take those as an "existence proof" and search among them?

    For 3), R and CRAN use autoconf / configure a lot more than cmake. You can of course use cmake, but you then need to declare that dependency in SystemRequirements.

    In short, packaging external libraries is still difficult, chiefly because you now have to look after their installation on up to three different operating systems. This has nothing to do with Rcpp, and Rcpp cannot really help. :-/