Search code examples
rcompressionbrotli

Brotli for R is not compiling correctly


I am trying to install the brotli package in R. As usual, I run: install.packages("brotli")

However, for some reason, the compilation seems to not be completing. I have tried this now on two different systems (one on my Mac, the other on an EC2 instance). Here are the errors:

wrapper.c:94:14: error: unknown type name 'R_CallMethodDef'

static const R_CallMethodDef CallEntries[] = {
             ^
wrapper.c:95:28: error: use of undeclared identifier 'DL_FUNC'
  {"R_brotli_compress",   (DL_FUNC) &R_brotli_compress,   3},
                           ^
wrapper.c:96:28: error: use of undeclared identifier 'DL_FUNC'
  {"R_brotli_decompress", (DL_FUNC) &R_brotli_decompress, 1},
                           ^
wrapper.c:100:20: error: unknown type name 'DllInfo'
void R_init_brotli(DllInfo *dll) {
                   ^
wrapper.c:101:3: warning: implicit declaration of function         'R_registerRoutines' is invalid in C99 [-Wimplicit-function-declaration]
  R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
  ^
wrapper.c:102:3: warning: implicit declaration of function     'R_useDynamicSymbols' is invalid in C99 [-Wimplicit-function-declaration]
  R_useDynamicSymbols(dll, FALSE);
  ^
2 warnings and 4 errors generated.
make: *** [wrapper.o] Error 1
ERROR: compilation failed for package ‘brotli’
* removing     ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/brotli’

The downloaded source packages are in
        ‘/private/var/folders/6s/dkpknwzd4d51qm959wqxv7280000gn/T/RtmpHOPjwI/downloa    ded_packages’
Warning message:
In install.packages("brotli") :
  installation of package ‘brotli’ had non-zero exit status

I'm not as proficient in C as I probably should be, but I tried to reverse engineer it with no avail. Am I missing something? I also tried to install this with the dependencies option (dependencies = TRUE). Does anyone have any thoughts on this?


Solution

  • So, it seems as thought, through some additional poking in the C code, that the solution was really simple. I just didn't have r-development installed. After installing on both my mac and my EC2, it now installs with no issue. This is strange, since I would imagine that a decent R package should be able to be installed without the need of the development packages. But maybe I'm too inexperienced in R package development to comment an opinion on the matter. None-the-less, I hope this helps other less-experienced that are seeking to install the same package. Thanks for the help though!