Sorry, I don&#39;t have a small example. I could come up with one, but that would be purely artificial. <br><br>I am using Rcpp and rpy2 so I can use OpenOpt, a python optimization framework with interfaces to a ton of different open source and proprietary nonlinear and linear solvers. My objective function is very expensive to evaluate and is implemented in R using Rcpp and various other R libraries. Using OpenOpt allows to try a lot of different solvers without having to change my implementation. <br>

<br><div class="gmail_quote">On Mon, Aug 15, 2011 at 2:59 PM, Dirk Eddelbuettel <span dir="ltr">&lt;<a href="mailto:edd@debian.org">edd@debian.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im"><br>
On 15 August 2011 at 10:00, Jonas Rauch wrote:<br>
| Just to close this up:<br>
| I found out that my Rcpp installation must have occured when my R was not built<br>
| with shared lib. Thus Rcpp was not linked to libR. Just reinstalling Rcpp from<br>
| source solved the problem.<br>
<br>
</div>That makes sense, and thank you for closing the loop by reporting back.  If<br>
you have a small self-contained example of rpy2 and Rcpp, can you send it my<br>
way?  It may make sense to add this to the Rcpp_FAQ vignette.<br>
<font color="#888888"><br>
Dirk<br>
</font><div><div></div><div class="h5"><br>
| Regards,<br>
| Jonas<br>
|<br>
| On Fri, Aug 12, 2011 at 3:16 PM, Dirk Eddelbuettel &lt;<a href="mailto:edd@debian.org">edd@debian.org</a>&gt; wrote:<br>
|<br>
|<br>
|     On 12 August 2011 at 14:33, Jonas Rauch wrote:<br>
|     | Hi Dirk and Romain,<br>
|     |<br>
|     | Aparrently libR is not loaded by rpy2, at least not in a way such that<br>
|     Rcpp can<br>
|     | access it. I have solved the problem by adding -lR to the linker flags<br>
|     when<br>
|     | building Rcpp. Since for normal use of Rcpp from R this does not make a<br>
|     | difference, would you mind adding this to the Makevars file in a future<br>
|     version<br>
|     | of Rcpp? Or does this lead to problems in case R is build without<br>
|     libR.so?<br>
|<br>
|     I would be somewhat hesitant to do so as it may affect all users of Rcpp.<br>
|<br>
|     Rcpp is for getting code into R, and we can take libR as given as R is<br>
|     always<br>
|     around when loading Rcpp.  I think the problem is really with the linker<br>
|     and<br>
|     passing symbols through from one end to the other.<br>
|<br>
|     Other views, anyone?<br>
|<br>
|     Dirk<br>
|<br>
|<br>
|     | Best regards,<br>
|     | Jonas<br>
|     |<br>
|     | ---------- Forwarded message ----------<br>
|     | From: Jonas Rauch &lt;<a href="mailto:jonas.rauch@googlemail.com">jonas.rauch@googlemail.com</a>&gt;<br>
|     | Date: Fri, Aug 12, 2011 at 10:36 AM<br>
|     | Subject: Rcpp and rpy2<br>
|     | To: rcpp-devel &lt;<a href="mailto:rcpp-devel@r-forge.wu-wien.ac.at">rcpp-devel@r-forge.wu-wien.ac.at</a>&gt;<br>
|     |<br>
|     |<br>
|     | Is Rcpp compatible with rpy2?<br>
|     | I would like to call a very complex R function from python. My function<br>
|     depends<br>
|     | on code implemented with Rcpp. When I try to load Rcpp from python via<br>
|     |<br>
|     | import rpy2.robjects as robjects<br>
|     | robjects.r(&#39;library(Rcpp)&#39;)<br>
|     |<br>
|     | I get the following:<br>
|     |<br>
|     | Error in dyn.load(file, DLLpath = DLLpath, ...) :<br>
|     |   unable to load shared object &#39;/home/jonas/R/<br>
|     x86_64-unknown-linux-gnu-library<br>
|     | /2.13/Rcpp/libs/Rcpp.so&#39;:<br>
|     |   /home/jonas/R/x86_64-unknown-linux-gnu-library/2.13/Rcpp/libs/Rcpp.so:<br>
|     | undefined symbol: R_ClassSymbol<br>
|     | Error: package/namespace load failed for &#39;Rcpp&#39;<br>
|     | Traceback (most recent call last):<br>
|     |   File &quot;RcppTest.py&quot;, line 2, in &lt;module&gt;<br>
|     |     robjects.r(&#39;library(Rcpp)&#39;)<br>
|     |   File &quot;/usr/local/lib/python2.7/dist-packages/<br>
|     | rpy2-2.2.2dev_20110811-py2.7-linux-x86_64.egg/rpy2/robjects/__init__.py&quot;,<br>
|     line<br>
|     | 225, in __call__<br>
|     |     res = self.eval(p)<br>
|     |   File &quot;/usr/local/lib/python2.7/dist-packages/<br>
|     | rpy2-2.2.2dev_20110811-py2.7-linux-x86_64.egg/rpy2/robjects/<br>
|     functions.py&quot;, line<br>
|     | 82, in __call__<br>
|     |     return super(SignatureTranslatedFunction, self).__call__(*args,<br>
|     | **kwargs)<br>
|     |   File &quot;/usr/local/lib/python2.7/dist-packages/<br>
|     | rpy2-2.2.2dev_20110811-py2.7-linux-x86_64.egg/rpy2/robjects/<br>
|     functions.py&quot;, line<br>
|     | 34, in __call__<br>
|     |     res = super(Function, self).__call__(*new_args, **new_kwargs)<br>
|     | rpy2.rinterface.RRuntimeError: Error: package/namespace load failed for<br>
|     &#39;Rcpp&#39;<br>
|     |<br>
|     | From what I understand R_ClassSymbol is supplied by libR.so, which should<br>
|     by<br>
|     | loaded by rpy2 anyway in order to work at all, or am I totally wrong<br>
|     here?<br>
|     |<br>
|     | Running python 2.7.1, rpy2-2.2.2, R 2.13.0<br>
|     | I would appreciate any help.<br>
|     |<br>
|     | Regards,<br>
|     | Jonas<br>
|     |<br>
|     |<br>
|     | ----------------------------------------------------------------------<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>
|<br>
|     --<br>
|     Two new Rcpp master classes for R and C++ integration scheduled for<br>
|     New York (Sep 24) and San Francisco (Oct 8), more details are at<br>
|     <a href="http://dirk.eddelbuettel.com/blog/2011/08/04#" target="_blank">http://dirk.eddelbuettel.com/blog/2011/08/04#</a><br>
|     rcpp_classes_2011-09_and_2011-10<br>
|     <a href="http://www.revolutionanalytics.com/products/training/public/" target="_blank">http://www.revolutionanalytics.com/products/training/public/</a><br>
|     rcpp-master-class.php<br>
|<br>
|<br>
<br>
</div></div>--<br>
<div><div></div><div class="h5">Two new Rcpp master classes for R and C++ integration scheduled for<br>
New York (Sep 24) and San Francisco (Oct 8), more details are at<br>
<a href="http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10" target="_blank">http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10</a><br>
<a href="http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php" target="_blank">http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php</a><br>
</div></div></blockquote></div><br>