Yilei Huang
Yilei Huang

Reputation: 117

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. The installing error message is shown below. It seems like there are problems with libuv, but I am not sure about this.

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

Upvotes: 4

Views: 5132

Answers (2)

Bioinfotec
Bioinfotec

Reputation: 93

I encounter the same issue. As you can see the error report:

    libuv/include/uv/unix.h:103:28: error: ‘sem_t’ does not name a type
    define UV_PLATFORM_SEM_T sem_t

After removing the semaphore.h in /usr/local/include, everything works.

You can see details in https://github.com/rstudio/httpuv/issues/110#issuecomment-371690583

Upvotes: 0

Logamou Seknewna Lema
Logamou Seknewna Lema

Reputation: 59

I had the same error and tried several installations to make it work:

  1. Install Java jre and jdk
  2. Install devtools install.packages("devtools")
  3. In the console, run .libPaths() to see where packages are installed.
  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.

Upvotes: 1

Related Questions