2017-10-15 524 views
0

我安裝了R並試圖安裝附加包:rgl。問題是,我不斷收到此錯誤:在Linux上安裝R包

installation of package ‘rgl’ had non-zero exit status 

這裏是警告的完整列表:

> warnings() 
Warning messages: 
1: In install.packages("rgl") : 
installation of package ‘stringi’ had non-zero exit status 
2: In install.packages("rgl") : 
installation of package ‘yaml’ had non-zero exit status 
3: In install.packages("rgl") : 
installation of package ‘digest’ had non-zero exit status 
4: In install.packages("rgl") : 
installation of package ‘httpuv’ had non-zero exit status 
5: In install.packages("rgl") : 
installation of package ‘mime’ had non-zero exit status 
6: In install.packages("rgl") : 
installation of package ‘sourcetools’ had non-zero exit status 
7: In install.packages("rgl") : 
installation of package ‘jsonlite’ had non-zero exit status 
8: In install.packages("rgl") : 
installation of package ‘markdown’ had non-zero exit status 
9: In install.packages("rgl") : 
installation of package ‘stringr’ had non-zero exit status 
10: In install.packages("rgl") : 
installation of package ‘htmltools’ had non-zero exit status 
11: In install.packages("rgl") : 
installation of package ‘evaluate’ had non-zero exit status 
12: In install.packages("rgl") : 
installation of package ‘htmlwidgets’ had non-zero exit status 
13: In install.packages("rgl") : 
installation of package ‘shiny’ had non-zero exit status 
14: In install.packages("rgl") : 
installation of package ‘knitr’ had non-zero exit status 
15: In install.packages("rgl") : 
installation of package ‘rgl’ had non-zero exit status 

而且完全安裝日誌:

> install.packages("rgl") 
Installing package into ‘/usr/local/lib/R/site-library’ 
(as ‘lib’ is unspecified) 
--- Please select a CRAN mirror for use in this session --- 
also installing the dependencies ‘stringi’, ‘yaml’, ‘digest’, ‘evaluate’, ‘markdown’, ‘stringr’, ‘httpuv’, ‘mime’, ‘sourcetools’, ‘htmlwidgets’, ‘htmltools’, ‘knitr’, ‘jsonlite’, ‘shiny’ 

trying URL 'https://cloud.r-project.org/src/contrib/stringi_1.1.5.tar.gz' 
Content type 'application/x-gzip' length 3645872 bytes (3.5 MB) 
================================================== 
downloaded 3.5 MB 

trying URL 'https://cloud.r-project.org/src/contrib/yaml_2.1.14.tar.gz' 
Content type 'application/x-gzip' length 81095 bytes (79 KB) 
================================================== 
downloaded 79 KB 

trying URL 'https://cloud.r-project.org/src/contrib/digest_0.6.12.tar.gz' 
Content type 'application/x-gzip' length 120337 bytes (117 KB) 
================================================== 
downloaded 117 KB 

trying URL 'https://cloud.r-project.org/src/contrib/evaluate_0.10.1.tar.gz' 
Content type 'application/x-gzip' length 22177 bytes (21 KB) 
================================================== 
downloaded 21 KB 

trying URL 'https://cloud.r-project.org/src/contrib/markdown_0.8.tar.gz' 
Content type 'application/x-gzip' length 80583 bytes (78 KB) 
================================================== 
downloaded 78 KB 

trying URL 'https://cloud.r-project.org/src/contrib/stringr_1.2.0.tar.gz' 
Content type 'application/x-gzip' length 94095 bytes (91 KB) 
================================================== 
downloaded 91 KB 

trying URL 'https://cloud.r-project.org/src/contrib/httpuv_1.3.5.tar.gz' 
Content type 'application/x-gzip' length 427638 bytes (417 KB) 
================================================== 
downloaded 417 KB 

trying URL 'https://cloud.r-project.org/src/contrib/mime_0.5.tar.gz' 
Content type 'application/x-gzip' length 12634 bytes (12 KB) 
================================================== 
downloaded 12 KB 

trying URL 'https://cloud.r-project.org/src/contrib/sourcetools_0.1.6.tar.gz' 
Content type 'application/x-gzip' length 24092 bytes (23 KB) 
================================================== 
downloaded 23 KB 

trying URL 'https://cloud.r-project.org/src/contrib/htmlwidgets_0.9.tar.gz' 
Content type 'application/x-gzip' length 944851 bytes (922 KB) 
================================================== 
downloaded 922 KB 

