[Rcpp-devel] R.e. A RcppArmadillo based program cannot compile under Windows and RStudio
Christian Gunning
xian at unm.edu
Wed Mar 11 23:25:41 CET 2015
No problem.
One more piece of list etiquette: when writing follow-up emails,
please CC the list in your response to individuals who have directly
answered you. This prevents questions from being (privately) answered
repeatedly.
Two questions:
* Can you confirm that you do, in fact, have RcppArmadillo installed
by a call to library(RcppArmadillo)?
* You've looked over the Rcpp FAQ carefully? Compilation on windows
is, er, different.
http://dirk.eddelbuettel.com/code/rcpp/Rcpp-FAQ.pdf
I don't have a windows machine, so I'm not able to reproduce your
problem. Perhaps someone else can use the detailed information that
you've provided to identify the problem with your included example.
Best,
Christian
On Wed, Mar 11, 2015 at 9:38 AM, 烧锅炉的天使 <pdslimofei at qq.com> wrote:
> I am sorry for that not include a short & informative title in my email.
>
> A RcppArmadillo based program cannot compile under Windows and RStudio
>
> In RStudio
> ######
>> Rcpp::sourceCpp('armaLU.cpp',verbose = TRUE)
>
> Generated extern "C" functions
> --------------------------------------------------------
>
>
> #include <Rcpp.h>
> // LU
> int LU();
> RcppExport SEXP sourceCpp_75578_LU() {
> BEGIN_RCPP
> Rcpp::RObject __result;
> Rcpp::RNGScope __rngScope;
> __result = Rcpp::wrap(LU());
> return __result;
> END_RCPP
> }
>
> Generated R functions
> -------------------------------------------------------
>
> `.sourceCpp_75578_DLLInfo` <-
> dyn.load('C:/Users/lxh/AppData/Local/Temp/RtmporLzPl/sourcecpp_19a8798d5d84/sourceCpp_59453.dll')
>
> LU <- Rcpp:::sourceCppFunction(function() {}, FALSE,
> `.sourceCpp_75578_DLLInfo`, 'sourceCpp_75578_LU')
>
> rm(`.sourceCpp_75578_DLLInfo`)
>
> Building shared library
> --------------------------------------------------------
>
> DIR: C:/Users/lxh/AppData/Local/Temp/RtmporLzPl/sourcecpp_19a8798d5d84
>
> C:/R-31~1.3/bin/i386/R CMD SHLIB -o "sourceCpp_59453.dll" "" "armaLU.cpp"
> g++ -m32 -I"C:/R-31~1.3/include" -DNDEBUG
> -I"C:/R-3.1.3/library/Rcpp/include"
> -I"C:/R-3.1.3/library/RcppArmadillo/include" -I"D:/Rstudio"
> -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall
> -mtune=core2 -c armaLU.cpp -o armaLU.o
> g++ -m32 -shared -s -static-libgcc -o sourceCpp_59453.dll tmp.def armaLU.o
> -LC:/R-31~1.3/bin/i386 -lRlapack -LC:/R-31~1.3/bin/i386 -lRblas -lgfortran
> -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386
> -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/R-31~1.3/bin/i386 -lR
> Error in inDL(x, as.logical(local), as.logical(now), ...) :
> unable to load shared object
> 'C:/Users/lxh/AppData/Local/Temp/RtmporLzPl/sourcecpp_19a8798d5d84/sourceCpp_59453.dll':
> LoadLibrary failure: The specified module could not be found。
>
> #########################################
> But the default Rcpp template can compile with Rcpp without problem , the
> RcppEigen program can compile without any error also.
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "Christian Gunning";<xian at unm.edu>;
> 发送时间: 2015年3月11日(星期三) 上午6:44
> 收件人:
> "rcpp-devel at lists.r-forge.r-project.org"<rcpp-devel at lists.r-forge.r-project.org>;
> 主题: [Rcpp-devel] ??lxh???
>
> lxh,
>
> A quick word r.e. list etiquette -- you can help others process your
> request by including in your email a short & informative title, and a
> one or two sentence description of what you're trying to accomplish.
>
> I'm not on windows, so all I can say is that it works for me. Have you
> verified that RcppArmadillo installed without error?
>
> The other thing you can try is use the following to observe the
> details of the compilation process:
>
> sourceCpp('armaPRI.cpp', verbose=TRUE)
>
> hth,
> Christian
>
>> Date: Tue, 10 Mar 2015 21:49:18 +0800 (CST)
>> From: lxh <zjgslxh at 163.com>
>> To: rcpp-devel at lists.r-forge.r-project.org
>> Subject: [Rcpp-devel] ??lxh???
>> Message-ID: <1aef304a.18ae8.14c03f25f44.Coremail.zjgslxh at 163.com>
>> Content-Type: text/plain; charset="gbk"
>>
>> Hi,
>>
>> #########################################
>>> Rcpp::sourceCpp('armaPRI.cpp')
>>
>> Error in inDL(x, as.logical(local), as.logical(now), ...) :
>> unable to load shared object
>> 'C:/Users/lxh/AppData/Local/Temp/RtmpeenRl8/sourcecpp_27081dce2d4b/sourceCpp_77404.dll':
>> LoadLibrary failure: The specified module could not be found.
>> I get this when trying to use RcppArmadillo with my princomp computation
>> program(armaPRI.cpp). I am sure that i have missed something which results
>> above error message, but i have no idea about that.
>> By the way, the program eigentrans.cpp which uses the RcppEigen package
>> works well.
>>
>> The Rtools path and the R bin path are already added to my Enviroment
>> Path:
>> #############################################################
>>
>> c:\Rtools\gcc-4.6.3\bin;c:\Rtools\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\MiKTeX
>> 2.9\miktex\bin\;C:\Python27;C:\Python27\DLLs;C:\Python27\Scripts;C:\Program
>> Files\ATI
>> Technologies\ATI.ACE\Core-Static;C:\TDM-GCC-32\bin;C:\R-3.1.3\bin;D:\Program
>> Files\RStudio\bin\pandoc
>>
>> ###########################################################################################
>> armaPRI.cpp
>>
>> ###########################################################################################
>> // [[Rcpp::depends(RcppArmadillo)]]
>> #include <RcppArmadillo.h>
>> using namespace arma;
>> using namespace Rcpp;
>> // [[Rcpp::export]]
>> int PRINCOMP(){
>> mat A = randu<mat>(5,4);
>> mat coeff;
>> mat score;
>> vec latent;
>> vec tsquared;
>> princomp(coeff, score, latent, tsquared, A);
>> Rcout<<coeff<<endl;
>> return 0;
>> }
>>
>> #####################################################################################################
>
> --
> A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
More information about the Rcpp-devel
mailing list