[R-pkg-devel] DESCRIPTION file question

Taylor R. Brown trb5me @end|ng |rom v|rg|n|@@edu
Mon Jul 24 20:26:15 CEST 2023


Hi Dirk,

Yes, that helps very much. Thank you.

Right, my package calls out to inline::cxxfunction() to interface with one
particular c++ library. inline is a much more ambitious project obviously,
and I get how it can't require everything as a dependency.

Regarding your first paragraph, okay I'm on board now. I think we're both
looking at the same passage in Writing R Extensions, too. I had some
grammatical confusion. When I read

"Specifying a package in ‘LinkingTo’ suffices if these are C/C++ headers
containing source code or static linking is done at installation"

it sounds like it's referring to c/c++ headers being included at
potentially other times besides installation. In other words, it sounds
like "at installation" only applies to the second of those two conditions.
However, if I continue on reading that same paragraph, I now think that "at
installation" applies to both conditions. It even gives explicit
instructions regarding what to do about vignettes requiring packages, which
is my exact situation.

I just removed everything from both LinkingTo and Imports, stuck them in
Suggests, and now all the notes are silenced after checking on a variety of
OSes. Thanks again.

Best,
Taylor





On Sat, Jul 22, 2023 at 6:27 PM Dirk Eddelbuettel <edd using debian.org> wrote:

>
> On 22 July 2023 at 16:07, Dirk Eddelbuettel wrote:
> |
> | Taylor,
> |
> | I believe we have been over this at StackOverflow but you may by now have
> | deleted the question/
> |
> | On 21 July 2023 at 20:51, taylor brown via R-package-devel wrote:
> | | I have a question about the DESCRIPTION file of an R package that has
> some c++ dependencies.
> | |
> | | This package of mine builds c++ code during an interactive R session,
> but
> | |  does not contain any source c++ in itself. The c++ files make
> reference to
> | |  some dependencies that are made available by other third party R
> packages.
> | |
> | | LinkingTo is the appropriate field for the DESCRIPTION file (usually)
> here, not Imports, but if If I remove the dependencies (BH and RcppEigen)
> from the Imports field, the code examples in the vignette will fail to
> build on a fresh machine.
> | |
> | | The NOTES in my build mention that, because I have no src/ directory,
> LinkingTo is ignored. Simultaneously, there is another note that mentions
> Imports is also excessive.
> |
> | As your package has no src/ directory and does no compilation itself,
> you do
> | not need / have no use for LinkingTo to provide the include/ directory
> of one
> | or more listed packages.
> |
> | (If you have offer that compilation ability in a helper function you
> need to
> | tell the deal with it in the function. You can use `requireNamespace()`
> to
> | check if a package is present, warn or error if not, and compute the
> include/
> | directory location using R helper functions such as system.file().)
> |
> | | It’s kind of a catch 22. It feels like my options are either add the
> Imports lines and ignore the NOTE, or add a superfluous src/ directory to
> silence the NOTE. Which option is the preferred one? Or is there a third?
> |
> | I think all you need is in Writing R Extensions. For us to help you more
> a
> | concrete example, maybe even from a mock package, would help.
>
> PS An existing example is provided by the 'inline' package, originally by
> Oleg Sklyar, extented by many, and maintained by me for some time. It lets
> you work on code in C, C++, Fortran, ... and it compiles, links and loads
> it
> for you from an R session just you seem to desire.
>
> And 'inline' has no LinkingTo and only one Imports for 'methods' as it uses
> some S4.
>
> Hth, Dirk
>
> --
> dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
>


-- 
Taylor R. Brown, Ph.D.
Assistant Professor of Statistics, General Faculty
Department of Statistics
University of Virginia

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list