trying URL 'https://cloud.r-project.org/src/contrib/htmltools_0.3.6.tar.gz' 
Content type 'application/x-gzip' length 45408 bytes (44 KB) 
================================================== 
downloaded 44 KB 

trying URL 'https://cloud.r-project.org/src/contrib/knitr_1.17.tar.gz' 
Content type 'application/x-gzip' length 769923 bytes (751 KB) 
================================================== 
downloaded 751 KB 

trying URL 'https://cloud.r-project.org/src/contrib/jsonlite_1.5.tar.gz' 
Content type 'application/x-gzip' length 1096810 bytes (1.0 MB) 
================================================== 
downloaded 1.0 MB 

trying URL 'https://cloud.r-project.org/src/contrib/shiny_1.0.5.tar.gz' 
Content type 'application/x-gzip' length 2330710 bytes (2.2 MB) 
================================================== 
downloaded 2.2 MB 

trying URL 'https://cloud.r-project.org/src/contrib/rgl_0.98.1.tar.gz' 
Content type 'application/x-gzip' length 2624282 bytes (2.5 MB) 
================================================== 
downloaded 2.5 MB 

* installing *source* package ‘stringi’ ... 
** package ‘stringi’ successfully unpacked and MD5 sums checked 
checking for local ICUDT_DIR... icu55/data 
checking for R_HOME... /usr/lib/R 
checking for R... /usr/lib/R/bin/R 
checking for R >= 3.1.0 for C++11 use... yes 
checking for R < 3.4.0 for CXX1X flag use... no 
checking for cat... /bin/cat 
checking for gcc... gcc -std=gnu99 
checking whether the C compiler works... no 
configure: error: in `/tmp/RtmpSv852d/R.INSTALL521c32e70e07/stringi': 
configure: error: C compiler cannot create executables 
See `config.log' for more details 
ERROR: configuration failed for package ‘stringi’ 
* removing ‘/usr/local/lib/R/site-library/stringi’ 
* installing *source* package ‘yaml’ ... 
** package ‘yaml’ successfully unpacked and MD5 sums checked 
** libs 
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -DNDEBUG  -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c api.c -o api.o 
gcc: error: unrecognized command line option ‘-fstack-protector-strong’ 
gcc: error: unrecognized command line option ‘-Wdate-time’ 
/usr/lib/R/etc/Makeconf:159: recipe for target 'api.o' failed 
make: *** [api.o] Error 1 
ERROR: compilation failed for package ‘yaml’ 
* removing ‘/usr/local/lib/R/site-library/yaml’ 
* 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:159: recipe for target 'aes.o' failed 
make: *** [aes.o] Error 1 
ERROR: compilation failed for package ‘digest’ 
* removing ‘/usr/local/lib/R/site-library/digest’ 
* installing *source* package ‘httpuv’ ... 
** package ‘httpuv’ successfully unpacked and MD5 sums checked 
** libs 
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o 
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c filedatasource-unix.cpp -o filedatasource-unix.o 
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c filedatasource-win.cpp -o filedatasource-win.o 
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c http.cpp -o http.o 
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c httpuv.cpp -o httpuv.o 
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c md5.c -o md5.o 
gcc: error: unrecognized command line option ‘-fstack-protector-strong’ 
gcc: error: unrecognized command line option ‘-Wdate-time’ 
/usr/lib/R/etc/Makeconf:159: recipe for target 'md5.o' failed 
make: *** [md5.o] Error 1 
ERROR: compilation failed for package ‘httpuv’ 
* removing ‘/usr/local/lib/R/site-library/httpuv’ 
* 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:159: recipe for target 'rawmatch.o' failed 
make: *** [rawmatch.o] Error 1 
ERROR: compilation failed for package ‘mime’ 
* removing ‘/usr/local/lib/R/site-library/mime’ 
* installing *source* package ‘sourcetools’ ... 
** package ‘sourcetools’ successfully unpacked and MD5 sums checked 
** libs 
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include  -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Reader.cpp -o Reader.o 
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include  -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Tokenizer.cpp -o Tokenizer.o 
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I../inst/include  -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c sourcetools-init.c -o sourcetools-init.o 
gcc: error: unrecognized command line option ‘-fstack-protector-strong’ 
gcc: error: unrecognized command line option ‘-Wdate-time’ 
/usr/lib/R/etc/Makeconf:159: recipe for target 'sourcetools-init.o' failed 
make: *** [sourcetools-init.o] Error 1 
ERROR: compilation failed for package ‘sourcetools’ 
* removing ‘/usr/local/lib/R/site-library/sourcetools’ 
* 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:159: recipe for target 'base64.o' failed 
make: *** [base64.o] Error 1 
ERROR: compilation failed for package ‘jsonlite’ 
* removing ‘/usr/local/lib/R/site-library/jsonlite’ 
ERROR: dependency ‘mime’ is not available for package ‘markdown’ 
* removing ‘/usr/local/lib/R/site-library/markdown’ 
ERROR: dependency ‘stringi’ is not available for package ‘stringr’ 
* removing ‘/usr/local/lib/R/site-library/stringr’ 
ERROR: dependency ‘digest’ is not available for package ‘htmltools’ 
* removing ‘/usr/local/lib/R/site-library/htmltools’ 
ERROR: dependency ‘stringr’ is not available for package ‘evaluate’ 
* removing ‘/usr/local/lib/R/site-library/evaluate’ 
ERROR: dependencies ‘htmltools’, ‘jsonlite’, ‘yaml’ are not available for package ‘htmlwidgets’ 
* removing ‘/usr/local/lib/R/site-library/htmlwidgets’ 
ERROR: dependencies ‘httpuv’, ‘mime’, ‘jsonlite’, ‘digest’, ‘htmltools’, ‘sourcetools’ are not available for package ‘shiny’ 
* removing ‘/usr/local/lib/R/site-library/shiny’ 
ERROR: dependencies ‘evaluate’, ‘digest’, ‘markdown’, ‘stringr’, ‘yaml’ are not available for package ‘knitr’ 
* removing ‘/usr/local/lib/R/site-library/knitr’ 
ERROR: dependencies ‘htmlwidgets’, ‘htmltools’, ‘knitr’, ‘jsonlite’, ‘shiny’ are not available for package ‘rgl’ 
* removing ‘/usr/local/lib/R/site-library/rgl’ 

