3

I am trying to install Rfast package. It gives me the following error,

/usr/lib/R/etc/Makeconf:168: recipe for target 'Norm.o' failed
    make: *** [Norm.o] Error 1

Full error message is this,

> install.packages("Rfast", dependencies = TRUE)

* installing *source* package 'Rfast' ...
** package 'Rfast' successfully unpacked and MD5 sums checked
** libs
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG  -I"/home/haseeb/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/haseeb/R/x86_64-pc-linux-gnu-library/3.4/RcppArmadillo/include"   -fopenmp -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Diag.cpp -o Diag.o
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG  -I"/home/haseeb/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/haseeb/R/x86_64-pc-linux-gnu-library/3.4/RcppArmadillo/include"   -fopenmp -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Norm.cpp -o Norm.o
In file included from Norm.cpp:4:0:
templates.h: In function 'SEXPREC* eachrow_helper(SEXP, SEXP)':
templates.h:904:15: error: there are no arguments to 'DATAPTR' that depend on a template parameter, so a declaration of 'DATAPTR' must be available [-fpermissive]
   T *xx=(T *) DATAPTR(x),*xend=xx+ncol*nrow,*yy=(T *) DATAPTR(y),yvalue,*x3;
               ^~~~~~~
templates.h:904:15: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
templates.h:904:55: error: there are no arguments to 'DATAPTR' that depend on a template parameter, so a declaration of 'DATAPTR' must be available [-fpermissive]
   T *xx=(T *) DATAPTR(x),*xend=xx+ncol*nrow,*yy=(T *) DATAPTR(y),yvalue,*x3;
                                                       ^~~~~~~
templates.h:905:32: error: there are no arguments to 'DATAPTR' that depend on a template parameter, so a declaration of 'DATAPTR' must be available [-fpermissive]
   RETURN_TYPE *m=(RETURN_TYPE*)DATAPTR(mat);
                                ^~~~~~~
/usr/lib/R/etc/Makeconf:168: recipe for target 'Norm.o' failed
make: *** [Norm.o] Error 1
ERROR: compilation failed for package 'Rfast'

My sessioninfo is as follows,

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=C                 LC_NUMERIC=C               LC_TIME=de_DE.UTF-8       
 [4] LC_COLLATE=C               LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=C             
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.4 tools_3.4.4    yaml_2.2.0 

Is there anyone who can help me fixing this issue?

small_lebowski
  • 701
  • 7
  • 23
  • Can you show the two or three lines before or after the error? What you quoted is not informative. Rfast should install cleanly on this platform. – Dirk Eddelbuettel Aug 02 '18 at 20:47
  • Here it is, https://pastebin.com/94D9jUSz – small_lebowski Aug 02 '18 at 21:00
  • Please edit a (reasonable) part of that into the question. See the help for [creating a mcve](https://stackoverflow.com/help/mcve). – Dirk Eddelbuettel Aug 02 '18 at 21:02
  • 2
    That is ... a weird one. Not sure. Passes [at CRAN as well](https://cloud.r-project.org/web/checks/check_results_Rfast.html). – Dirk Eddelbuettel Aug 02 '18 at 21:23
  • @HaseebMahmud You can always try to restart your computer and try again; this has worked for me in the past. – F. Privé Aug 03 '18 at 06:34
  • @F.Privé I am running a linux machine, where usually it is not working is this way. Sometimes you have to restart the terminal though. I have also checked the cables. Nothing worked so far. In Windows there is not problem install Rfast. – small_lebowski Aug 03 '18 at 09:23
  • 2
    Nor is there on other Linux machines. I install Rfast routinely as it is reverse dependency of Rcpp, so I check it too. The issue is most likely local to your Linux computer -- mix up between compilers or something. So reason whatsoever to stumble over `DATAPTR` which is a C macro. And you _do_ have access to other Linux machines via [builder.r-hub.io](https://builder.r-hub.io/). – Dirk Eddelbuettel Aug 03 '18 at 12:59
  • Same problem here too with ubuntu 16.04, R 3.4.4 and gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10). Did you install gsl libs? If yes how did you do that? Using the`apt-get install libgsl-dev` or something else? Could this be relevant to our issue? – J. Doe Aug 06 '18 at 10:07

2 Answers2

5

I believe the problem is that I have forget to add

#include <Rinlinedfuns.h>

but I can not use this file. DATAPTR is declared in this file.

Manos Papadakis
  • 564
  • 5
  • 17
  • Does anyone check it? – J. Doe Aug 06 '18 at 19:49
  • 1
    Note that for R >= 3.5.0, `DATAPTR` is defined as an inline function. This works even without the function declaration. Prior to that `DATAPTR` was a macro. And the definition of that macro is strictly necessary for compliation. – Ralf Stubner Aug 07 '18 at 09:51
  • @RalfStubner: You are right. In Arch Linux that I've tried it, I had R version 3.5.1 while on ubuntu it's 3.4.4. Which are the options now? Should I install 3.5.1 in Ubuntu or is there any other solution? – J. Doe Aug 07 '18 at 10:13
  • @J.Doe I would go for R 3.5.1. Alternatively you could manually path `template.h` until the official Rfast is fixed. – Ralf Stubner Aug 07 '18 at 10:25
  • @RalfStubner: Sorry but what do you mean by 'manually path template.h' ? – J. Doe Aug 07 '18 at 10:36
  • @J.Doe Typo, I meant "manually patch", i.e. download the package, alter the content, install from the changed package. – Ralf Stubner Aug 07 '18 at 10:39
  • @RalfStubner By patching you mean what Csd wrote above? Because I tried it and seems not to work by just adding the `#include – J. Doe Aug 07 '18 at 10:47
  • @J.Doe This is indeed more complicated then I thought. At the moment using R 3.5.x seems to be the only option. – Ralf Stubner Aug 07 '18 at 11:53
  • I have changed my answer. unfortunately I have not find any way to solve this. R 3.5.x is the only way for now. – Manos Papadakis Aug 18 '18 at 01:16
0

I have been getting the exact same error on my desktop and laptop running Ubuntu 16.04 and am at a loss how to fix this.

To me, it seems like a bad coding practice (use of the DATAPTR(x) function without prior declaration). I tried to find a declaration for DATAPTR in the header files but there is none to be found.

DATAPTR(x) is defined in /usr/share/R/include/Rinternals.h, which is not explicitly included in Norm.cpp, whereas it is included in Diag.cpp, the latter compiling without an error.

I don't know why this compiles in other machines and it fails only in ours. The g++ version is:

g++ (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609

I would expect if Rinternals.h is not explicitly included wherever DATAPTR is needed then it should fail across all installations, unless somehow there is a way to instruct the compiler to include Rinternals.h by default?

fkliron
  • 83
  • 1
  • 6
  • I tried to include the `Rinternals.h` in `Norm.cpp` too but nothing changed when compiling it again . – J. Doe Aug 06 '18 at 11:10
  • I tried it also to another ubuntu 16.04 system and had the same results. Then I tried it to an arch linux system and all worked as expected. Any idea on how to identify the compiling differences between those two systems? – J. Doe Aug 06 '18 at 12:11
  • I have no idea. I suspect this is C++ thing that has to do with the order functions need to be declared. Just including the `Rinternals.h` did not fix this for me either. I guess we need to wait until more Ubuntu users report this. – fkliron Aug 08 '18 at 08:24