[Rcpp-devel] Problem loading a binary package which links dynamically with Rcpp

2013-01-28 Thread Fabien Ors

Hi,

I develop a binary R package (let's call it MyPack) which is not on the 
CRAN and which depends from Rcpp (0.10.2).
This package is built in-house under linux using the R CMD INSTALL 
--build and a Makevars file containing :


PKG_CPPFLAGS = -I$(R_HOME)/include -I$(R_HOME)/library/Rcpp/include
PKG_LIBS = `$(R_HOME)/bin/Rscript -e Rcpp:::LdFlags()`

The problem is that I cannot load my package on another linux computer:

 library(MyPack)
Loading required package: Rcpp
Error in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Path/To/R_Packs/MyPack/libs/MyPack.so':
libRcpp.so: cannot open shared object file: No such file or directory
Error: package/namespace load failed for ‘MyPack’

Both Rcpp and MyPack have been installed using:
R CMD INSTALL Rcpp_0.10.2.tar.gz -l /Path/To/R_Packs/
R CMD INSTALL MyPack_1.0.0.tar.gz -l /Path/To/R_Packs/

And the path to R_Packs have been added to R_LIBS environment variable, so:
 .libPaths()
[1] /Path/To/R_Packs /usr/local/lib64/R/library

If I install both packages as root (inside /usr/local/lib64/R/library/), 
there is no problem.

Any help would be greatly appreciated.

Thanks.
Fabien
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


Re: [Rcpp-devel] Compiling packages using Rcpp code under R devel

2013-01-28 Thread Dirk Eddelbuettel

Søren,

On 28 January 2013 at 22:39, Søren Højsgaard wrote:
| Dear all,
| 
| I was checking one of my packages (gRbase) under R-devel and got
| 
| * checking compiled code ... NOTE
| File 
'C:/Documents/stat/Rdevel/GMwR-DEVEL/gRbaseDEVEL/gRbase.Rcheck/gRbase/libs/i386/gRbase.dll':
|   Found non-API calls to R: 'Rf_EncodeComplex', 'Rf_EncodeReal',
| 'Rf_formatComplex', 'Rf_formatReal'
| File 
'C:/Documents/stat/Rdevel/GMwR-DEVEL/gRbaseDEVEL/gRbase.Rcheck/gRbase/libs/x64/gRbase.dll':
|   Found non-API calls to R: 'Rf_EncodeComplex', 'Rf_EncodeReal',
| 'Rf_formatComplex', 'Rf_formatReal'
| 
| Compiled code should not call non-API entry points in R.
| 
| I guess this is something related to Rcpp, but I am not sure. Any help on 
this?

That is already taken care of in SVN for Rcpp:

2013-01-15  Dirk Eddelbuettel  e...@debian.org

* src/api.cpp (Rcpp): Commented-out coerce_to_string() for real and
complex arguments as R-devel (as of today) dislikes use of non-API
functions Rf_EncodeComplex’, ‘Rf_EncodeReal’, ‘Rf_formatComplex’ 

* .Rbuildignore: Added inst/include/Rcpp/preprocessor and
sugar/functions/impl which are currently empty directories

* src/Timer.cpp (Rcpp): Avoid a 'long long' warning from a const

R Core added this test around Jan 13 or 14, or /way/ past our last release. 

So there is nothing we could have done in December when we released, and
there is nothing to do here until our next release -- but I successfule urged
Kurt to update his copy of Rcpp to our SVN which he did in order to
suppress this.

In short, gRbase is an innocent bystander and victim of a very zealous
warning.  Update Rcpp and this will be quieter.

Dirk

| 
| Regards
| Søren
| ___
| Rcpp-devel mailing list
| Rcpp-devel@lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com  
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] Problem loading a binary package which links dynamically with Rcpp

2013-01-28 Thread Dirk Eddelbuettel

Salut Fabien,

This is not a reproducible report ...

