Re: [Rd] building a package - shared library loading problem

From: Simon Urbanek <>
Date: Wed, 19 Sep 2007 15:41:26 -0400


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.


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
> in
> the package. Library was created via R CMD -SHLIB.
> Following 'Writing R Extensions' I place 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)
> ______________________________________________
> mailing list
> mailing list Received on Wed 19 Sep 2007 - 19:51:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 19 Sep 2007 - 20:42:07 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.