[Rcpp-devel] Using Rcpp with <nloptrApi.h> results in "shared object 'nloptC.so' not found"

Simon Zehnder simon.zehnder at googlemail.com
Wed Aug 18 16:36:36 CEST 2021


Hi folks,

apologies, if I am double posting - I had problems with my mail.

I need some help here from experienced Rcpp developers.

I am coding since some time on an R-package using Rcpp and nlopt. Lately I
found out that I could probably use 'nloptr' to include nlopt in my C++
code, which would give a great advantage to users of my package (instead of
installing nlopt on their systems by hand).
I followed the example on
https://github.com/jchiquet/RcppArmadilloNLoptExample (the nloptC one) and
modified my code accordingly. When I compile my package I get the error

" Error: package or namespace load failed for ‘finmix’ in
library.dynam(lib, package, package.lib):
 shared object ‘nloptC.so’ not found"

In my DESCRIPTION I use in the 'Imports' and the 'LinkingTo' field
'nloptr'. In my NAMESPACE I load 'nloptC' via 'useDynLib(nloptC)'.
What I saw in the example's 'RcppExports.cpp' file is

RcppExport void R_init_nloptC(DllInfo *dll) {
    R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
    R_useDynamicSymbols(dll, FALSE);
}

This part is missing in my 'RcppExports.cpp' (I recompiled the file via
'Rcpp::compileAttributes' also tried to compile twice). I cannot explain
what is missing on my side.

If someone of you has an idea what might be the error on my side, please
let me know. I am thankful for any advice. If you want to compile my
package you can find it on my GitHub at
https://github.com/simonsays1980/finmix/tree/nloptapi.

I am using R 4.0.5 on a Fedora 34 System, Rcpp 1.0.6 and nloptr 1.2.2.2.

Thanks for any time and efforts you spent on my problem.
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20210818/814ade08/attachment.html>


More information about the Rcpp-devel mailing list