-
Notifications
You must be signed in to change notification settings - Fork 92
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
Ark: Set R_INCLUDE_DIR
and R_SHARE_DIR
envvars?
#3637
Comments
@lionel- what scenarios does this break? |
The compilation-database generator in pkgload had to work around the absence of these envvars (and introduced another bug by doing so r-lib/pkgload#288). |
RStudio also does this; see e.g. I think |
And > R.home
function (component = "home")
{
rh <- .Internal(R.home())
switch(component, home = rh, bin = if (.Platform$OS.type ==
"windows" && nzchar(p <- .Platform$r_arch)) file.path(rh,
component, p) else file.path(rh, component), share = if (nzchar(p <- Sys.getenv("R_SHARE_DIR"))) p else file.path(rh,
component), doc = if (nzchar(p <- Sys.getenv("R_DOC_DIR"))) p else file.path(rh,
component), include = if (nzchar(p <- Sys.getenv("R_INCLUDE_DIR"))) p else file.path(rh,
component), modules = if (nzchar(p <- .Platform$r_arch)) file.path(rh,
component, p) else file.path(rh, component), file.path(rh,
component))
} |
See also #4133 for a likely consequence of not setting the include envvar. |
Using last Positron-2024.08.0-48.deb in Ubuntu 22, setting R_SHARE_DIR=/usr/share/R/share/ at my ~/.Renviron solve it. |
Strange, it doesn't work for me (also Ubuntu 22 / R4.4.1) even if I include in ~/.Renviron:
I can see these are set from within Positron using
EDIT: Sorry - I'm new to VS Code so I realised if I turn off the 'clangd' extension, then at least 'R.h' is found and I get basic completion features. C function signatures do not seem to be implemented yet though - I'd realistically need this to use as a daily driver. |
My understanding is that For R specifically, I think you can use bear to generate that file; you could then do something like:
in your R package directory. |
@shikokuchuo see #4534 (comment) for how to use pkgload to auto generate a |
Thanks @kevinushey and @DavisVaughan! It worked after I made a change to
|
This bites on Fedora too. To clarify - is setting |
Since this is coming up regularly I prioritised this to the December release. |
Great. Currently without the manual intervention on linux, quite a few packages could be broken (i.e https://github.com/search?q=org%3Acran+%22R.home%28%5C%22share%5C%22%29%22&type=code). The one I've just seen is R> spell_check()
DESCRIPTION does not contain 'Language' field. Defaulting to 'en-US'.
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
In file(con, "r") :
cannot open file '/usr/lib64/R/share/Rd/macros/system.Rd': No such file or directory
Error in `file()`:
! cannot open the connection
Show Traceback |
## Positron Notes ### Release Notes #### New Features - The variable pane now supports labels from the {haven} package (#5327. - The variable pane has improved support for formulas (#4119). #### Bug Fixes - Assignments in function calls (e.g. `list(x <- 1)`) are now detected by the missing symbol linter to avoid annoying false positive diagnostics (#3048). The downside is that this causes false negatives when the assignment happens in a call with local scope, e.g. in `local()` or `test_that()`. In these cases the nested assignments will incorrectly overlast the end of the call. We prefer to be overly permissive than overly cautious in these matters. - The following environment variables are now set in the same way that R does: - `R_SHARE_DIR` - `R_INCLUDE_DIR` - `R_DOC_DIR` This solves a number of problems in situations that depend on these variables being defined (#3637).
### Release Notes #### New Features - The variable pane now supports labels from the {haven} package (#5327. - The variable pane has improved support for formulas (#4119). #### Bug Fixes - Assignments in function calls (e.g. `list(x <- 1)`) are now detected by the missing symbol linter to avoid annoying false positive diagnostics (#3048). The downside is that this causes false negatives when the assignment happens in a call with local scope, e.g. in `local()` or `test_that()`. In these cases the nested assignments will incorrectly overlast the end of the call. We prefer to be overly permissive than overly cautious in these matters. - The following environment variables are now set in the same way that R does: - `R_SHARE_DIR` - `R_INCLUDE_DIR` - `R_DOC_DIR` This solves a number of problems in situations that depend on these variables being defined (#3637). <!-- Thank you for submitting a pull request. If this is your first pull request you can find information about contributing here: * https://github.com/posit-dev/positron/blob/main/CONTRIBUTING.md We recommend synchronizing your branch with the latest changes in the main branch by either pulling or rebasing. --> <!-- Describe briefly what problem this pull request resolves, or what new feature it introduces. Include screenshots of any new or altered UI. Link to any GitHub issues but avoid "magic" keywords that will automatically close the issue. If there are any details about your approach that are unintuitive or you want to draw attention to, please describe them here. -->
Verified Fixed
Test scenario(s)
passes Link(s) to TestRail test cases run or created: |
These are set by the R launcher shell script but not by ark, resulting in a different environment. RStudio sets them too.
One consequence is that running
make -f $R_HOME/etc/Makeconf
from inside Ark results in an error because these variables expand to""
.The text was updated successfully, but these errors were encountered: