简体   繁体   English

安装 R 包 httpuv 时遇到问题

[英]Having trouble installing R package httpuv

I am using R 3.3.3 on Debian/Linux 8 and I am having trouble installing the package httpuv, which is a dependency for another package I want to use.我在 Debian/Linux 8 上使用 R 3.3.3,安装包 httpuv 时遇到问题,它是我要使用的另一个包的依赖项。 The installing error message is shown below.安装错误消息如下所示。 It seems like there are problems with libuv, but I am not sure about this. libuv似乎有问题,但我不确定。

How can I figure out where the problem is and how to fix it?我怎样才能找出问题出在哪里以及如何解决它?

> install.packages("httpuv")
Installing package into ‘/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.cnr.berkeley.edu/src/contrib/httpuv_1.5.1.tar.gz'
Content type 'unknown' length 1758514 bytes (1.7 MB)
==================================================
downloaded 1.7 MB

* installing *source* package ‘httpuv’ ...
** package ‘httpuv’ successfully unpacked and MD5 sums checked
** libs
g++ -std=c++11 -I/usr/share/R/include -DNDEBUG -Ilibuv/include -pthread  -I"/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/Rcpp/include" -I"/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/BH/include" -I"/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/later/include"   -DSTRICT_R_HEADERS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports-legacy.cpp -o RcppExports-legacy.o
g++ -std=c++11 -I/usr/share/R/include -DNDEBUG -Ilibuv/include -pthread  -I"/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/Rcpp/include" -I"/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/BH/include" -I"/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/later/include"   -DSTRICT_R_HEADERS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
g++ -std=c++11 -I/usr/share/R/include -DNDEBUG -Ilibuv/include -pthread  -I"/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/Rcpp/include" -I"/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/BH/include" -I"/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/later/include"   -DSTRICT_R_HEADERS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c callback.cpp -o callback.o
g++ -std=c++11 -I/usr/share/R/include -DNDEBUG -Ilibuv/include -pthread  -I"/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/Rcpp/include" -I"/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/BH/include" -I"/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/later/include"   -DSTRICT_R_HEADERS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c callbackqueue.cpp -o callbackqueue.o
In file included from libuv/include/uv.h:62:0,
                 from thread.h:4,
                 from tqueue.h:7,
                 from callbackqueue.h:4,
                 from callbackqueue.cpp:1:
libuv/include/uv/unix.h:103:28: error: ‘sem_t’ does not name a type
 # define UV_PLATFORM_SEM_T sem_t
                            ^
libuv/include/uv/unix.h:135:9: note: in expansion of macro ‘UV_PLATFORM_SEM_T’
 typedef UV_PLATFORM_SEM_T uv_sem_t;
         ^
In file included from thread.h:4:0,
                 from tqueue.h:7,
                 from callbackqueue.h:4,
                 from callbackqueue.cpp:1:
libuv/include/uv.h:1562:27: error: ‘uv_sem_t’ was not declared in this scope
 UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value);
                           ^
libuv/include/uv.h:1562:37: error: ‘sem’ was not declared in this scope
 UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value);
                                     ^
libuv/include/uv.h:1562:42: error: expected primary-expression before ‘unsigned’
 UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value);
                                          ^
libuv/include/uv.h:1562:60: error: expression list treated as compound expression in initializer [-fpermissive]
 UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value);
                                                            ^
libuv/include/uv.h:1563:31: error: variable or field ‘uv_sem_destroy’ declared void
 UV_EXTERN void uv_sem_destroy(uv_sem_t* sem);
                               ^
libuv/include/uv.h:1563:31: error: ‘uv_sem_t’ was not declared in this scope
libuv/include/uv.h:1563:41: error: ‘sem’ was not declared in this scope
 UV_EXTERN void uv_sem_destroy(uv_sem_t* sem);
                                         ^
libuv/include/uv.h:1564:28: error: variable or field ‘uv_sem_post’ declared void
 UV_EXTERN void uv_sem_post(uv_sem_t* sem);
                            ^
libuv/include/uv.h:1564:28: error: ‘uv_sem_t’ was not declared in this scope
libuv/include/uv.h:1564:38: error: ‘sem’ was not declared in this scope
 UV_EXTERN void uv_sem_post(uv_sem_t* sem);
                                      ^
libuv/include/uv.h:1565:28: error: variable or field ‘uv_sem_wait’ declared void
 UV_EXTERN void uv_sem_wait(uv_sem_t* sem);
                            ^
libuv/include/uv.h:1565:28: error: ‘uv_sem_t’ was not declared in this scope
libuv/include/uv.h:1565:38: error: ‘sem’ was not declared in this scope
 UV_EXTERN void uv_sem_wait(uv_sem_t* sem);
                                      ^
libuv/include/uv.h:1566:30: error: ‘uv_sem_t’ was not declared in this scope
 UV_EXTERN int uv_sem_trywait(uv_sem_t* sem);
                              ^
libuv/include/uv.h:1566:40: error: ‘sem’ was not declared in this scope
 UV_EXTERN int uv_sem_trywait(uv_sem_t* sem);
                                        ^
/usr/lib/R/etc/Makeconf:141: recipe for target 'callbackqueue.o' failed
make: *** [callbackqueue.o] Error 1
ERROR: compilation failed for package ‘httpuv’
* removing ‘/data/home/yh362/R/x86_64-pc-linux-gnu-library/3.3/httpuv’

The downloaded source packages are in
        ‘/tmp/Rtmpqg62zZ/downloaded_packages’
Warning message:
In install.packages("httpuv") :
  installation of package ‘httpuv’ had non-zero exit status

I had the same error and tried several installations to make it work:我遇到了同样的错误并尝试了几次安装以使其正常工作:

  1. Install Java jre and jdk安装 Java jre 和 jdk
  2. Install devtools install.packages("devtools")安装devtools install.packages("devtools")
  3. In the console, run .libPaths() to see where packages are installed.在控制台中,运行.libPaths()以查看软件包的安装位置。
  4. Make sure to get full permission from your library directory确保从您的库目录获得完全许可
  5. Run devtools::install_github("rstudio/httpuv", lib = "directory from 3.") in the console.在控制台中运行devtools::install_github("rstudio/httpuv", lib = "directory from 3.")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM