Dirk,<br><br>thank you kindly - that works just as you say. <br><br>And also, thank you for all of the answers to Rcpp questions on stackoverflow and elsewhere - they've been immensely helpful throughout this project. Just about every time I have a question, you've already answered it.   :)<br>
<br>Many thanks,<br><br>ayn<br><br><br><br><br><br><div class="gmail_quote">On Sun, May 6, 2012 at 3:29 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Ayn,<br>
<div><div class="h5"><br>
On 6 May 2012 at 14:38, Ayn Leslie-Cook wrote:<br>
| Hi all,<br>
|<br>
| I'm a student at the University of Washington and my course project this spring<br>
| involves rewriting the 'svmpath' R package into C++ using Rcpp and<br>
| RccpArmadillo.  Everything runs beautifully until I try to include the<br>
| function below:<br>
|<br>
| vec solveKstar(mat Kstar){<br>
|   vec onestar = ones<vec>(Kstar.n_cols);<br>
|   onestar[0]=0;<br>
|                                                                                                                                         <br>
|   vec solution;<br>
|                                                                                                                                                           <br>
|   solution=solve(trimatu(Kstar),onestar);<br>
|   return solution;<br>
| }<br>
|<br>
| If I run R CMD INSTALL on my package removing the call to 'solve' everything<br>
| runs fine, but if I included the call to 'solve' then the R CMD INSTALL input<br>
| is<br>
|<br>
|<br>
| // all the typical output<br>
|<br>
| * installing to library ‘/net/home/aynlc3/Rlib’<br>
| * installing *source* package ‘aynSVMpath’ ...<br>
| ** libs<br>
| g++ -I/usr/share/R/include -DNDEBUG   -I"/net/home/aynlc3/Rlib/Rcpp/include"<br>
| -I"/net/home/aynlc3/Rlib/RcppArmadillo/include"   -fpic  -O3 -pipe  -g  -c<br>
| aynSVMpath.cpp -o aynSVMpath.o<br>
| g++ -I/usr/share/R/include -DNDEBUG   -I"/net/home/aynlc3/Rlib/Rcpp/include"<br>
| -I"/net/home/aynlc3/Rlib/RcppArmadillo/include"   -fpic  -O3 -pipe  -g  -c<br>
| svmHelpers.cpp -o svmHelpers.o<br>
| g++ -shared -o aynSVMpath.so aynSVMpath.o initializations.o svmHelpers.o<br>
| usetFunctions.o -L/net/home/aynlc3/Rlib/Rcpp/lib -lRcpp -Wl,-rpath,/net/home/<br>
| aynlc3/Rlib/Rcpp/lib -L/usr/lib/R/lib -lR<br>
| installing to /net/home/aynlc3/Rlib/aynSVMpath/libs<br>
<br>
</div></div>Your src/Makevars is insufficient -- use something like<br>
<br>
  PKG_LIBS= `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)<br>
<br>
so that you link against LAPACK and BLAS as well.<br>
<div><div class="h5"><br>
| ** R<br>
| ** preparing package for lazy loading<br>
| ** help<br>
| *** installing help indices<br>
| ** building package indices<br>
| ** testing if installed package can be loaded<br>
|<br>
|            // then<br>
|<br>
| Error in dyn.load(file, DLLpath = DLLpath, ...) :<br>
|   unable to load shared object '/net/home/aynlc3/Rlib/aynSVMpath/libs/<br>
| aynSVMpath.so':<br>
|   /net/home/aynlc3/Rlib/aynSVMpath/libs/aynSVMpath.so: undefined symbol:<br>
| dtrtrs_<br>
|<br>
|<br>
| If I change 3rd and 4th lines of the 'solveKstar' function to:<br>
|<br>
|   vec solution;<br>
|                                                                                                                                                           <br>
|<br>
|   solution=solve(Kstar,onestar);    // removing the call to 'trimatu'<br>
|<br>
| the R CMD INSTALL output has the same typical output above, but with the<br>
| following change to the error<br>
|<br>
| Error in dyn.load(file, DLLpath = DLLpath, ...) :<br>
|   unable to load shared object '/net/home/aynlc3/Rlib/aynSVMpath/libs/<br>
| aynSVMpath.so':<br>
|   /net/home/aynlc3/Rlib/aynSVMpath/libs/aynSVMpath.so: undefined symbol:<br>
| dgels_<br>
|<br>
|<br>
| The symbols 'dtrtrs_' and 'dgels_' are not part of my code;  from digging<br>
| online, I believe these are coming from the lapack library, but I'm not sure<br>
| how to proceed with that knowledge.  Does anyone have any advice?<br>
<br>
</div></div>Yes, once you link with LAPACK and BLAS you should be fine.  Let us know if<br>
that works.<br>
<br>
Dirk<br>
<div class="im"><br>
|  Also, if relevant, I'm running R 2.15.0, Rcpp_0.9.10 and<br>
| RcppArmadillo_0.3.0.2 on mosix. <br>
|<br>
| Many thanks,<br>
|<br>
| Ayn<br>
|<br>
|<br>
|<br>
</div>| ----------------------------------------------------------------------<br>
| _______________________________________________<br>
| Rcpp-devel mailing list<br>
| <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
| <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
<span class="HOEnZb"><font color="#888888">--<br>
R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL<br>
See agenda, registration details and more at <a href="http://www.RinFinance.com" target="_blank">http://www.RinFinance.com</a><br>
</font></span></blockquote></div><br>