[R-pkg-devel] nativeRoutines error when using roxygen2 in RStudio

Rampal S. Etienne r@mp@letienne @ending from gm@il@com
Wed Nov 7 15:27:20 CET 2018


Dear Georgi,

Thanks for the suggestion, but that does not work either.

I can send the code if that would help. But note that the code was
working fine until I installed a new R-devel version. But perhaps there
is an update in how the routines should be registered. I am doing it
like this:

#include <R.h>
#include <Rinternals.h>
#include <stdlib.h> // for NULL
#include <R_ext/Rdynload.h>

/* .Fortran calls */
extern void F77_NAME(fill1d)(double *vec, int *DIMP, double *parms, int
*II);
extern void F77_NAME(initmod)(void (*steadyparms)(int *, double *));
extern void F77_NAME(runmod)(int *neq, double *t, double *Conc, double
*dConc, double *yout, int *ip);

static const R_FortranMethodDef FortranEntries[] = {
  {"fill1d", (DL_FUNC) &F77_NAME(fill1d),  4},
  {"initmod", (DL_FUNC) &F77_NAME(initmod),  1},
  {"runmod", (DL_FUNC) &F77_NAME(runmod),  6},
  {NULL, NULL, 0}
};

void R_init_secsse(DllInfo *dll)
{
  R_registerRoutines(dll, NULL, NULL, FortranEntries, NULL);
  R_useDynamicSymbols(dll, FALSE);
}

Does that look OK?

Cheers, Rampal

On 7-11-2018 12:45, Georgi Boshnakov wrote:
> Without code we are guessing.  A bug is possible but I will make another guess suggestion.
>
> Delete all binary files created by devtools during compilation in your package directory.
> devtools::load_all() is so fast partly because it recompiles the C/Fortran files only when necessary
> but sometimes compilation may be needed even if devtools thinks otherwise.
>
>  Georgi Boshnakov
>
>
> -----Original Message-----
> From: Duncan Murdoch [mailto:murdoch.duncan using gmail.com] 
> Sent: 07 November 2018 00:26
> To: Rampal Etienne; Georgi Boshnakov; r-package-devel using r-project.org
> Subject: Re: [R-pkg-devel] nativeRoutines error when using roxygen2 in RStudio
>
> On 06/11/2018 5:17 PM, Rampal Etienne wrote:
>> Dear Duncan,
>>
>> I don't get it when using R CMD check.
>>
>> I only get it when building/loading using roxygen2 or when I call
>> load_all (which roxygen2 does too, I think). load_all calls load_dll
>> which then throws this error. I have registered my routines in
>> R_init_secsse.c:
>>
>> void R_init_secsse(DllInfo *dll)
>> {
>>     R_registerRoutines(dll, NULL, NULL, FortranEntries, NULL);
>>     R_useDynamicSymbols(dll, FALSE);
>> }
>>
>> Any suggestions?
> Nope!  Sounds like a bug in devtools/roxygen2, but I don't know either 
> of those packages well.
>
> Duncan Murdoch
>
>> Cheers, Rampal
>>
>>
>> On 06-Nov-18 22:50, Duncan Murdoch wrote:
>>> On 06/11/2018 3:27 PM, Rampal Etienne wrote:
>>>> Dear Georgi,
>>>>
>>>> Thanks for your suggestions. I have tried to install the development
>>>> version of roxygen2, but to no avail.
>>>>
>>>> I don't have a Collate field in DESCRIPTION.
>>>>
>>>> devtools::check() gives me:
>>>>
>>>> Updating secsse documentation Loading secsse Registered S3 method
>>>> overwritten by 'dplyr': method from as.data.frame.tbl_df tibble
>>>> Registered S3 method overwritten by 'geiger': method from
>>>> unique.multiPhylo ape Error in nativeRoutines[[lib]] <- routines :
>>>> object 'nativeRoutines' not found
>>> Do you get that error if you run "R CMD check" on the tarball of your
>>> package?
>>>
>>> If so, how comfortable are you with debugging R code?  I can tell you
>>> how to debug the check process, but it's a little tricky.
>>>
>>> Duncan Murdoch
>>>
>>>>
>>>> Any other suggestions?
>>>>
>>>> Cheers, Rampal
>>>>
>>>> On 02-Nov-18 08:33, Georgi Boshnakov wrote:
>>>>> Try installing the latest development version of roxygen2, if you
>>>>> are not using it already.
>>>>> There was a bug in the released version preventing installation in
>>>>> some cases.
>>>>> If you don't want to use development version of roxygen2,
>>>>> try putting all filenames in the Collate field in DESCRIPTION on one
>>>>> line and make sure that there is a single space
>>>>> between them. This should work if your problem is what I think.
>>>>>
>>>>> By the way, in such cases you will get more informative messages if
>>>>> you run devtools::check().
>>>>>
>>>>> -- 
>>>>> Georgi Boshnakov
>>>>>
>>>>>
>>>>> ________________________________________
>>>>> From: R-package-devel [r-package-devel-bounces using r-project.org] on
>>>>> behalf of Rampal Etienne [rampaletienne using gmail.com]
>>>>> Sent: 01 November 2018 22:40
>>>>> To: r-package-devel using r-project.org
>>>>> Subject: [R-pkg-devel] nativeRoutines error when using roxygen2 in
>>>>> RStudio
>>>>>
>>>>> Since a few weeks (after updating R-devel and Rtools) I get the
>>>>> following error when trying to build a package or document it, when
>>>>> using roxygen2 in RStudio:
>>>>>
>>>>> In R CMD INSTALL Error in nativeRoutines[[lib]] <- routines : object
>>>>> 'nativeRoutines' not found Calls: suppressPackageStartupMessages ...
>>>>> withCallingHandlers -> <Anonymous> -> load_all -> load_dll Execution
>>>>> halted
>>>>>
>>>>> When I disable roxygen2, I do not get this error, but of course the
>>>>> documentation is not created.
>>>>>
>>>>> I have installed the latest versions of RStudio, Rtools, R-devel,
>>>>> roxygen2, pkgload, but the problem persists.
>>>>>
>>>>> Does anybody have a clue what is causing this? I am using Windows 10,
>>>>> and the package contains Fortran code.
>>>>>
>>>>> Kind regards,
>>>>> Rampal Etienne
>>>>>
>>>>>            [[alternative HTML version deleted]]
>>>>>
>>>>> ______________________________________________
>>>>> R-package-devel using r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>>>
>>>>      [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> R-package-devel using r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>>>



More information about the R-package-devel mailing list