[Rcpp-devel] Linking Rcpp and libcmaes within a package

Marie-Pierre ETIENNE marie.etienne at agroparistech.fr
Sat May 2 00:17:48 CEST 2015


The problem is solved, as you explained I had to update the ldconf cache. 
I guess that I didn't get any issues with the direct compilation of the example because I was building an executable file and not a shared library. 
Thanks a lot for taking the time to explain the key aspects. 

----- Mail original -----

De: "Dirk Eddelbuettel" <edd at debian.org> 
À: "Marie-Pierre ETIENNE" <marie.etienne at agroparistech.fr> 
Cc: "Dirk Eddelbuettel" <edd at debian.org>, rcpp-devel at lists.r-forge.r-project.org 
Envoyé: Vendredi 1 Mai 2015 22:30:09 
Objet: Re: [Rcpp-devel] Linking Rcpp and libcmaes within a package 


On 1 May 2015 at 19:03, Marie-Pierre ETIENNE wrote: 
| So I tried to apply your suggestion and I still have the same error 
| 
| 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 
| 
| I'm absolutely not confortable with this, so I wonder if libcmaes.so.0 should 
| be copied in the 
| 
| testCMaes package installation directory or should testCMaes.so access to it in the standard directory ? 

It depends. 

In the simplest case, you just have /usr/local/lib/libcmaes.so and after 
running 'sudo ldconfig' (to update the ldconf cache) you should see it when 
you do 'ldconfig -p | grep cmaes'. 

When libraries are installed by the distribution, you often get something 
like this: 

edd at max:~$ ls -l /usr/lib/libgsl.so* 
lrwxrwxrwx 1 root root 16 Jul 10 2014 /usr/lib/libgsl.so -> libgsl.so.0.17.0 
lrwxrwxrwx 1 root root 16 Jul 10 2014 /usr/lib/libgsl.so.0 -> libgsl.so.0.17.0 
-rw-r--r-- 1 root root 2221616 Jul 10 2014 /usr/lib/libgsl.so.0.17.0 
edd at max:~$ 

So it depends on where you got libcmaes from, and how you installed it. 

None of this has anything to do with Rcpp. You are simply trying to figire 
out how to work with a local library. 

And you will have the same issue in 5-line C program against the cmaes 
library. So I would suggest you seek some help from a more experienced 
programmer around you at Agro Paris, and come back when you can build and run 
a simple C program/ 

Dirk 

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150502/d928fdd2/attachment.html>


More information about the Rcpp-devel mailing list