簡體   English   中英

在 Ubuntu 16.04 (Xenial) 上安裝 R 包“devtools”時出現問題

[英]Problems installing R package "devtools" on Ubuntu 16.04 (Xenial)

我在 Ubuntu 16.04 (Xenial) Linux 上安裝了 RStudio 和 R:

user@machine:~/.Rlibs$ R --version
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

我的問題是我無法安裝包“devtools”。 我收到了一系列錯誤,到目前為止我安裝所需依賴項的所有嘗試都失敗了。 即使安裝了軟件包,似乎也找不到軟件包。

我真的很感激任何幫助!

嘗試在 RStudio 中安裝“devtools”包或使用 R 控制台時會發生錯誤:

install.packages("devtools")

這些是我得到的錯誤(不包括下載輸出):

* installing *source* package ‘mime’ ...
** package ‘mime’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c rawmatch.c -o rawmatch.o
gcc: error: unrecognized command line option ‘-fstack-protector-strong’
gcc: error: unrecognized command line option ‘-Wdate-time’
/usr/lib/R/etc/Makeconf:132: recipe for target 'rawmatch.o' failed
make: *** [rawmatch.o] Error 1
ERROR: compilation failed for package ‘mime’
* removing ‘/home/user/.Rlibs/mime’
Warning in install.packages :
  installation of package ‘mime’ had non-zero exit status
* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
 * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
 * rpm: libcurl-devel (Fedora, CentOS, RHEL)
 * csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘curl’
* removing ‘/home/user/.Rlibs/curl’
Warning in install.packages :
  installation of package ‘curl’ had non-zero exit status
* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-lssl -lcrypto
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because openssl was not found. Try installing:
 * deb: libssl-dev (Debian, Ubuntu, etc)
 * rpm: openssl-devel (Fedora, CentOS, RHEL)
 * csw: libssl_dev (Solaris)
 * brew: openssl (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘openssl’
* removing ‘/home/user/.Rlibs/openssl’
Warning in install.packages :
  installation of package ‘openssl’ had non-zero exit status
* installing *source* package ‘digest’ ...
** package ‘digest’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c aes.c -o aes.o
gcc: error: unrecognized command line option ‘-fstack-protector-strong’
gcc: error: unrecognized command line option ‘-Wdate-time’
/usr/lib/R/etc/Makeconf:132: recipe for target 'aes.o' failed
make: *** [aes.o] Error 1
ERROR: compilation failed for package ‘digest’
* removing ‘/home/user/.Rlibs/digest’
Warning in install.packages :
  installation of package ‘digest’ had non-zero exit status
* installing *source* package ‘jsonlite’ ...
** package ‘jsonlite’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c base64.c -o base64.o
gcc: error: unrecognized command line option ‘-fstack-protector-strong’
gcc: error: unrecognized command line option ‘-Wdate-time’
/usr/lib/R/etc/Makeconf:132: recipe for target 'base64.o' failed
make: *** [base64.o] Error 1
ERROR: compilation failed for package ‘jsonlite’
* removing ‘/home/user/.Rlibs/jsonlite’
Warning in install.packages :
  installation of package ‘jsonlite’ had non-zero exit status
* installing *source* package ‘git2r’ ...
** package ‘git2r’ successfully unpacked and MD5 sums checked
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for library containing inflate... no
configure: error: in `/tmp/RtmpMyvGHt/R.INSTALL4c4a1e9555fc/git2r':
configure: error: 
  ---------------------------------------------
   The zlib library that is required to build
   git2r was not found.

   Please install:
     zlib1g-dev (package on e.g. Debian and Ubuntu)
     zlib-devel (package on e.g. Fedora, CentOS and RHEL)
   and try again.

   If the zlib library is installed on your
   system but the git2r configuration is
   unable to find it, you can specify the
   include and lib path to zlib with:
   R CMD INSTALL --configure-args='--with-zlib-include=INCLUDE_PATH --with-zlib-lib=LIB_PATH' git2r
  ---------------------------------------------
See `config.log' for more details
ERROR: configuration failed for package ‘git2r’
* removing ‘/home/user/.Rlibs/git2r’
Warning in install.packages :
  installation of package ‘git2r’ had non-zero exit status
ERROR: dependencies ‘jsonlite’, ‘mime’, ‘curl’, ‘openssl’ are not available for package ‘httr’
* removing ‘/home/user/.Rlibs/httr’
Warning in install.packages :
  installation of package ‘httr’ had non-zero exit status
ERROR: dependency ‘digest’ is not available for package ‘memoise’
* removing ‘/home/user/.Rlibs/memoise’
Warning in install.packages :
  installation of package ‘memoise’ had non-zero exit status
ERROR: dependencies ‘httr’, ‘memoise’, ‘digest’, ‘jsonlite’, ‘git2r’ are not available for package ‘devtools’
* removing ‘/home/user/.Rlibs/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

我注意到以下錯誤:

gcc: error: unrecognized command line option ‘-fstack-protector-strong’
gcc: error: unrecognized command line option ‘-Wdate-time’

當我想使用過時版本的 gcc(特別是 4.8)來解決我的一個項目中的一些兼容性問題時,我遇到了同樣的問題。 編譯器標志“-Wdate-time”“-fstack-protector-strong”在較舊的 gcc 版本中不可用。 不過,在一些較舊的 gcc 版本中可以使用類似的標志“-fstack-protector-all”。

總而言之,此錯誤消息是由於開發人員期望使用最新的 gcc 並使用該最新 gcc 版本的編譯器標志,但您系統中安裝的 gcc 已過時。

希望對將來可能遇到此問題的其他人有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM