[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 19:23:37 CEST 2021


Thank you Iñaki,

that was the missing part. The package compiles now.

I removed the RcppExports.cpp and called Rcpp::compileAttributes().
Together with the removal of useDynLib(nloptC) from NAMESPACE compilation
succeeded.

Again many thanks.

Simon

Am Mi., 18. Aug. 2021 um 17:28 Uhr schrieb Iñaki Ucar <
iucar at fedoraproject.org>:

> On Wed, 18 Aug 2021 at 16:37, Simon Zehnder
> <simon.zehnder at googlemail.com> wrote:
> >
> > 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)'.
>
> Remove this. The example has useDynLib(nloptC) because the package is
> called nloptC. Your package is called finmix, so you just need
> useDynLib(finmix) in the NAMESPACE.
>
> > 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);
> > }
>
> You have R_init_finmix instead, same reason as above.
>
> --
> Iñaki Úcar
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20210818/74392053/attachment-0001.html>


More information about the Rcpp-devel mailing list