<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>Thanks Dirk for your advice</div><div><br></div><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>De: </b>"Dirk Eddelbuettel" <edd@debian.org><br><b>À: </b>"Marie-Pierre ETIENNE" <marie.etienne@agroparistech.fr><br><b>Cc: </b>rcpp-devel@lists.r-forge.r-project.org<br><b>Envoyé: </b>Vendredi 1 Mai 2015 17:33:11<br><b>Objet: </b>Re: [Rcpp-devel] Linking Rcpp and libcmaes within a package<br><div><br></div><br>On 1 May 2015 at 16:12, Marie-Pierre ETIENNE wrote:<br>| CXX_STD = CXX11<br>| PKG_CPPFLAGS=-I/usr/local/include/libcmaes -I../inst/include -I/usr/local/include/eigen3/<br><div><br></div>If you add   LinkingTo: RcppEigen   then you don't need the explicit include<br>for Eigen3, and are more portable.  Of course, you would need our RcppEigen package.<br><div><br></div>| PKG_LIBS = -L/usr/local/lib -l cmaes`$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"`<br><div><br></div>A few issues here:<br><div><br></div>  1) The Rscript call has not been necessary for about 15 months now since<br>     Rcpp 0.11.0 came out.<br> <br>  2) The space between -l and cmaes is an error <br><div><br></div>  3) -L/usr/local/lib is not needed, that is a default directory<br><div><br></div>so try just<br><div><br></div>PKG_LIBS = -lcmaes<br><div><br></div>instead.  <br><div><br></div><div><br></div><div><span style="color: rgb(0, 0, 0);">I have tried this but I still have the same error message </span></div><div><pre tabindex="0" class="GAKS5OJBBCB ace_text-layer ace_line GAKS5OJBCCB GAKS5OJBBT" style="color: #ffffff; outline: none; border: none; word-break: break-all; margin-top: 0px; margin-bottom: 0px; -webkit-user-select: text; box-sizing: border-box; width: 777px; padding: 6px; font-family: inherit !important; font-size: inherit !important; font-style: inherit !important; font-variant: inherit !important; font-weight: inherit !important; line-height: inherit !important; white-space: pre-wrap !important;" data-mce-style="color: #ffffff; outline: none; border: none; word-break: break-all; margin-top: 0px; margin-bottom: 0px; -webkit-user-select: text; box-sizing: border-box; width: 777px; padding: 6px; font-family: inherit !important; font-size: inherit !important; font-style: inherit !important; font-variant: inherit !important; font-weight: inherit !important; line-height: inherit !important; white-space: pre-wrap !important;"><span style="color: rgb(0, 0, 0);">Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/metienne/R/x86_64-pc-linux-gnu-library/3.1/testCMaes/libs/testCMaes.so':
  libcmaes.so.0: cannot open shared object file: No such file or directory
Error: loading failed
</span></pre><div><br></div></div>And just to be clear: The cmaes library is now a SystemRequirements: -- only<br>people who have it will be able to use your package.  For that reason some<br>people "internalise" such librarie in their package.  You need to check if<br>you a) are allowed to do that and b) if you want to -- yet more work.<br><div><br></div><div>Yes I am aware of this drawback of using external code. The libcmaes is distributed under LGPLv3 license, so I guess I should be allowed to internalise the library but ... one step at a time.<span style="color: rgb(0, 0, 0);" data-mce-style="color: #000000;"><span style="box-sizing: border-box; color: rgb(0, 0, 0); text-decoration: none; font-family: Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 13px; line-height: 20px; white-space: nowrap; background-color: rgb(248, 248, 248);" data-mce-style="box-sizing: border-box; color: #000000; text-decoration: none; font-family: Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 13px; line-height: 20px; white-space: nowrap; background-color: #f8f8f8;"><a href="https://github.com/beniz/libcmaes/commit/2e0f0595728058b6e3d4b24a476a566d9bbe9e29" class="message" data-pjax="true" title="added LGPLv3 license" data-mce-href="https://github.com/beniz/libcmaes/commit/2e0f0595728058b6e3d4b24a476a566d9bbe9e29" data-mce-style="box-sizing: border-box; color: #888888; text-decoration: none; font-family: Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 13px; line-height: 20px; white-space: nowrap; background-color: #f8f8f8;"></a></span></span></div><div>Anyway, thanks again for your advice. At least the global framework is cleaner. </div></div><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><br></div><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">Dirk<br><div><br></div>-- <br>http://dirk.eddelbuettel.com | @eddelbuettel | edd@debian.org<br></div><div><br></div></div></body></html>