[R-pkg-devel] How does one install a libtool generated libfoo.so.1 file into ./libs/?

Pariksheet Nanda p@r|k@heet@n@nd@ @end|ng |rom uconn@edu
Tue Oct 19 17:50:11 CEST 2021


Hi Simon and Vladimir,

 >> On Oct 19, 2021, at 4:13 PM, Pariksheet Nanda 
<pariksheet.nanda using uconn.edu> wrote:
 >> The trouble is, R's installation process will only copy compiled 
files from ./libs/ that have exactly the extension ".so" and files 
ending with ".so.1" are ignored.
--snip--
 >> library(tsshmm)
 >> ...
 >> Error: package or namespace load failed for 'tsshmm' 
indyn.load(file, DLLpath = DLLpath, ...):
 >> unable to load shared object 
'/home/omsai/R/x86_64-pc-linux-gnu-library/4.1/tsshmm/libs/tsshmm.so':
 >>   libghmm.so.1: cannot open shared object file: No such file or 
directory
 >
>> Pariksheet
On 10/19/21 5:00 AM, Simon Urbanek wrote:
> 
> dynamic linking won't work, compile a static version with PIC enabled. If the subproject is autoconf-compatible this means using --disable-shared --with-pic. Then you only need to add libfoo.a to your PKG_LIBS. >
 > Simon

On 10/19/21 6:39 AM, Vladimir Dergachev wrote:
 >
 > The simplest thing to try is to compile the library statically and 
link it
 > into your package. No extra files - no trouble.
 >
 > You can also try renaming the file from *.so.1 to *.so.
 >
 > Vladimir Dergachev

Thank you both for your suggestions!  I will link the code statically 
with PIC per your consensus.

I found when linking the R package library, one also has to link the 
dependencies of the static library; in this case libghmm depends on 
libxml-2.0 > 2.6 and so I have to link libxml2 to my R package library 
after finding libxml2 with pkg-config.


Thanks for the quick replies,

Pariksheet



More information about the R-package-devel mailing list