On 28 January 2013 at 10:19, Fabien Ors wrote:
| Hi,
| 
| I develop a binary R package (let's call it MyPack) which is not on the 
| CRAN and which depends from Rcpp (0.10.2).
| This package is built in-house under linux using the R CMD INSTALL 
| --build and a Makevars file containing :
| 
| PKG_CPPFLAGS = -I$(R_HOME)/include -I$(R_HOME)/library/Rcpp/include
| PKG_LIBS = `$(R_HOME)/bin/Rscript -e Rcpp:::LdFlags()`
| 
| The problem is that I cannot load my package on another linux computer:
| 
|   library(MyPack)
| Loading required package: Rcpp
| Error in dyn.load(file, DLLpath = DLLpath, ...):
| unable to load shared object '/Path/To/R_Packs/MyPack/libs/MyPack.so':
| libRcpp.so: cannot open shared object file: No such file or directory
| Error: package/namespace load failed for ‘MyPack’
| 
| Both Rcpp and MyPack have been installed using:
| R CMD INSTALL Rcpp_0.10.2.tar.gz -l /Path/To/R_Packs/
| R CMD INSTALL MyPack_1.0.0.tar.gz -l /Path/To/R_Packs/
| 
| And the path to R_Packs have been added to R_LIBS environment variable, so:
|   .libPaths()
| [1] /Path/To/R_Packs /usr/local/lib64/R/library
| 
| If I install both packages as root (inside /usr/local/lib64/R/library/), 
| there is no problem.

That would indicate there is no problem per se with your or our code, but
rather with the setup of your computer. Maybe /etc/ld.so.conf is out of sync
with where you keep dynamic libraries -- hard to say without anything
reproducible. 

Dirk

| Any help would be greatly appreciated.
| 
| Thanks.
| Fabien
| ___
| Rcpp-devel mailing list
| Rcpp-devel@lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com  
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] an error message from RcppArmadillo

2013-01-28 Thread Kevin Ushey
The main error that pops out is that 'g++', the compiler used to compile
the C++ code, was not found.

Best guess: Rtools isn't in your PATH. I believe the Windows Rtools
installer automatically adds itself to your system PATH, so if you just
installed with default settings you'd be fine there. If not, you're going
to have to change your PATH to point to both Rtools and the gcc
installation subdir in Rtools. You might consider using something like
RStudio as well, since it'll do some magic behind the scenes to ensure
Rtools is found and called whenever compiling code.

Other potential problem: you have R installed in 'C:/Program Files', and
that space in the path can potentially cause problems. You might consider
reinstalling R in a directory with no spaces. Frustrating and silly, I know
:P

Hope it helps,

-Kevin

On Mon, Jan 28, 2013 at 3:23 PM, Aileen Lin aileenshanhong@gmail.comwrote:

 Hi there,

 I am trying the package of RcppArmadillo. This is the code I copied from
 your website. I am not sure what went wrong.

  suppressMessages(require(inline))
  code - '
 +arma::mat coeff = Rcpp::asarma::mat(a);
 +arma::mat errors = Rcpp::asarma::mat(e);
 +int m = errors.n_rows; int n = errors.n_cols;
 +arma::mat simdata(m,n);
 +simdata.row(0) = arma::zerosarma::mat(1,n);
 +for (int row=1; rowm; row++) {
 +  simdata.row(row) = simdata.row(row-1)*trans(coeff)+errors.row(row);
 +}
 +return Rcpp::wrap(simdata);
 +  '
   ## create the compiled function
   rcppSim - cxxfunction(signature(a=numeric,e=numeric),
 +code,plugin=RcppArmadillo)
 tty option detected in CYGWIN environment variable.
 CYGWIN=tty is no longer supported.  Please remove it from your
 CYGWIN environment variable and use a terminal emulator like mintty,
 xterm, or rxvt.
 cygwin warning:
   MS-DOS style path detected: C:/PROGRA~1/R/R-215~1.2/etc/i386/Makeconf
   Preferred POSIX equivalent is:
 /cygdrive/c/PROGRA~1/R/R-215~1.2/etc/i386/Makeconf
   CYGWIN environment variable option nodosfilewarning turns off this
 warning.
   Consult the user's guide for more details about POSIX paths:
 http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
 /usr/bin/sh: g++: command not found
 make: *** [filee245f631629.o] Error 127

 ERROR(s) during compilation: source code errors or compiler configuration
 errors!

 Program source:
   1:
   2: // includes from the plugin
   3: #include RcppArmadillo.h
   4: #include Rcpp.h
   5:
   6:
   7: #ifndef BEGIN_RCPP
   8: #define BEGIN_RCPP
   9: #endif
  10:
  11: #ifndef END_RCPP
  12: #define END_RCPP
  13: #endif
  14:
  15: using namespace Rcpp;
  16:
  17:
  18: // user includes
  19:
  20:
  21: // declarations
  22: extern C {
  23: SEXP filee245f631629( SEXP a, SEXP e) ;
  24: }
  25:
  26: // definition
  27:
  28: SEXP filee245f631629( SEXP a, SEXP e ){
  29: BEGIN_RCPP
  30:
  31:arma::mat coeff = Rcpp::asarma::mat(a);
  32:arma::mat errors = Rcpp::asarma::mat(e);
  33:int m = errors.n_rows; int n = errors.n_cols;
  34:arma::mat simdata(m,n);
  35:simdata.row(0) = arma::zerosarma::mat(1,n);
  36:for (int row=1; rowm; row++) {
  37:  simdata.row(row) =
 simdata.row(row-1)*trans(coeff)+errors.row(row);
  38:}
  39:return Rcpp::wrap(simdata);
  40:
  41: END_RCPP
  42: }
  43:
  44:
 Error in compileCode(f, code, language = language, verbose = verbose) :
   Compilation ERROR, function(s)/method(s) not created! tty option
 detected in CYGWIN environment variable.
 CYGWIN=tty is no longer supported.  Please remove it from your
 CYGWIN environment variable and use a terminal emulator like mintty,
 xterm, or rxvt.
 cygwin warning:
   MS-DOS style path detected: C:/PROGRA~1/R/R-215~1.2/etc/i386/Makeconf
   Preferred POSIX equivalent is:
 /cygdrive/c/PROGRA~1/R/R-215~1.2/etc/i386/Makeconf
   CYGWIN environment variable option nodosfilewarning turns off this
 warning.
   Consult the user's guide for more details about POSIX paths:
 http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
 /usr/bin/sh: g++: command not found
 make: *** [filee245f631629.o] Error 127

 My inline package is 0.3.10, RcppArmadillo is 0.3.6.1, Rcpp is 0.10.2. I
 also installed Rtools216.exe. Please let me know what I did wrongly. Thank
 you.

 Regards,
 Aileen L.
 ___
 Rcpp-devel mailing list
 Rcpp-devel@lists.r-forge.r-project.org
 https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

