我正在尝试按以下方式安装R包profvis
:
with_envvar(c(LDFLAGS = "-L/usr/local/opt/readline/lib",
CPPFLAGS= "-I/usr/local/opt/readline/include"),
devtools::install_github("rstudio/profvis"))
但是,我收到的错误消息是:
...
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -DPLATFORM_PKGTYPE='"mac.binary.mavericks"' -fPIC -Wall -mtune=core2 -g -O2 -c pause.c -o pause.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/X11/lib -L/usr/local/lib /usr/local/lib/libcairo.a /usr/local/lib/libpixman-1.a /usr/local/lib/libfreetype.a /usr/local/lib/libfontconfig.a -lxml2 /usr/local/lib/libreadline.a -o profvis.so pause.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
clang: error: no such file or directory: '/usr/local/lib/libreadline.a'
make: *** [profvis.so] Error 1
ERROR: compilation failed for package ‘profvis’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/profvis’
Error: Command failed (1)
图书馆的位置在这里:
$ ls /usr/local/opt/readline/lib/libreadline.a
/usr/local/opt/readline/lib/libreadline.a
请注意,我没有选择符号链接到/usr/local
$ brew info readline
readline: stable 6.3.8 (bottled) [keg-only]
Library for command-line editing
https://tiswww.case.edu/php/chet/readline/rltop.html
/usr/local/Cellar/readline/6.3.8 (40 files, 2.1M)
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/readline.rb
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
这是因为我输入brew link readline
时收到的警告:
Warning: readline is keg-only and must be linked with --force
Note that doing so can interfere with building software.
我应该使用--force
选项符号链接,还是有更好的方法?
答案 0 :(得分:3)
尝试在Mac OS X 10.11.4 Beta(15E33e),Microsoft R Open 3.2.3和RStudio 0.99.491上安装来自github的hadley/lineprof
时遇到类似问题。
我决定在安装时强制使用符号链接,然后删除它们。 首先,我创建了符号链接:
$ brew link --force readline
然后在R中我安装了lineprof:
> devtools::install_github("hadley/lineprof")
成功安装lineprof后,我删除了符号链接:
$ brew unlink readline
我还必须在链接后重启RStudio,但我不知道为什么这很重要。