[R-pkg-devel] Package builds on all systems except on Fedora with clang

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Mon Jan 20 16:03:36 CET 2025


On 19 January 2025 at 20:42, Pepijn de Vries wrote:
| I think I could write a similar test as used by `cpp11tesseract`:
| 
| https://github.com/pachadotdev/cpp11tesseract/blob/2ea8287ef2c27901446bafa402728014d99904d4/configure#L66-L85

Taking an example from a package not on CRAN 'for policy violations' may not
be the safest best.

`autoconf` has included the ability to conduction these tests for a long
time. Here is an (old) snippet from RProtoBuf which uses a test file to
assert we have a recent enough version:

   ## also check for minimum version
   AC_MSG_CHECKING([if ProtoBuf version >= 2.2.0])
   AC_RUN_IFELSE([AC_LANG_SOURCE([[
   #include <google/protobuf/stubs/common.h>
   int main() {
      if (GOOGLE_PROTOBUF_VERSION >= 2001000) {
           exit (0);
      } else {
           exit(1);
      }
   }
   ]])],
   [pb_version_ok=yes],
   [pb_version_ok=no],
   [pb_version_ok=yes])
   if test x"${pb_version_ok}" = x"no"; then
       AC_MSG_ERROR([Need ProtoBuf version >= 2.2.0])
   else
       AC_MSG_RESULT([yes])
   fi

Note that this happens after we found suitable compiler and linker switches.
And of course, switching to `autoconf` is no small task either. But getting
an external library to build reliably on all platforms is one of the harder
things to set up at CRAN.

Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list