EDIT: see edit in end.
I have a R package in github and I'm using devtools::install_github
to install it, which also install dependency packages.
Recently this process will install httpuv
as source package, but compiling it in Mac meet errors with automake
(something like this). I installed automake
, then there was error with clang: error: unsupported option '-fopenmp'
.
The issue and the possible solutions 1 2 seemed to be quite complicated. I think the CRAN version of httpuv
probably will work for me, and I don't want my users to go through so many errors and fixing compiler errors.
I'd like to just install all dependency packages from CRAN in binary. For some packages that do need the more up to date version, I have specified it in my package description with remote
section.
I checked install_github
, then install
, then install.packages
. It seemed that the default behavior for binary vs source package is
An alternative (and the current default) is "both" which means ‘use binary if available and current, otherwise try source’. The action if there are source packages which are preferred but may contain code which needs to be compiled is controlled by getOption("install.packages.compile.from.source").
My getOption("install.packages.compile.from.source")
is interactive
. This is actually a preferred behavior for me. However I never see the interactive prompt.
I tried to give a type = "binary"
parameter in install_github
, but it doesn't seem to work, maybe it's not passed to every dependency package install?
EDIT:
I found the situation is a little bit more complex:
- my app specified to install
shiny
github version viaremote
in description.shiny
specified to installhttpuv
github version inremote
section too. So this is actually the intended behavior. - I'm not sure if there is a solution available, other than require CRAN version of
shiny
in my package.
EDIT 2: It's more complex than my previous findings.
- I removed
remote
section in my package description, supposedly only CRAN version is needed. Howeverinstall_github
still install most dependencies from github. - I finally found out that I have these dependencies github version installed, so their description in my local disk have the github remote information, and
install_github
found this information and "upgrade" them again, even when some of them have no change. - So I need to uninstall them first, only use CRAN version.
The really problem here is that if a dependency package is already new, it should not be installed. It could be a bug of devtools.