Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package with Stan functions failed to compile #129

Open
wds15 opened this issue Nov 19, 2024 · 2 comments · May be fixed by #130
Open

package with Stan functions failed to compile #129

wds15 opened this issue Nov 19, 2024 · 2 comments · May be fixed by #130

Comments

@wds15
Copy link

wds15 commented Nov 19, 2024

Hi!

I have a package called RBesT which I keep in a git repo called BesT... this is why the directory I am using to develop is called BesT rather than RBesT. As a result the code here:

paste(basename(pkgdir), "types.h", sep = "_")),

creates a src/BesT_types.hpp file. This file is then ignored by Rcpp which then fails to include the file into src/RcppExports.cpp. Rather than using the package directory as a way to determine the R package name, the much better way is to do as Rcpp does here:

https://github.com/RcppCore/Rcpp/blob/6193de530785f1d84117a852cf7e478b1f048b2f/R/Attributes.R#L422

this use the package DESCRIPTION file to tweak out the R package name.

@mcol
Copy link
Collaborator

mcol commented Nov 19, 2024

Something like this is also enough:

strsplit(x = readLines("DESCRIPTION", n = 1, warn = FALSE),
         split = "Package: ", fixed = TRUE)[[1]][2]

@jgabry
Copy link
Member

jgabry commented Nov 19, 2024

Thanks for pointing this out. Do either of you have time to put together a quick PR? I'm a bit overloaded at the moment.

@mcol mcol linked a pull request Nov 19, 2024 that will close this issue
@jgabry jgabry linked a pull request Nov 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants