From ligges at statistik.tu-dortmund.de  Wed Sep 14 16:16:17 2011
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Wed, 14 Sep 2011 16:16:17 +0200
Subject: [Rd] Building R package with precompiled shared library
In-Reply-To: <6441154A9FF1CD4386AF4ABF141A056D2A74C013@WMEXOSCD2-N1.bocad.bank-banque-canada.ca>
References: <CABeDHXCznmmUDVRhcDXc-3NXR4PK4A9r_30YLNcTuC1Kihpo6Q@mail.gmail.com>
	<6441154A9FF1CD4386AF4ABF141A056D2A74C013@WMEXOSCD2-N1.bocad.bank-banque-canada.ca>
Message-ID: <4E70B731.2020308@statistik.tu-dortmund.de>



On 14.09.2011 15:52, Paul Gilbert wrote:
> My understanding is that this cannot be done, for both licence and security reasons. The package build expects source code and removes binaries. You can link with binaries that are provided separately from the package, possibly coming from a vendor that sells non-open source code, but you cannot include them in the package.

Actually, you can include them, but then the package won't be accepted 
on CRAN, for example.

Let me cite Writing R Extensions:

"Note that CRAN does not accept submissions of precompiled binaries due 
to security concerns, and does not allow binary executables in packages. 
Maintainers who need additional software for the Windows binaries of 
their packages on CRAN have three options

1. To arrange for installation of the package to download the additional 
software from a URL, as e.g. package Cairo does.
2. To negotiate with Uwe Ligges to host the additional components on 
WinBuilder, and write a ?configure.win? file to install them. There are 
many examples, e.g. package rgdal."

So in case you do not want to move it to CRAN, you can simply use the 
same tricks that rgdal uses for Windows binaries on CRAN.

Uwe Ligges





>
> Paul
>
>> -----Original Message-----
>> From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-
>> project.org] On Behalf Of Francesco Finazzi
>> Sent: September 14, 2011 3:41 AM
>> To: r-devel at r-project.org
>> Subject: [Rd] Building R package with precompiled shared library
>>
>> Dear R users,
>>
>> we are trying to build a R package that includes a precompiled shared
>> library, let's say mylib.so. We created the skeleton of the package
>> and we moved the mylib.so file into the libs folder that we created at
>> the same level of the folders man and R. Moreover we created the file
>> NAMESPACE and we added the line useDynLib(mylib, .registration=TRUE).
>> The building step seems to work correctly but when we try to install
>> the package we get
>>
>> ** testing if installed package can be loaded
>> Error in library.dynam(lib, package, package.lib) :
>>   shared library 'mylib' not found
>>
>> we cannot understand what's wrong and where R searches for the mylib.so
>> files.
>>
>> Any suggestion?
>>
>> Thanks,
>>
>> Michela and Francesco
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
> ====================================================================================
>
> La version fran?aise suit le texte anglais.
>
> ------------------------------------------------------------------------------------
>
> This email may contain privileged and/or confidential information, and the Bank of
> Canada does not waive any related rights. Any distribution, use, or copying of this
> email or the information it contains by other than the intended recipient is
> unauthorized. If you received this email in error please delete it immediately from
> your system and notify the sender promptly by email that you have done so.
>
> ------------------------------------------------------------------------------------
>
> Le pr?sent courriel peut contenir de l'information privil?gi?e ou confidentielle.
> La Banque du Canada ne renonce pas aux droits qui s'y rapportent. Toute diffusion,
> utilisation ou copie de ce courriel ou des renseignements qu'il contient par une
> personne autre que le ou les destinataires d?sign?s est interdite. Si vous recevez
> ce courriel par erreur, veuillez le supprimer imm?diatement et envoyer sans d?lai ?
> l'exp?diteur un message ?lectronique pour l'aviser que vous avez ?limin? de votre
> ordinateur toute copie du courriel re?u.
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Building R package with precompiled shared library
Uwe Ligges