Diogo Alagador
2007-Jul-20 13:43 UTC
[R] R CMD SHLIB problem [make: *** No rule to make target ]
Hy all, I apologize for my ingenuity in regard to interfaces in R, but I do need it for my work. In that respect I took a simple and small example from the net (the "hello world", one) to interface R with C. I have a Windows XP OS using R.2.5.0 and in that regard I have installed the Perl and RTools files to my PC. I also wrote a proper path file, as suggested. The C program is: #include <C:/Archivos de programa/R-2.5.0/include/R.h> void hello(int *n){ int i; for(i=0;i<*n;i++){ Rprintf("Hello, world!\n"); } } However when trying to compile the a C file in the command window: R CMD SHLIB holla.c I get the following message: make: *** No rule to make target `holla.d', needed by `makeMakedeps'. Stop. Can somebody give me a hand on this, Thanks in advance Diogo André Alagador [[alternative HTML version deleted]]
Diogo Alagador
2007-Jul-20 14:18 UTC
[R] R CMD SHLIB problem [make: *** No rule to make target ]
Hy all, I apologize for my ingenuity in regard to interfaces in R, but I do need it for my work. In that respect I took a simple and small example from the net (the "hello world", one) to interface R with C. I have a Windows XP OS using R.2.5.0 and in that regard I have installed the Perl and RTools files to my PC. I also wrote a proper path file, as suggested. The C program is: #include <C:/Archivos de programa/R-2.5.0/include/R.h> void hello(int *n){ int i; for(i=0;i<*n;i++){ Rprintf("Hello, world!\n"); } } However when trying to compile the a C file in the command window: R CMD SHLIB holla.c I get the following message: make: *** No rule to make target `holla.d', needed by `makeMakedeps'. Stop. Can somebody give me a hand on this, Thanks in advance Diogo André Alagador [[alternative HTML version deleted]]
Prof Brian Ripley
2007-Jul-20 16:08 UTC
[R] R CMD SHLIB problem [make: *** No rule to make target ]
Please do *not* use paths in your C code, especially those with spaces in. (The rw-FAQ did advise you not to install into a path with spaces in if you wanted to do development work.) The path is not needed for system include files (you used <>) and is likely the problem. And please do not post multiple times. On Fri, 20 Jul 2007, Diogo Alagador wrote:> Hy all, > > I apologize for my ingenuity in regard to interfaces in R, but I do need it for my work. In that respect I took a simple and small example from the net (the "hello world", one) to interface R with C. > I have a Windows XP OS using R.2.5.0 and in that regard I have installed the Perl and RTools files to my PC. I also wrote a proper path file, as suggested. > > The C program is: > > #include <C:/Archivos de programa/R-2.5.0/include/R.h> > void hello(int *n){ > int i; > for(i=0;i<*n;i++){ > Rprintf("Hello, world!\n"); > } > }You don't need R.h, but you do need to declare Rprintf, which is in <R_ext/Print.h>. So a more legible version of a correct program would be % cat holla.c #include <R_ext/Print.h> void hello(int *n) { int i; for(i = 0; i < *n; i++) Rprintf("Hello, world!\n"); } which you could call by> dyn.load("holla.dll") > .C("hello", 10L)(note the L).> However when trying to compile the a C file in the command window: > > R CMD SHLIB holla.c > > I get the following message: > > make: *** No rule to make target `holla.d', needed by `makeMakedeps'. Stop. > > Can somebody give me a hand on this, > Thanks in advance > > > Diogo Andr? Alagador > > [[alternative HTML version deleted]] > >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Diogo Alagador
2007-Jul-20 18:11 UTC
[R] R CMD SHLIB problem [make: *** No rule to make target ]
Prof. Ripley, I will follow your suggestion about file spaces. However, as you said the path declared in the #include row is redundant, so I think the problem did not come through that. Meanwhile, after some tries I could compile the file. I just got more attention to case sensitiveness. Sorry for the mess. Cheers, Diogo Andre' Alagador Please do *not* use paths in your C code, especially those with spaces in. (The rw-FAQ did advise you not to install into a path with spaces in if you wanted to do development work.) The path is not needed for system include files (you used <>) and is likely the problem. And please do not post multiple times. On Fri, 20 Jul 2007, Diogo Alagador wrote:> Hy all,>> I apologize for my ingenuity in regard to interfaces in R, but I do> need it for my work. In that respect I took a simple and small example> from the net (the "hello world", one) to interface R with C. I have a> Windows XP OS using R.2.5.0 and in that regard I have installed the> Perl and RTools files to my PC. I also wrote a proper path file, as> suggested.>> The C program is:>> #include <C:/Archivos de programa/R-2.5.0/include/R.h>> void hello(int *n){> int i;> for(i=0;i<*n;i++){> Rprintf("Hello, world!\n");> }> }You don't need R.h, but you do need to declare Rprintf, which is in <R_ext/Print.h>. So a more legible version of a correct program would be % cat holla.c #include <R_ext/Print.h> void hello(int *n) { int i; for(i = 0; i < *n; i++) Rprintf("Hello, world!\n"); } which you could call by> dyn.load("holla.dll")> .C("hello", 10L)(note the L).> However when trying to compile the a C file in the command window:>> R CMD SHLIB holla.c>> I get the following message:>> make: *** No rule to make target `holla.d', needed by `makeMakedeps'.> Stop.>> Can somebody give me a hand on this,> Thanks in advance>>> Diogo André Alagador>> [[alternative HTML version deleted]]>>-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ <http://www.stats.ox.ac.uk/~ripley/> University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 [[alternative HTML version deleted]]