The downloaded source packages are in 
    ‘/tmp/Rtmpa3Hizf/downloaded_packages’ 
There were 15 warnings (use warnings() to see them) 

,完全R版本信息:

> version 
      _       
platform  x86_64-pc-linux-gnu   
arch   x86_64      
os    linux-gnu     
system   x86_64, linux-gnu   
status          
major   3       
minor   4.2       
year   2017       
month   09       
day   28       
svn rev  73368      
language  R       
version.string R version 3.4.2 (2017-09-28) 
nickname  Short Summer 

我使用Linux Mint 1 8.2。我知道有關於該錯誤消息的更多問題,但我沒有找到任何工作解決方案。這基本上是全新的安裝,我沒有更改任何配置文件,並嘗試安裝此軟件包並且沒有root權限。有誰知道什麼會導致這種情況?

+0

考慮'sudo apt-get install r-cran-rgl'。 –

+0

@DirkEddelbuettel我已經安裝了它,它仍然無法正常工作。 –

+1

否則,您的R二進制文件與您的系統斷開連接。它想要使用編譯器選項(它認爲它是用其構建的),哪些不起作用。這通常不會發生在正確的安裝上。您可能安裝了Debian或Ubuntu二進制文件。 「這一切都適用於Debian和Ubuntu」,我不知道Mint。抱歉。 –

回答

0

我修復了這個錯誤,感謝來自r-sig-debian郵件列表的Harutyun Khachatryan。
該溶液是在這裏:https://askubuntu.com/questions/26498/choose-gcc-and-g-version

唯一的區別是,我用gcc和g ++ 4.8版本和4.9(而不是4.3和4.4)。

我用來解決這個問題的所有命令:

sudo update-alternatives --remove-all gcc 
sudo update-alternatives --remove-all g++ 
sudo apt-get install gcc-4.3 gcc-4.4 g++-4.3 g++-4.4 
sudo apt-get install gcc-4.8 gcc-4.8 g++-4.9 g++-4.9 
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10 
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20 
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10 
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20 
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 
sudo update-alternatives --set cc /usr/bin/gcc 
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 
sudo update-alternatives --set c++ /usr/bin/g++ 
sudo update-alternatives --config gcc 
sudo update-alternatives --config g++ 

現在R中的軟件包編譯成功。