Although a few solutions exist on the internet, I found none of those suitable for the problem I'm curerntly facing (though maybe I'm simply too dumb):
I'm trying to build an R package which makes extensive use of a shared object compiled by a Makefile (yes, bad practice, I know, but a Makevars file just can't be told to compile C and Fortran code into one shared object) from code in the package's src
directory. No matter where I compile that .so to (I tried the src
, libs
and package base folders) or how I name it (as one of the solutions mentioned above states it must be named like the package it's contained in), R CMD check
exits with
** testing if installed package can be loaded
Error in library.dynam(lib, package, package.lib) :
shared object ‘SoMNibEN.R.so’ not found
due to the useDynLib(SoMNibEN.R)
instruction in my NAMESPACE file (where SoMNibEN.R
is my package's name, but it didn't work with the original name, either)
My assumption is that I'm either using that useDynLib()
command wrong or I'm doing something wrong with my Makefile (although the compilation works pretty well and the shared object is created in my project folder - I just don't know whether it gets copied to the package installation directory successfully).
So, if anyone knows what I might be doing wrong here, please let me know!