[Rcpp-devel] an error message from RcppArmadillo: sourceRcpp

2013-01-28 Thread Aileen Lin
Hi there,

I get RcppArmadillo running, but still has a problem
with Rcpp::sourceCpp(). My code is here:

#include Rcpp.h
#include RcppArmadillo.h
using namespace Rcpp;

//[[Rcpp::export]]
NumericMatrix add(NumericMatrix b){

  return b.n_cols;
}

 Rcpp::sourceCpp('add.cpp')
g++ -m64 -IC:/R/R-215~1.2/include -DNDEBUG
-IC:/Users/Aileen/Documents/R/win-library/2.15/Rcpp/include
-Id:/RCompile/CRANpkg/extralibs64/local/include -O2 -Wall
 -mtune=core2 -c add.cpp -o add.o add.cpp:2:27: fatal error:
RcppArmadillo.h: No such file or directory compilation terminated. make:
*** [add.o] Error 1
Error in Rcpp::sourceCpp(add.cpp) :
  Error 1 occurred building shared library.

Could anyone tell me what I did wrongly? Thank you.

Regards,
Aileen
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] an error message from RcppArmadillo: sourceRcpp

2013-01-28 Thread baptiste auguie
Hi,

I believe you're missing this line:

// [[Rcpp::depends(RcppArmadillo)]]

HTH,

baptiste

On 29 January 2013 19:08, Aileen Lin aileenshanhong@gmail.com wrote:

 Hi there,

 I get RcppArmadillo running, but still has a problem
 with Rcpp::sourceCpp(). My code is here:

 #include Rcpp.h
 #include RcppArmadillo.h
 using namespace Rcpp;

 //[[Rcpp::export]]
 NumericMatrix add(NumericMatrix b){

   return b.n_cols;
 }

  Rcpp::sourceCpp('add.cpp')
 g++ -m64 -IC:/R/R-215~1.2/include -DNDEBUG
 -IC:/Users/Aileen/Documents/R/win-library/2.15/Rcpp/include
 -Id:/RCompile/CRANpkg/extralibs64/local/include -O2 -Wall
  -mtune=core2 -c add.cpp -o add.o add.cpp:2:27: fatal error:
 RcppArmadillo.h: No such file or directory compilation terminated. make:
 *** [add.o] Error 1
 Error in Rcpp::sourceCpp(add.cpp) :
   Error 1 occurred building shared library.

 Could anyone tell me what I did wrongly? Thank you.

 Regards,
 Aileen

 ___
 Rcpp-devel mailing list
 Rcpp-devel@lists.r-forge.r-project.org
 https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel