[Rd] building a package - shared library loading problem

Simon Urbanek simon.urbanek at r-project.org
Wed Sep 19 21:41:26 CEST 2007


Konrad,

for a package you should not be using R CMD SHLIB at all. It is used  
internally and for non-package compilation.

If you have a proper source package, you just install it using R CMD  
INSTALL.

To be precise, assuming you have your package and source code in the  
"foo" directory you can create the source package like this:

tar fcz foo_1.0.tar.gz foo

That package doesn't contain any .so objects and thus can be  
installed anywhere using

R CMD INSTALL foo_1.0.tar.gz

That step will create the .so in the appropriate place which differs  
by system and R version. If you want to create a binary package for a  
given platform, use the --build flag.

Please read 'Writing R Extensions' - you just want to use the src  
directory and not mess with libs.

Cheers,
Simon


On Sep 19, 2007, at 1:25 PM, Konrad Smolinski wrote:

> Dear All,
> I am trying to write my first R package and I bump into loading shared
> library problem( working on Mac OS X 10.4.10 as well as Linux Ubuntu).
> I want to makes use of (incorporate) a shared library  
> matchinglib.so in
> the package. Library was created via R CMD -SHLIB.
> Following 'Writing R Extensions' I place matchinglib.so in the 'libs'
> directory and use NAMESPACE file with an entry:
> useDynLib(matchinglib)
>
> Now, executing 'R CMD check mypackage' I face the following error  
> on OS X:
> -----------------------------------------------------
> * checking whether the package can be loaded ... ERROR
> Error in library.dynam(lib, package, package.lib) :
>          shared library 'matchinglib' not found
> Error: package/namespace load failed for 'cheetah'
> Execution halted
>
> It looks like this package has a loading problem: see the messages for
> details.
> ----------------------------------------------------
> The same problem occurs under Linux.
>
> Shall I specify a direct path to libs or modify NAMESPACE?
>
> konrad
> ---
> Konrad Smolinski
> Economics Department
> European University Institute
> Badia Fiesolana
> Via dei Roccettini 9
> I-50014 San Domenico di Fiesole (FI)
> ITALY
>
> konrad.smolinski at eui.eu
> konrad.smolinski at gmail.com
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>



More information about the R-devel mailing list