Giter VIP home page Giter VIP logo

httpuv's Issues

Segfault on successful retry of server creation

  1. Launch two R processes
  2. Run runServer('0.0.0.0', 8100, list()) in process A
  3. Run runServer('0.0.0.0', 8100, list()) in process B (this will fail)
  4. Stop the server in process A
  5. Run runServer('0.0.0.0', 8100, list()) in process B

Expected: Success

Actual: Segfault

Build fails local g++ library not linked

Problem building httpuv

Seems to be breaking when trying compile httpuv, RcppExports etc.
Rcpp is installed without error.

Tried Make within the http-parser folder in src, no problems encountered.

(cd base64 && g++ -I/export2/home/uesu/local/bin/lib64/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/include -I"/export2/home/uesu/local/bin/lib64/R/library/Rcpp/include" -I/export2/home/uesu/local/bin/lib64/R/library/Rcpp/include -fpic -g -O2 -c base64.cpp -o base64.o)
g++ -shared -L/usr/local/lib64 -o httpuv.so RcppExports.o filedatasource-unix.o filedatasource-win.o http.o httpuv.o md5.o set_invalid_parameter.o uvutil.o websockets-base.o websockets-hixie76.o websockets-hybi03.o websockets-ietf.o websockets.o ./libuv/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o
./http-parser/http_parser.o: In function __strcspn_c1': /usr/include/bits/string2.h:974: multiple definition of__strcspn_c1'
md5.o:/usr/include/bits/string2.h:974: first defined here
./http-parser/http_parser.o: In function __strcspn_c2': /usr/include/bits/string2.h:985: multiple definition of__strcspn_c2'
md5.o:/usr/include/bits/string2.h:985: first defined here
./http-parser/http_parser.o: In function __strcspn_c3': /usr/include/bits/string2.h:998: multiple definition of__strcspn_c3'
md5.o:/usr/include/bits/string2.h:998: first defined here
./http-parser/http_parser.o: In function __strspn_c1': /usr/include/bits/string2.h:1051: multiple definition of__strspn_c1'
md5.o:/usr/include/bits/string2.h:1051: first defined here
./http-parser/http_parser.o: In function __strspn_c2': /usr/include/bits/string2.h:1060: multiple definition of__strspn_c2'
md5.o:/usr/include/bits/string2.h:1060: first defined here
./http-parser/http_parser.o: In function __strspn_c3': /usr/include/bits/string2.h:1072: multiple definition of__strspn_c3'
md5.o:/usr/include/bits/string2.h:1072: first defined here
./http-parser/http_parser.o: In function __strpbrk_c2': /usr/include/bits/string2.h:1125: multiple definition of__strpbrk_c2'
md5.o:/usr/include/bits/string2.h:1125: first defined here
./http-parser/http_parser.o: In function __strpbrk_c3': /usr/include/bits/string2.h:1137: multiple definition of__strpbrk_c3'
md5.o:/usr/include/bits/string2.h:1137: first defined here
./http-parser/http_parser.o: In function __strtok_r_1c': /usr/include/bits/string2.h:1178: multiple definition of__strtok_r_1c'
md5.o:/usr/include/bits/string2.h:1178: first defined here
./http-parser/http_parser.o: In function __strsep_2c': /usr/include/bits/string2.h:1237: multiple definition of__strsep_2c'
md5.o:/usr/include/bits/string2.h:1237: first defined here
./http-parser/http_parser.o: In function __strsep_3c': /usr/include/bits/string2.h:1265: multiple definition of__strsep_3c'
md5.o:/usr/include/bits/string2.h:1265: first defined here
./http-parser/http_parser.o: In function __strsep_1c': /usr/include/bits/string2.h:1226: multiple definition of__strsep_1c'
md5.o:/usr/include/bits/string2.h:1226: first defined here
./sha1/sha1.o: In function __strcspn_c1': /usr/include/bits/string2.h:974: multiple definition of__strcspn_c1'
md5.o:/usr/include/bits/string2.h:974: first defined here
./sha1/sha1.o: In function __strcspn_c2': /usr/include/bits/string2.h:985: multiple definition of__strcspn_c2'
md5.o:/usr/include/bits/string2.h:985: first defined here
./sha1/sha1.o: In function __strcspn_c3': /usr/include/bits/string2.h:998: multiple definition of__strcspn_c3'
md5.o:/usr/include/bits/string2.h:998: first defined here
./sha1/sha1.o: In function __strspn_c1': /usr/include/bits/string2.h:1051: multiple definition of__strspn_c1'
md5.o:/usr/include/bits/string2.h:1051: first defined here
./sha1/sha1.o: In function __strspn_c2': /usr/include/bits/string2.h:1060: multiple definition of__strspn_c2'
md5.o:/usr/include/bits/string2.h:1060: first defined here
./sha1/sha1.o: In function __strspn_c3': /usr/include/bits/string2.h:1072: multiple definition of__strspn_c3'
md5.o:/usr/include/bits/string2.h:1072: first defined here
./sha1/sha1.o: In function __strpbrk_c2': /usr/include/bits/string2.h:1125: multiple definition of__strpbrk_c2'
md5.o:/usr/include/bits/string2.h:1125: first defined here
./sha1/sha1.o: In function __strpbrk_c3': /usr/include/bits/string2.h:1137: multiple definition of__strpbrk_c3'
md5.o:/usr/include/bits/string2.h:1137: first defined here
./sha1/sha1.o: In function __strtok_r_1c': /usr/include/bits/string2.h:1178: multiple definition of__strtok_r_1c'
md5.o:/usr/include/bits/string2.h:1178: first defined here
./sha1/sha1.o: In function __strsep_2c': /usr/include/bits/string2.h:1237: multiple definition of__strsep_2c'
md5.o:/usr/include/bits/string2.h:1237: first defined here

Installation fails on OpenBSD 5.9 with undefined kvm_* symbols errors

Here are error messages from my attempt to install.

/usr/local/lib/R/bin/exec/R:/usr/local/lib/R/library/httpuv/libs/httpuv.so: undefined symbol 'kvm_open'
/usr/local/lib/R/bin/exec/R:/usr/local/lib/R/library/httpuv/libs/httpuv.so: undefined symbol 'kvm_close'
/usr/local/lib/R/bin/exec/R:/usr/local/lib/R/library/httpuv/libs/httpuv.so: undefined symbol 'kvm_getprocs'
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object '/usr/local/lib/R/library/httpuv/libs/httpuv.so':
  Cannot load specified object
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/library/httpuv’

They occurred both in the present CRAN version and in the current HEAD of master, commit 6aeca57 on OpenBSD 5.9.

> uname -a
OpenBSD blautkraut 5.9 GENERIC.MP#1888 amd64

I think I have the right header file, but I don't really know anything about C++. The other included files are in the same directory, so I think the paths are set up correctly.

> grep kvm_ /usr/include/kvm.h
 * Flag for kvm_open* that disables opening of any files. We're just
typedef struct __kvm kvm_t;
int       kvm_close(kvm_t *);
int       kvm_dump_inval(kvm_t *);
int       kvm_dump_mkheader(kvm_t *, off_t);
int       kvm_dump_wrtheader(kvm_t *, FILE *, int);
char    **kvm_getargv(kvm_t *, const struct kinfo_proc *, int);
char    **kvm_getenvv(kvm_t *, const struct kinfo_proc *, int);
char     *kvm_geterr(kvm_t *);
int       kvm_getloadavg(kvm_t *, double [], int);
          kvm_getfiles(kvm_t *, int, int, size_t, int *);
          kvm_getprocs(kvm_t *, int, int, size_t, int *);
int       kvm_nlist(kvm_t *, struct nlist *);
kvm_t    *kvm_open(const char *, const char *, const char *, int, const char *);
kvm_t    *kvm_openfiles(const char *, const char *, const char *,
ssize_t   kvm_read(kvm_t *, unsigned long, void *, size_t)
ssize_t   kvm_write(kvm_t *, unsigned long, const void *, size_t)

Build fails

I just wanted to share that the installation of my package install.packages('httpuv') fails because of a build fail.
I noticed when looking more closely at the error that g++ was taking as arguments some of my header when reloading the R session.

I solved the problem by calling from the terminal
blabla:~$ R --no-init-file
And call install.packages() from within.

I cannot disguise my amazement, and I guess it may help anybody having some similar issue!?

httpuv.so incorrectly relinquishing privileges

While building/packaging R-httpuv in the OpenSuSE Build service an rpmlint check of the resulting package indicates that httpuv.so may be incorrectly relinquishing groups when calling setuid and/or setgid. The code should be reviewed for this.

Documentation regarding the issue.
https://www.securecoding.cert.org/confluence/display/seccode/POS36-C.+Observe+correct+revocation+order+while+relinquishing+privileges

Build Log:
https://build.opensuse.org/package/live_build_log/devel:languages:R:CRAN-packages/R-httpuv/openSUSE_13.1/x86_64

rpmlint warning snippet from above build log:
[ 51s] R-httpuv.x86_64: W: missing-call-to-setgroups-before-setuid /usr/lib64/R/library/httpuv/libs/httpuv.so
[ 51s] This executable is calling setuid and setgid without setgroups or initgroups.
[ 51s] There is a high probability this mean it didn't relinquish all groups, and
[ 51s] this would be a potential security issue to be fixed. Seek POS36-C on the web
[ 51s] for details about the problem.

Build fails with certain locales

Hello,

the build for httpuv conistently failed for me with
g++: error: [1]: No such file or directory

Upon closer examination the file in question was my locale:

g++: error: "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C": No such file or directory

which I had set in .Rprofile with Sys.setlocale(category = "LC_ALL", locale = "en_US.UTF-8"). I've never had another package fail because of my locale, but the build worked after commenting out that line and restarting R.

Platform: Linux Mint Debian Edition with CRAN-Deb install of R, but most packages installed via install.packages()

httpuv installation error on RH6.8AS_64

Attempting to install httpuv version=1.3.3 using the command: install.packages("httpuv",contriburl="file:///tmp")

OS_REL=RH6.8AS_64
C_REL=4.4.7r17_64
CPLUS_REL=4.4.7r17_64

I have successfully installed several other packages and am only encountering an error with this one.

I have tried 2 versions of the gcc compiler (4.4.7r4 and 4.4.7r17)

Here are the errors and warnings I receive:

             from src/unix/async.c:25:

/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netinet/in.h:113: warning: comma at end of enumerator list

             from src/unix/async.c:25:

/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netinet/tcp.h:99: warning: type of bit-field âres1â is a GCC extension
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netinet/tcp.h:100: warning: type of bit-field âdoffâ is a GCC extension
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netinet/tcp.h:101: warning: type of bit-field âfinâ is a GCC extension
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netinet/tcp.h:102: warning: type of bit-field âsynâ is a GCC extension
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netinet/tcp.h:103: warning: type of bit-field ârstâ is a GCC extension
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netinet/tcp.h:104: warning: type of bit-field âpshâ is a GCC extension
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netinet/tcp.h:105: warning: type of bit-field âackâ is a GCC extension
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netinet/tcp.h:106: warning: type of bit-field âurgâ is a GCC extension
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netinet/tcp.h:107: warning: type of bit-field âres2â is a GCC extension
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netinet/tcp.h:196: warning: type of bit-field âtcpi_snd_wscaleâ is a GCC extension
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netinet/tcp.h:196: warning: type of bit-field âtcpi_rcv_wscaleâ is a GCC extension

             from src/unix/async.c:25:

/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/netdb.h:694: warning: ISO C90 does not support âstaticâ or type qualifiers in parameter array declarators

from src/unix/async.c:25:
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/bits/sigset.h:119:65: warning: invoking macro __SIGSETFN argument 3: empty macro arguments are undefined in ISO C90 and ISO C++98
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/bits/sigset.h:120:66: warning: invoking macro __SIGSETFN argument 3: empty macro arguments are undefined in ISO C90 and ISO C++98
In file included from src/unix/internal.h:28,
from src/unix/async.c:26:
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/stdlib.h:424: warning: ISO C90 does not support âlong longâ
In file included from src/unix/internal.h:28,
from src/unix/async.c:26:
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/stdlib.h:521: error: expected identifier or â(â before â/â token
In file included from src/unix/internal.h:28,
from src/unix/async.c:26:
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/stdlib.h:522:35: error: invalid suffix "x" on integer constant
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/stdlib.h:547: error: expected identifier or â(â before â/â token
/xenv/OS/ia64/RH6.8AS_64/x86_64/usr/include/stdlib.h:548:35: error: invalid suffix "x" on integer constant
ia64make[1]: *** [src/unix/async.o] Error 1
ia64make[1]: Leaving directory `/tmp/RtmpqFvysR/R.INSTALL11df58c6fcf1/httpuv/src/libuv'
ia64make: *** [libuv.a] Error 2
ERROR: compilation failed for package âhttpuvâ

  • removing â/usr/lib64/microsoft-r/3.4/lib64/R/library/httpuvâ
    Updating HTML index of packages in '.Library'
    Making 'packages.html' ... done
    Warning message:
    In install.packages("httpuv", contriburl = "file:///tmp") :
    installation of package âhttpuvâ had non-zero exit status

Installation fails on the Alpine Linux

Hi.

I can't build this package on Alpine Linux.

To reproduce:

docker run -ti --rm alpine:edge ash
apk update
apk add R R-dev g++
echo 'options(repos = c(CRAN = "https://cloud.r-project.org/"))' >> /usr/lib/R/etc/Rprofile.site
Rscript -e 'install.packages("httpuv")'

The same errors with git-version.

Build log:

also installing the dependency ‘Rcpp’

trying URL 'https://cloud.r-project.org/src/contrib/Rcpp_0.12.7.tar.gz'
Content type 'application/x-gzip' length 2421965 bytes (2.3 MB)
==================================================
downloaded 2.3 MB

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

* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/include/R -DNDEBUG -I../inst/include/ -Os -fomit-frame-pointer    -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c Date.cpp -o Date.o
g++ -I/usr/include/R -DNDEBUG -I../inst/include/ -Os -fomit-frame-pointer    -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c Module.cpp -o Module.o
g++ -I/usr/include/R -DNDEBUG -I../inst/include/ -Os -fomit-frame-pointer    -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c Rcpp_init.cpp -o Rcpp_init.o
g++ -I/usr/include/R -DNDEBUG -I../inst/include/ -Os -fomit-frame-pointer    -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c api.cpp -o api.o
g++ -I/usr/include/R -DNDEBUG -I../inst/include/ -Os -fomit-frame-pointer    -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c attributes.cpp -o attributes.o
g++ -I/usr/include/R -DNDEBUG -I../inst/include/ -Os -fomit-frame-pointer    -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c barrier.cpp -o barrier.o
g++ -shared -L/usr/lib/R/lib -Wl,--as-needed -o Rcpp.so Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o -L/usr/lib/R/lib -lR
installing to /usr/lib/R/library/Rcpp/libs
** R
** inst
** preparing package for lazy loading
code for methods in class “C++OverloadedMethods” was not checked for suspicious field assignments (recommended package ‘codetools’ not available?)
code for methods in class “RcppClass” was not checked for suspicious field assignments (recommended package ‘codetools’ not available?)
code for methods in class “RcppClass” was not checked for suspicious field assignments (recommended package ‘codetools’ not available?)
** help
*** installing help indices
Warning in file.copy(file.path(R.home("doc"), "html", "R.css"), outman) :
  problem copying /usr/share/doc/R/html/R.css to /usr/lib/R/library/Rcpp/html/R.css: No such file or directory
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (Rcpp)
* installing *source* package ‘httpuv’ ...
** package ‘httpuv’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c RcppExports.cpp -o RcppExports.o
g++ -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c filedatasource-unix.cpp -o filedatasource-unix.o
g++ -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c filedatasource-win.cpp -o filedatasource-win.o
g++ -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c http.cpp -o http.o
g++ -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c httpuv.cpp -o httpuv.o
gcc -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer  -c md5.c -o md5.o
gcc -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer  -c set_invalid_parameter.c -o set_invalid_parameter.o
g++ -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c uvutil.cpp -o uvutil.o
g++ -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c websockets-base.cpp -o websockets-base.o
g++ -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c websockets-hixie76.cpp -o websockets-hixie76.o
g++ -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c websockets-hybi03.cpp -o websockets-hybi03.o
g++ -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c websockets-ietf.cpp -o websockets-ietf.o
g++ -I/usr/include/R -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -Os -fomit-frame-pointer -I"/usr/lib/R/library/Rcpp/include"   -fpic  -Os -fomit-frame-pointer -D__MUSL__  -c websockets.cpp -o websockets.o
websockets.cpp: In member function 'bool WebSocketConnection::accept(const RequestHeaders&, const char*, size_t)':
websockets.cpp:217:8: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
   std::auto_ptr<WebSocketProto_IETF> ietf(new WebSocketProto_IETF());
        ^~~~~~~~
In file included from /usr/include/c++/6.2.0/bits/locale_conv.h:41:0,
                 from /usr/include/c++/6.2.0/locale:43,
                 from /usr/include/c++/6.2.0/iomanip:43,
                 from websockets.cpp:6:
/usr/include/c++/6.2.0/bits/unique_ptr.h:49:28: note: declared here
   template<typename> class auto_ptr;
                            ^~~~~~~~
websockets.cpp:223:8: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
   std::auto_ptr<WebSocketProto_HyBi03> hybi03(new WebSocketProto_HyBi03());
        ^~~~~~~~
In file included from /usr/include/c++/6.2.0/bits/locale_conv.h:41:0,
                 from /usr/include/c++/6.2.0/locale:43,
                 from /usr/include/c++/6.2.0/iomanip:43,
                 from websockets.cpp:6:
/usr/include/c++/6.2.0/bits/unique_ptr.h:49:28: note: declared here
   template<typename> class auto_ptr;
                            ^~~~~~~~
make --directory=libuv \
        CC="gcc" CFLAGS="-Os -fomit-frame-pointer  -fpic" AR="ar" RANLIB="ranlib" \
    HAVE_DTRACE=0 \
        libuv.a
make[1]: Entering directory '/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv'
mkdir -p src/unix
touch src/unix/.buildstamp
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/async.c -o src/unix/async.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/core.c -o src/unix/core.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/dl.c -o src/unix/dl.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/error.c -o src/unix/error.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/fs.c -o src/unix/fs.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/getaddrinfo.c -o src/unix/getaddrinfo.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/loop.c -o src/unix/loop.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/loop-watcher.c -o src/unix/loop-watcher.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/pipe.c -o src/unix/pipe.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/poll.c -o src/unix/poll.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/process.c -o src/unix/process.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/signal.c -o src/unix/signal.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/stream.c -o src/unix/stream.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/tcp.c -o src/unix/tcp.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/thread.c -o src/unix/thread.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/threadpool.c -o src/unix/threadpool.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/timer.c -o src/unix/timer.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/tty.c -o src/unix/tty.o
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/unix/udp.c -o src/unix/udp.o
mkdir -p src
touch src/.buildstamp
gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/include/uv-private -I/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer  -fpic -c src/fs-poll.c -o src/fs-poll.o
src/fs-poll.c: In function 'statbuf_eq':
src/fs-poll.c:205:8: error: 'uv_statbuf_t {aka const struct stat}' has no member named 'st_ctimensec'; did you mean 'st_ctim'?
   if (a->st_ctimensec != b->st_ctimensec) return 0;
        ^~
src/fs-poll.c:205:27: error: 'uv_statbuf_t {aka const struct stat}' has no member named 'st_ctimensec'; did you mean 'st_ctim'?
   if (a->st_ctimensec != b->st_ctimensec) return 0;
                           ^~
src/fs-poll.c:206:8: error: 'uv_statbuf_t {aka const struct stat}' has no member named 'st_mtimensec'; did you mean 'st_mtim'?
   if (a->st_mtimensec != b->st_mtimensec) return 0;
        ^~
src/fs-poll.c:206:27: error: 'uv_statbuf_t {aka const struct stat}' has no member named 'st_mtimensec'; did you mean 'st_mtim'?
   if (a->st_mtimensec != b->st_mtimensec) return 0;
                           ^~
make[1]: *** [/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv/config-unix.mk:192: src/fs-poll.o] Error 1
make[1]: Leaving directory '/tmp/RtmphKAJmL/R.INSTALL5d54025a97/httpuv/src/libuv'
make: *** [Makevars:27: libuv.a] Error 2
ERROR: compilation failed for package ‘httpuv’
* removing ‘/usr/lib/R/library/httpuv’

The downloaded source packages are in
        ‘/tmp/RtmpBJOena/downloaded_packages’
Updating HTML index of packages in '.Library'
Warning messages:
1: In install.packages("httpuv") :
  installation of package ‘httpuv’ had non-zero exit status
2: In file.create(f.tg) :
  cannot create file '/usr/share/doc/R/html/packages.html', reason 'No such file or directory'
3: In make.packages.html(.Library) : cannot update HTML package index

Regards,
Artem

libuv dependency on CoreFoundation

This issue is closely related to #6 but slightly different in the fact that it also appears if outside of R.app.

Edit: a video that shows what happens on Mavericks: http://youtu.be/ZUfudbP1quA

Since the upgrade to Mavericks, the dependency of libuv on CF has gotten more problematic for me, because libcurl is now using CF as well. This puts a lot of restrictions on the ability to fork and do parallel processing. See also this thread.

I'm obviously not an expert on libuv or CF, but judging from some recent commits and announcements 1, 2, 3 it looks like in the latest release of libuv, The ApplicationServices, CoreFoundation and CoreServices frameworks are no longer required dependencies on OS X. Would that solve anything?

Here is a small example that works fine on linux, but if you run it on osx, it will crash child process, and the parent is having issues as well after the incident (it looks like it can no longer call fork or exec):

library(parallel)
library(httpuv)

runServer("0.0.0.0", 12345, list(call=function(req){
  myfork <- mcparallel({
    library(RCurl);
    getURL("https://api.github.com")
  })

  out <- mccollect(myfork)[[1]];

  list(
    status = 200,
    headers = list("Content-Type"="text/plain"),
    body = out
  );

}));

Installation fails on Solaris

Hi,

I'm trying to install httpuv on a Solaris virtual machine image provided by @jeroen, and something's going wrong.

I'm not sure if the issue is on my end (eg. environmental variables) or if its due to a bug in httpuv. So I thought I'd post an issue here, and see if anyone has any ideas.

Please let me know if I can provide any more information.


Installation log

install.packages("httpuv")
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://cloud.r-project.org/src/contrib/httpuv_1.3.3.tar.gz'
Content type 'application/x-gzip' length 426665 bytes (416 KB)
==================================================
downloaded 416 KB

* installing *source* package 'httpuv' ...
** package 'httpuv' successfully unpacked and MD5 sums checked
** libs
/opt/csw/bin/g++-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c RcppExports.cpp -o RcppExports.o
/opt/csw/bin/g++-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c filedatasource-unix.cpp -o filedatasource-unix.o
/opt/csw/bin/g++-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c filedatasource-win.cpp -o filedatasource-win.o
/opt/csw/bin/g++-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c http.cpp -o http.o
/opt/csw/bin/g++-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c httpuv.cpp -o httpuv.o
/opt/csw/bin/gcc-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c md5.c -o md5.o
/opt/csw/bin/gcc-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c set_invalid_parameter.c -o set_invalid_parameter.o
/opt/csw/bin/g++-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c uvutil.cpp -o uvutil.o
/opt/csw/bin/g++-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c websockets-base.cpp -o websockets-base.o
/opt/csw/bin/g++-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c websockets-hixie76.cpp -o websockets-hixie76.o
/opt/csw/bin/g++-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c websockets-hybi03.cpp -o websockets-hybi03.o
/opt/csw/bin/g++-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c websockets-ietf.cpp -o websockets-ietf.o
/opt/csw/bin/g++-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c websockets.cpp -o websockets.o
make --directory=libuv \
	CC="/opt/csw/bin/gcc-5.2" CFLAGS="-O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC" AR="ar" RANLIB="ranlib" \
    HAVE_DTRACE=0 \
	libuv.a
make[1]: Entering directory `/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv'
mkdir -p src/unix
touch src/unix/.buildstamp
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/async.c -o src/unix/async.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/core.c -o src/unix/core.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/dl.c -o src/unix/dl.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/error.c -o src/unix/error.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/fs.c -o src/unix/fs.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/getaddrinfo.c -o src/unix/getaddrinfo.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/loop.c -o src/unix/loop.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/loop-watcher.c -o src/unix/loop-watcher.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/pipe.c -o src/unix/pipe.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/poll.c -o src/unix/poll.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/process.c -o src/unix/process.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/signal.c -o src/unix/signal.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/stream.c -o src/unix/stream.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/tcp.c -o src/unix/tcp.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/thread.c -o src/unix/thread.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/threadpool.c -o src/unix/threadpool.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/timer.c -o src/unix/timer.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/tty.c -o src/unix/tty.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/udp.c -o src/unix/udp.o
mkdir -p src
touch src/.buildstamp
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/fs-poll.c -o src/fs-poll.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/uv-common.c -o src/uv-common.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/inet.c -o src/inet.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/version.c -o src/version.o
/opt/csw/bin/gcc-5.2 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/include/uv-private -I/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c src/unix/sunos.c -o src/unix/sunos.o
ar rcs libuv.a src/unix/async.o src/unix/core.o src/unix/dl.o src/unix/error.o src/unix/fs.o src/unix/getaddrinfo.o src/unix/loop.o src/unix/loop-watcher.o src/unix/pipe.o src/unix/poll.o src/unix/process.o src/unix/signal.o src/unix/stream.o src/unix/tcp.o src/unix/thread.o src/unix/threadpool.o src/unix/timer.o src/unix/tty.o src/unix/udp.o src/fs-poll.o src/uv-common.o src/inet.o src/version.o src/unix/sunos.o
make[1]: Leaving directory `/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/libuv'
make --directory=http-parser \
	CC="/opt/csw/bin/gcc-5.2" CFLAGS="-O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC" AR="ar" RANLIB="ranlib" \
	http_parser.o
make[1]: Entering directory `/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/http-parser'
/opt/csw/bin/gcc-5.2 -I. -DHTTP_PARSER_STRICT=0  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -O3  -c http_parser.c
make[1]: Leaving directory `/tmp/Rtmpa2mrPS/R.INSTALLd8c23f936ef/httpuv/src/http-parser'
(cd sha1 && /opt/csw/bin/gcc-5.2 -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -fPIC -c sha1.c -o sha1.o)
(cd base64 && /opt/csw/bin/g++-5.2 -I/opt/csw/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/opt/csw/include -I"/opt/csw/lib/R/library/Rcpp/include"   -fPIC  -O2 -pipe -fno-omit-frame-pointer -m32 -march=pentiumpro  -c base64.cpp -o base64.o)
/opt/csw/bin/g++-5.2 -shared -m32 -march=pentiumpro -L/opt/csw/lib -o httpuv.so RcppExports.o filedatasource-unix.o filedatasource-win.o http.o httpuv.o md5.o set_invalid_parameter.o uvutil.o websockets-base.o websockets-hixie76.o websockets-hybi03.o websockets-ietf.o websockets.o ./libuv/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o -lkstat -lsendfile
installing to /opt/csw/lib/R/library/httpuv/libs
** R
** demo
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/opt/csw/lib/R/library/httpuv/libs/httpuv.so':
  ld.so.1: R: fatal: relocation error: file /opt/csw/lib/R/library/httpuv/libs/httpuv.so: symbol in6addr_any: referenced symbol not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing '/opt/csw/lib/R/library/httpuv'

The downloaded source packages are in
	'/tmp/Rtmpiek6fj/downloaded_packages'
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("httpuv") :
  installation of package 'httpuv' had non-zero exit status

Session Information

R version 3.3.0 (2016-05-03) -- "Supposedly Educational"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: i386-pc-solaris2.10 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: i386-pc-solaris2.10 (32-bit)
Running under: Solaris 11

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base 

GCC Information

Reading specs from /opt/csw/lib/gcc/i386-pc-solaris2.10/5.2.0/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/csw/libexec/gcc/i386-pc-solaris2.10/5.2.0/lto-wrapper
Target: i386-pc-solaris2.10
Configured with: /home/dam/mgar/pkg/gcc5/trunk/work/solaris10-i386/build-isa-pentium_pro/gcc-5.2.0/configure --prefix=/opt/csw --exec_prefix=/opt/csw --bindir=/opt/csw/bin --sbindir=/opt/csw/sbin --libexecdir=/opt/csw/libexec --datadir=/opt/csw/share --sysconfdir=/etc/opt/csw --sharedstatedir=/opt/csw/share --localstatedir=/var/opt/csw --libdir=/opt/csw/lib --infodir=/opt/csw/share/info --includedir=/opt/csw/include --mandir=/opt/csw/share/man --enable-cloog-backend=isl --enable-java-awt=xlib --enable-languages=ada,c,c++,fortran,go,java,objc --enable-libada --enable-libssp --enable-nls --enable-objc-gc --enable-threads=posix --program-suffix=-5.2 --with-cloog=/opt/csw --with-gmp=/opt/csw --with-included-gettext --with-ld=/usr/ccs/bin/ld --without-gnu-ld --with-libiconv-prefix=/opt/csw --with-mpfr=/opt/csw --with-ppl=/opt/csw --with-system-zlib=/opt/csw --with-gnu-as --with-as=/opt/csw/bin/gas
Thread model: posix
gcc version 5.2.0 (GCC) 

cannot install httpuv (linux, non-root, from R)

  1. install.packages("httpuv") or install_github("httpuv", "rstudio")

produces:

In file included from websockets.cpp:9:
./base64/base64.hpp:6:7: warning: no newline at end of file
make --directory=libuv
CC="gcc -std=gnu99" CFLAGS="-g -O2 -fpic" AR="ar" RANLIB="ranlib"
libuv.a
make[1]: Entering directory /tmp/RtmpeiG6wG/R.INSTALL667974a6c361/httpuv/src/libuv' Makefile:26: SRCDIR/event/linux/build.mk: No such file or directory make[1]: *** No rule to make targetSRCDIR/event/linux/build.mk'. Stop.
make[1]: Leaving directory `/tmp/RtmpeiG6wG/R.INSTALL667974a6c361/httpuv/src/libuv'
make: *** [libuv.a] Error 2
ERROR: compilation failed for package 'httpuv'

I'm installing on a suse linux system to my local Rpack location (no root).

Thanks

Build fails with undefined reference to uv__io_poll in core.c:317 (Cygwin, Windows 7)

Any suggestions would be appreciated.

This is using up to date Cygwin on Windows 7 Enterprise, with limited network connection, and none in R (due to proxy issues). R is version 3.4.0.

When I do:

$ R CMD /usr/lib/R/bin/INSTALL -l /usr/lib/R/site-library httpuv_1.3.5.tar.gz

it goes for a long time, doing many things, most happily, with some warnings along the way:

g++ -std=gnu++11 -I/usr/lib/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/usr/lib/R/site-library/Rcpp/include" -ggdb -O2 -pipe -fdebug-prefix-map=/cygdrive/e/cyg_pub/devel/R/R-3.4.0-1.x86_64/build=/usr/src/debug/R-3.4.0-1 -fdebug-prefix-map=/cygdrive/e/cyg_pub/devel/R/R-3.4.0-1.x86_64/src/R-3.4.0=/usr/src/debug/R-3.4.0-1 -c websockets.cpp -o websockets.o
websockets.cpp: In member function ‘bool WebSocketConnection::accept(const RequestHeaders&, const char*, size_t)’:
websockets.cpp:217:8: warning: ‘template class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
std::auto_ptr<WebSocketProto_IETF> ietf(new WebSocketProto_IETF());
^
In file included from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/bits/locale_conv.h:41:0,
from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/locale:43,
from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/iomanip:43,
from websockets.cpp:6:
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/bits/unique_ptr.h:49:28: note: declared here
template class auto_ptr;
^
websockets.cpp:223:8: warning: ‘template class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
std::auto_ptr<WebSocketProto_HyBi03> hybi03(new WebSocketProto_HyBi03());
^
In file included from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/bits/locale_conv.h:41:0,
from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/locale:43,
from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/iomanip:43,
from websockets.cpp:6:
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/bits/unique_ptr.h:49:28: note: declared here
template class auto_ptr;
^

But eventually it ends unhappily, with:

g++ -std=gnu++11 -shared -L/usr/lib/R/lib -o httpuv.dll RcppExports.o filedatasource-unix.o filedatasource-win.o http.o httpuv.o md5.o register.o set_invalid_parameter.o uvutil.o websockets-base.o websockets-hixie76.o websockets-hybi03.o websockets-ietf.o websockets.o ./libuv/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o -L/usr/lib/R/lib -lR -lintl -lpcre -llzma -lbz2 -lz -ltirpc -lrt -ldl -lm -liconv -licuuc -licui18n
./libuv/libuv.a(core.o): In function uv_run': /tmp/RtmpNcXRWh/R.INSTALL1bb4212480a0/httpuv/src/libuv/src/unix/core.c:317: undefined reference to uv__io_poll'
/tmp/RtmpNcXRWh/R.INSTALL1bb4212480a0/httpuv/src/libuv/src/unix/core.c:317:(.text+0x412): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `uv__io_poll'
collect2: error: ld returned 1 exit status
make: *** [/usr/lib/R/share/make/shlib.mk:6: httpuv.dll] Error 1
ERROR: compilation failed for package ‘httpuv’

  • removing ‘/usr/lib/R/site-library/httpuv’

However, when I use a downloaded latest libuv-1x, everything seems to work OK aside from a couple warnings:

$ sh autogen.sh

complains a couple times about:

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake-1.14 line 3930.

$ ./configure

seems to finish OK.

$ make

is OK except a warning:

CC src/unix/libuv_la-pipe.lo
src/unix/pipe.c: In function ‘uv__pipe_getsockpeername’:
src/unix/pipe.c:249:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (addrlen >= *size) {
^

I have not done the "make install" step.

Daemonizing

Can the option of daemonizing the server be added to this? The websockets package had that for UNIX-like environments and it would be great to fold that into this awesome package.

parallel and CoreFoundation on OSX

I am running httpuv in a fork to keep the main process responsive:

library(parallel);

myhandler <- function(env){
  list(
    status=200,
    body="hello!",
    headers=list("Content-Type"="text/plain")
  )
}

mysrv <- mcparallel({
  httpuv::runServer("0.0.0.0", 12345, list(call=myhandler));
})

#tools::pskill(mysrv$pid)

This works great on mac and linux. However, when I run this on rstudio desktop on mac, I get to see these warnings:

The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.

I use parallel a lot, but I have never seen this. Any guess to what might cause this? Is it a bug in how parallel is implemented on the mac? Or something httpuv specific?

Build failure on OS X 10.9: Symbol not found _Rcpp::Environment::operator[]

Hl,

I'm trying to compile httpuv but getting this dynamic loading error after compilation:

clang --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/private/var/folders/xn/m5bs3hk97376bgttqgyf0sqr0000gn/T/RtmpdbBwz5/httpuv-master/src/libuv/include -I/private/var/folders/xn/m5bs3hk97376bgttqgyf0sqr0000gn/T/RtmpdbBwz5/httpuv-master/src/libuv/include/uv-private -I/private/var/folders/xn/m5bs3hk97376bgttqgyf0sqr0000gn/T/RtmpdbBwz5/httpuv-master/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -mtune=core2 -g -O2  -fPIC -c src/unix/darwin-proctitle.c -o src/unix/darwin-proctitle.o
src/unix/darwin-proctitle.c:75:3: warning: 'GetCurrentProcess' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
  GetCurrentProcess(&psn);
  ^
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/Processes.h:415:1: note: 'GetCurrentProcess' declared here
MacGetCurrentProcess(ProcessSerialNumber * PSN)               AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_9;
^
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/Processes.h:412:34: note: expanded from macro 'MacGetCurrentProcess'
    #define MacGetCurrentProcess GetCurrentProcess
                                 ^
1 warning generated.
ar rcs libuv.a src/unix/async.o src/unix/core.o src/unix/dl.o src/unix/error.o src/unix/fs.o src/unix/getaddrinfo.o src/unix/loop.o src/unix/loop-watcher.o src/unix/pipe.o src/unix/poll.o src/unix/process.o src/unix/signal.o src/unix/stream.o src/unix/tcp.o src/unix/thread.o src/unix/threadpool.o src/unix/timer.o src/unix/tty.o src/unix/udp.o src/fs-poll.o src/uv-common.o src/inet.o src/version.o src/unix/darwin.o src/unix/kqueue.o src/unix/fsevents.o src/unix/proctitle.o src/unix/darwin-proctitle.o
make --directory=http-parser \
        CC="clang" CFLAGS="-mtune=core2 -g -O2  -fPIC" AR="ar" RANLIB="ranlib" \
        http_parser.o
clang -I. -DHTTP_PARSER_STRICT=0  -mtune=core2 -g -O2  -fPIC -O3  -c http_parser.c
(cd sha1 && clang -mtune=core2 -g -O2  -fPIC -c sha1.c -o sha1.o)
(cd base64 && clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include"   -fPIC  -mtune=core2 -g -O2  -c base64.cpp -o base64.o)
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o httpuv.so RcppExports.o filedatasource-unix.o filedatasource-win.o http.o httpuv.o md5.o set_invalid_parameter.o uvutil.o websockets-base.o websockets-hixie76.o websockets-hybi03.o websockets-ietf.o websockets.o /Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/lib/libRcpp.a ./libuv/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o -framework CoreServices -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.0/Resources/library/httpuv/libs
** R
** demo
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/3.0/Resources/library/httpuv/libs/httpuv.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/httpuv/libs/httpuv.so, 6): Symbol not found: __ZN4Rcpp11EnvironmentixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
  Referenced from: /Library/Frameworks/R.framework/Versions/3.0/Resources/library/httpuv/libs/httpuv.so
  Expected in: flat namespace
 in /Library/Frameworks/R.framework/Versions/3.0/Resources/library/httpuv/libs/httpuv.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing '/Library/Frameworks/R.framework/Versions/3.0/Resources/library/httpuv'
Error: Command failed (1)
> 

Demangled name of missing symbol is: _Rcpp::Environment::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&).

Error: not compatible with STRSXP

Sometimes httpuv suddenly dies and sends me back to the prompt with the following error:

> httpuv::runServer("0.0.0.0", 12345, list(call=opencpu2:::rookhandler))
Error: not compatible with STRSXP
>

I have a bit of a hard time narrowing this down, but it seems to only occur for certain http methods. Any guess to what this could be related to?

libuv conflict makes installation fail

Hi all,

I've found a problem while trying to install httpuv on R 3.4.0, Mac OS X Yosemite. Basically compilation fails because uv_err_t is not defined (see full build log). clang suggests to use uv_errno_t instead, which seems to have been introduced in libuv version 1.0.0. After seeing that httpuv comes with its own version of libuv I have found out that I had a system-wide installation of libuv version 1.0.0. It seems like the compiler picks the system-wide library instead of the custom one and fails. I tried to uninstall the system-wide library and compilation now works.

To avoid this issue, I tried to substitute all instances of #include <uv.h> with #include "uv.h". This way the build system takes the local library instead of the system library. This worked for me, so if you think this is a proper solution, you might want to fix it this way.

** package ‘httpuv’ successfully unpacked and MD5 sums checked
** libs
ccache clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11 -c RcppExports.cpp -o RcppExports.o
ccache clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11 -c filedatasource-unix.cpp -o filedatasource-unix.o
ccache clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11 -c filedatasource-win.cpp -o filedatasource-win.o
ccache clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11 -c http.cpp -o http.o
In file included from http.cpp:1:
./http.h:163:1: warning: 'HttpResponse' defined as a struct here but previously declared as a class [-Wmismatched-tags]
struct HttpResponse {
^
./http.h:18:1: note: did you mean struct here?
class HttpResponse;
^~~~~
struct
1 warning generated.
ccache clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11 -c httpuv.cpp -o httpuv.o
In file included from httpuv.cpp:14:
./http.h:163:1: warning: 'HttpResponse' defined as a struct here but previously declared as a class [-Wmismatched-tags]
struct HttpResponse {
^
./http.h:18:1: note: did you mean struct here?
class HttpResponse;
^~~~~
struct
1 warning generated.
ccache clang -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -arch x86_64  -O3 -Wall -pipe -pedantic -std=gnu99 -c md5.c -o md5.o
ccache clang -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -arch x86_64  -O3 -Wall -pipe -pedantic -std=gnu99 -c set_invalid_parameter.c -o set_invalid_parameter.o
ccache clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11 -c uvutil.cpp -o uvutil.o
ccache clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11 -c websockets-base.cpp -o websockets-base.o
ccache clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11 -c websockets-hixie76.cpp -o websockets-hixie76.o
ccache clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11 -c websockets-hybi03.cpp -o websockets-hybi03.o
ccache clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11 -c websockets-ietf.cpp -o websockets-ietf.o
ccache clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/Users/user/Library/R/3.4/library/Rcpp/include" -I/opt/local/include   -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11 -c websockets.cpp -o websockets.o
make --directory=libuv \
	CC="ccache clang" CFLAGS="-pipe -Os -arch x86_64  -O3 -Wall -pipe -pedantic -std=gnu99 -fPIC" AR="ar" RANLIB="ranlib" \
    HAVE_DTRACE=0 \
	libuv.a
make[1]: Entering directory '/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv'
mkdir -p src/unix
touch src/unix/.buildstamp
ccache clang --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/opt/local/include -I/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv/include -I/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv/include/uv-private -I/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -pipe -Os -arch x86_64  -O3 -Wall -pipe -pedantic -std=gnu99 -fPIC -c src/unix/async.c -o src/unix/async.o
In file included from src/unix/async.c:26:
In file included from src/unix/internal.h:25:
/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv/src/uv-common.h:71:14: error: unknown type name 'uv_err_t'; did you mean 'uv_errno_t'?
extern const uv_err_t uv_ok_;
             ^~~~~~~~
             uv_errno_t
/opt/local/include/uv.h:178:3: note: 'uv_errno_t' declared here
} uv_errno_t;
  ^
In file included from src/unix/async.c:26:
In file included from src/unix/internal.h:25:
/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv/src/uv-common.h:73:1: error: unknown type name 'uv_err_code'
uv_err_code uv_translate_sys_error(int sys_errno);
^
/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv/src/uv-common.h:74:36: error: unknown type name 'uv_err_code'
int uv__set_error(uv_loop_t* loop, uv_err_code code, int sys_error);
                                   ^
/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv/src/uv-common.h:76:47: error: unknown type name 'uv_err_code'
int uv__set_artificial_error(uv_loop_t* loop, uv_err_code code);
                                              ^
/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv/src/uv-common.h:77:1: error: unknown type name 'uv_err_t'; did you mean 'uv_errno_t'?
uv_err_t uv__new_sys_error(int sys_error);
^~~~~~~~
uv_errno_t
/opt/local/include/uv.h:178:3: note: 'uv_errno_t' declared here
} uv_errno_t;
  ^
In file included from src/unix/async.c:26:
In file included from src/unix/internal.h:25:
/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv/src/uv-common.h:78:1: error: unknown type name 'uv_err_t'; did you mean 'uv_errno_t'?
uv_err_t uv__new_artificial_error(uv_err_code code);
^~~~~~~~
uv_errno_t
/opt/local/include/uv.h:178:3: note: 'uv_errno_t' declared here
} uv_errno_t;
  ^
In file included from src/unix/async.c:26:
In file included from src/unix/internal.h:25:
/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv/src/uv-common.h:78:35: error: unknown type name 'uv_err_code'
uv_err_t uv__new_artificial_error(uv_err_code code);
                                  ^
In file included from src/unix/async.c:26:
src/unix/internal.h:143:1: error: unknown type name 'uv_err_code'
uv_err_code uv_translate_sys_error(int sys_errno);
^
src/unix/internal.h:249:3: warning: implicit declaration of function 'ngx_queue_insert_tail' is invalid in C99 [-Wimplicit-function-declaration]
  uv__req_register(loop, req);
  ^
/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv/src/uv-common.h:123:5: note: expanded from macro 'uv__req_register'
    ngx_queue_insert_tail(&(loop)->active_reqs, &(req)->active_queue);        \
    ^
src/unix/async.c:65:3: warning: implicit declaration of function 'ngx_queue_remove' is invalid in C99 [-Wimplicit-function-declaration]
  ngx_queue_remove(&handle->queue);
  ^
src/unix/async.c:73:3: error: use of undeclared identifier 'ngx_queue_t'
  ngx_queue_t* q;
  ^
src/unix/async.c:73:16: error: use of undeclared identifier 'q'
  ngx_queue_t* q;
               ^
src/unix/async.c:76:3: warning: implicit declaration of function 'ngx_queue_foreach' is invalid in C99 [-Wimplicit-function-declaration]
  ngx_queue_foreach(q, &loop->async_handles) {
  ^
src/unix/async.c:76:21: error: use of undeclared identifier 'q'
  ngx_queue_foreach(q, &loop->async_handles) {
                    ^
3 warnings and 11 errors generated.
make[1]: *** [/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv/config-unix.mk:189: src/unix/async.o] Error 1
make[1]: Leaving directory '/private/var/folders/59/gwk4l4h118gdwp2y6pnwpc6h0000gn/T/Rtmp3UlstW/R.INSTALL518922db83f1/httpuv/src/libuv'
make: *** [Makevars:27: libuv.a] Error 2
ERROR: compilation failed for package ‘httpuv’
* removing ‘/Users/user/Library/R/3.4/library/httpuv’```

Upcoming support for R as websocket client?

Hello, I was just curious if there were any plans to include support for using R as a Websocket client in the future? I'm interested in being able to stream data from a server using javascript (e.g. socket.io, or sockjs) and listen to the data in R, from which I can build a shiny app to visualize or analyze the data in real time, similar to the CRAN packages app. Thanks!

build fails

jeroen@Raring-Office:~/Desktop$ sudo R CMD INSTALL httpuv-master/
[sudo] password for jeroen: 
* installing to library ‘/home/jeroen/R/x86_64-pc-linux-gnu-library/3.0’
* installing *source* package ‘httpuv’ ...
** libs
g++ -I/usr/share/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64  -I"/home/jeroen/R/x86_64-pc-linux-gnu-library/3.0/Rcpp/include"   -fpic  -O2 -pipe -g  -c RcppExports.cpp -o RcppExports.o
g++ -I/usr/share/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64  -I"/home/jeroen/R/x86_64-pc-linux-gnu-library/3.0/Rcpp/include"   -fpic  -O2 -pipe -g  -c filedatasource-unix.cpp -o filedatasource-unix.o
In file included from filedatasource.h:4:0,
             from filedatasource-unix.cpp:3:
uvutil.h:5:16: fatal error: uv.h: No such file or directory
compilation terminated.
make: *** [filedatasource-unix.o] Error 1
ERROR: compilation failed for package ‘httpuv’
* removing ‘/home/jeroen/R/x86_64-pc-linux-gnu-library/3.0/httpuv’
* restoring previous ‘/home/jeroen/R/x86_64-pc-linux-gnu-library/3.0/httpuv’

This is R 3.0.0 on Ubuntu Raring.

Build failing on RHEL 5.x

Trying to build on RHEL5.x, and compilation fails for async.c:

gcc-4.7 -std=gnu99 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/tmp/RtmpV9IPU4/devtools78685a347f5/httpuv-master/src/libuv/include -I/tmp/RtmpV9IPU4/devtools78685a347f5/httpuv-master/src/libuv/include/uv-private -I/tmp/RtmpV9IPU4/devtools78685a347f5/httpuv-master/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -m64 -I/usr/prog/compilers/intel/ics_2013/composer_xe_2013.3.163/mkl/include -fpic -c src/unix/async.c -o src/unix/async.o
In file included from /tmp/RtmpV9IPU4/devtools78685a347f5/httpuv-master/src/libuv/include/uv.h:67:0,
from src/unix/async.c:25:
/tmp/RtmpV9IPU4/devtools78685a347f5/httpuv-master/src/libuv/include/uv-private/uv-unix.h:131:1: error: unknown type name 'pthread_rwlock_t'
/tmp/RtmpV9IPU4/devtools78685a347f5/httpuv-master/src/libuv/include/uv-private/uv-unix.h:148:1: error: unknown type name 'pthread_barrier_t'
In file included from src/unix/async.c:25:0:
/tmp/RtmpV9IPU4/devtools78685a347f5/httpuv-master/src/libuv/include/uv.h:386:42: warning: 'struct addrinfo' declared inside parameter list [enabled by default]
/tmp/RtmpV9IPU4/devtools78685a347f5/httpuv-master/src/libuv/include/uv.h:386:42: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
make[1]: *** [src/unix/async.o] Error 1
make[1]: Leaving directory `/tmp/RtmpV9IPU4/devtools78685a347f5/httpuv-master/src/libuv'
make: *** [libuv.a] Error 2
ERROR: compilation failed for package 'httpuv'

  • removing '/usr/prog/R/3.0.2_gcc/lib64/R/library/httpuv'
    Error: Command failed (1)

file return fails when body is a character vector

It seems that httpuv does not correctly process when body is a file. The Rook spec says:

The Body
This is either a character or raw vector. If the character vector is named with value 'file' then value of the vector is interpreted as the location of a file.

However, in httpuv this results in an error:

myhandler <- function(env){
  myfile <- system.file("DESCRIPTION");

  list(
    status=200,
    body=structure(myfile, names="file"),
    #body=readBin(myfile, "raw", file.info(myfile)$size),
    headers=list("Content-Type" = "text/plain")
  );
}

installation procedure (Cygwin)

The installation procedure for the 'httpuv' R package fails on Cygwin.
The 'httpuv' R package use the barrier interface (pthread_barrier). Since Cygwin does not currently support the barrier interface, the installation fails.

Properly fix windows

Instead of fixup.h you can avoid these naming conflicts using:

#define R_NO_REMAP
#define STRICT_R_HEADERS

Error in httpuv::startServer

This example works fine for me https://gist.github.com/sckott/20c49a65162dda1a6a83 - but another person on a Linux box is getting the error with the line

oauth2.0_token(oauth_endpoints("github"), myapp)
Error in httpuv::startServer("127.0.0.1", 1410, list(call = listen)) : 
  Failed to create server

I'm not sure if this is a Linux specific problem, or something else.

Non-zero exit status due to .Last and/or message in .Rprofile

I could not find the reason for httpuv not being able to install (as a dependency for shiny), but deleting my .Rprofile seemed to solve the problem.

contents of .Rprofile:

q <- function (save="no", ...) {
  quit(save=save, ...)
}

.First <- function(){
 cat("\nWelcome at", date(), "\n")
}

.Last <- function(){
 cat("\nGoodbye at ", date(), "\n")
}

message("\n*** Successfully loaded .Rprofile ***\n")

Could this be from me re-defining .Last or having my own message in my .Rprofile? Seems like there's a last message check in daemon-echo.R

This might be more of a reference for people who people in installation issues.

[Possible BUG] PostgreSQL authentication with pgpass fails after startServer has been run, under Windows

I've already asked this question here , but since nobody answered it I've made additional tests and discover that problem lies in httpuv.
In short - I've my password for database connection stored in pgpass file as described in documentation (link). Usually works OK, but after running startServer it fails. Look on the example (I've translated error message from Polish by myself, so it may look slightly different):

con <- DBI::dbConnect(RPostgres::Postgres(), dbname = "mydb",
                 user = "username",
                 host = "localhost",
                 port = "5432")
# connection is established withour errors

serwer <- httpuv::startServer("127.0.0.1", 6442, list())

con <- DBI::dbConnect(RPostgres::Postgres(), dbname = "mydb",
                      user = "username",
                      host = "localhost",
                      port = "5432")
# Error: FATAL:  password authentication failed for user "username"
password retrieved from file "C:\Users\...\AppData\Roaming/postgresql/pgpass.conf"

Read my question on stackoverflow for details.

I've tried to replicate this behaviour on Ubuntu 14.04 64-bit, but everything worked smoothly, so it must be something in windows (I've checked it also on Windows 8 and the error was exactly the same).

I am not sure if this is an issue with httpuv package but I guess it's the best place to ask.

httpuv and rstudio-server

I tried running an example with httpuv::runServer inside r-studio. But it blocks the r process and thereby the rstudio webgui up till the point where I had to reboot. Am I doing something wrong, or is httpuv not intended to be loaded inside a user R session?

Install fails when .Rprofile prints to console

I'm using install.packages("httpuv", type="source") to install on a machine that uses a .Rprofile or Rprofile.site file that prints to the console:

.First <- function() {
  cat("Custom .Rprofile")
}

The build fails with a No such file or directory message, and the problem line is

g++ -m32 -shared -s -static-libgcc -o httpuv.dll tmp.def RcppExports.o filedatasource-unix.o filedatasource-win.o http.o httpuv.o md5.o set_invalid_parameter.o uvutil.o websockets-base.o websockets-hixie76.o websockets-hybi03.o websockets-ietf.o websockets.o Custom .Rprofile ./libuv/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o -lWs2_32 -lkernel32 -lpsapi -liphlpapi -Ld:/RCompile/r-compiling/local/local320/lib/i386 -Ld:/RCompile/r-compiling/local/local320/lib -LC:/PROGRA~1/R/R-32~1.0/bin/i386 -lR
g++.exe: error: Custom: No such file or directory
g++.exe: error: .Rprofile: No such file or directory

It appears that the cat output from the .Rprofile on this machine is being inserted into the g++ command. After removing the cat call, the library installs without error.

I've been able to reproduce this error on both windows and linux machines. This may also be related to #11.

Update libuv to v1.x

There are some niceties in v1 of libuv that may help daemonizing and error handling. Before I maybe dive in on seeing what it would take to migrate, I thought I should ask if you guys were thinking about it and had started to look into it.

Compilation error on RH6

I am getting this when trying to compile on Redhat 6:

gcc -std=gnu99 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include -I/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv-private -I/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fpic -c src/unix/async.c -o src/unix/async.o
In file included from /itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:67,
from src/unix/async.c:25:
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv-private/uv-unix.h:131: error: expected '=', ',', ';', 'asm' or 'attribute' before 'uv_rwlock_t'
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv-private/uv-unix.h:148: error: expected '=', ',', ';', 'asm' or 'attribute' before 'uv_barrier_t'
In file included from src/unix/async.c:25:
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:386: warning: 'struct addrinfo' declared inside parameter list
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:1881: error: expected ')' before '' token
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:1882: error: expected ')' before '
' token
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:1883: error: expected ')' before '' token
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:1884: error: expected ')' before '
' token
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:1885: error: expected ')' before '' token
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:1886: error: expected ')' before '
' token
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:1887: error: expected ')' before '' token
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:1888: error: expected ')' before '
' token
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:1923: error: expected ')' before '' token
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:1924: error: expected ')' before '
' token
/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv/include/uv.h:1925: error: expected ')' before '' token
In file included from src/unix/internal.h:35,
from src/unix/async.c:26:
src/unix/linux-syscalls.h:129: warning: type defaults to 'int' in declaration of 'sigset_t'
src/unix/linux-syscalls.h:129: error: expected ';', ',' or ')' before '
' token
make[1]: *** [src/unix/async.o] Error 1
make[1]: Leaving directory `/itox_scratch/tmp/Rtmp07aKZV/devtools12d5940aeba88/httpuv-master/src/libuv'
make: *** [libuv.a] Error 2
ERROR: compilation failed for package 'httpuv'

  • removing '/usr/prog/pcsi/RH6/R/source/R-3-1-0/localPackages/httpuv'
    Error: Command failed (1)

Cookie string doesn't get parsed ok by Rook

This seems to be a Rook/httpuv interaction. Using Rook::Rhttpd, things work OK. For me: new cookies are not recognized by Rook::Request$cookies() when I refresh, even though they are visible in the HTTP_COOKIE element of the environment.

R 3.1.1, Rook 1.1.1, httpuv 1.3.2.

Test case:

library(httpuv)
library(Rook)
ctr <- 1
app <- list(call=function(req) {
  rr <- Request$new(req)
  res <- Response$new()
  res$set_cookie(paste0("foo", ctr), paste0("bar", ctr))
  res$write("<html><body><p>Hit refresh to see the name of the cookie I just set... it should be: foo")
  res$write(ctr)
  res$write("</p>")
  ctr <<- ctr + sample(1:1000, 1)

  res$write("<p>Cookie names seen by rr$cookies():</p>")
  res$write(paste(names(rr$cookies()), collapse="<br>"))
  res$write("<p>cookie string from request env:</p>")
  res$write(req$HTTP_COOKIE)
  res$write("</body></html>")

  return(res$finish())
})
# won't work:
runServer("127.0.0.1", 4444, app)
# works:
rh <- Rhttpd$new()
rh$launch(app$call, "cookie")

MIME parser suggestion

Perhaps it would be useful to add a mime parser to the package?

When using httpuv we still need to depend on something like Rook to parse the request arguments. It would be great if we could do without. In particular the Multipart parser in Rook is a bit ad-hoc. However support for uploading files is important in the context of R, so multipart/form-data seems inevitable.

How does shiny parse file uploads? Does libuv or http-parser include a mime parser? Alternatively, some code could be taken from gmime or another parser?

It would be great if httpuv could be used without additional dependencies to build webapps.

duplicate .o and .a files from PKG_LIBS in g++ command

I'm using an older version of R (3.0.2), but ran into a problem where .o and .a files from the PKG_LIBS variable were showing up twice in the g++ command. The following Makevars worked better for me:

## Use the R_HOME indirection to support installations of multiple R version

UNAME := $(shell uname)

ifeq ($(UNAME), Darwin)
FRAMEWORK = -framework CoreServices
endif

OBJECTS = RcppExports.o filedatasource-unix.o filedatasource-win.o http.o httpuv.o md5.o set_invalid_parameter.o uvutil.o websockets-base.o websockets-hixie76.o websockets-hybi03.o websockets-ietf.o websockets.o ./libuv/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o 

PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"`  $(FRAMEWORK)
ifeq ($(UNAME), SunOS)
PKG_LIBS += -lkstat -lsendfile
endif
ifeq ($(UNAME), FreeBSD)
PKG_LIBS += -lkvm
endif

PKG_CPPFLAGS = -I./libuv/include -I./http-parser -I./sha1 -I./base64



.PHONY: all libuv/libuv.a http-parser/http-parser.o

all: $(SHLIB)
$(SHLIB): libuv/libuv.a http-parser/http-parser.o sha1/sha1.o base64/base64.o

libuv/libuv.a:
        $(MAKE) --directory=libuv \
                CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" \
    HAVE_DTRACE=0 \
                libuv.a

http-parser/http-parser.o:
        $(MAKE) --directory=http-parser \
                CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" \
                http_parser.o

sha1/sha1.o:
        (cd sha1 && $(CC) $(CFLAGS) $(CPICFLAGS) -c sha1.c -o sha1.o)

base64/base64.o:
        (cd base64 && $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c base64.cpp -o base64.o)

Params parsed incorrectly

library(Rook)
library(httpuv)

done <- FALSE
listen <- function(env) {
  req <- Request$new(env)
  str(req$params())
  done <<- TRUE

  res <- Response$new()
  res$header("Content-type", "text/plain")
  res$write("")
  res$finish()
}

server <- startServer("127.0.0.1", 1410, list(call = listen))
browseURL("http://127.0.0.1:1410/index.html?a=1")
while(!done) {
  service()
  Sys.sleep(0.001)
}
service()
stopServer(server)

The first parameter has name ?a instead of a

All requests on a TCP connection share a global, mutable scope

Any modifications to the req object persist across separate HTTP requests. If you run the following and hit it from the same browser, you'll see the counter increment.

I suppose there are benefits to this, but it seems unexpected when compared to e.g. Express.

httpuv::runServer("0.0.0.0", 3000,list(
  call = function(req){
    if (is.null(req$counter)){
      req$counter <- 0
    }
    req$counter <- req$counter + 1
    print(req$counter)

    list(
      status= 200L,
      headers = list(
        'Content-type' = 'text/html'
      ), body = "hi there"
    )
  }, onHeaders = function(req){
    NULL
  }, onWSOpen = function(ws){
    NULL
  }
))

Installing fails on R Version 3.3.0 (2016-05-03)

I am running > install.packages("httpuv")
This is my output:

* installing *source* package ‘httpuv’ ...
** package ‘httpuv’ successfully unpacked and MD5 sums checked
** libs
g++-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c RcppExports.cpp -o RcppExports.o
g++-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c filedatasource-unix.cpp -o filedatasource-unix.o
g++-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c filedatasource-win.cpp -o filedatasource-win.o
g++-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c http.cpp -o http.o
g++-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c httpuv.cpp -o httpuv.o
gcc-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c md5.c -o md5.o
gcc-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c set_invalid_parameter.c -o set_invalid_parameter.o
g++-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c uvutil.cpp -o uvutil.o
g++-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c websockets-base.cpp -o websockets-base.o
g++-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c websockets-hixie76.cpp -o websockets-hixie76.o
g++-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c websockets-hybi03.cpp -o websockets-hybi03.o
g++-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c websockets-ietf.cpp -o websockets-ietf.o
g++-5 -I/usr/local/Cellar/r/3.3.0_1/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fPIC  -g -O2  -c websockets.cpp -o websockets.o
make --directory=libuv \
        CC="gcc-5" CFLAGS="-g -O2  -fPIC" AR="ar" RANLIB="ranlib" \
    HAVE_DTRACE=0 \
        libuv.a
mkdir -p src/unix
touch src/unix/.buildstamp
gcc-5 --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I/private/var/folders/3r/1zwg7j0x79s13b4q46x4nzm40000gn/T/RtmpS0hYI7/R.INSTALL2cf45a8870d6/httpuv/src/libuv/include -I/private/var/folders/3r/1zwg7j0x79s13b4q46x4nzm40000gn/T/RtmpS0hYI7/R.INSTALL2cf45a8870d6/httpuv/src/libuv/include/uv-private -I/private/var/folders/3r/1zwg7j0x79s13b4q46x4nzm40000gn/T/RtmpS0hYI7/R.INSTALL2cf45a8870d6/httpuv/src/libuv/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -g -O2  -fPIC -c src/unix/async.c -o src/unix/async.o
In file included from /usr/include/Availability.h:172:0,
                 from /usr/include/sys/stat.h:75,
                 from /private/var/folders/3r/1zwg7j0x79s13b4q46x4nzm40000gn/T/RtmpS0hYI7/R.INSTALL2cf45a8870d6/httpuv/src/libuv/include/uv-private/uv-unix.h:28,
                 from /private/var/folders/3r/1zwg7j0x79s13b4q46x4nzm40000gn/T/RtmpS0hYI7/R.INSTALL2cf45a8870d6/httpuv/src/libuv/include/uv.h:67,
                 from src/unix/async.c:25:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LSInfoDeprecated.h:1242:34: error: expected ',' or '}' before '__attribute__'
   kLSHandlerOptionsDefault       __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_4, __MAC_10_11, __IPHONE_4_0, __IPHONE_9_0, "Creator codes are deprecated on OS X.") = 0,
                                  ^
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LSOpenDeprecated.h:27:33: error: expected ',' or '}' before '__attribute__'
   kLSLaunchStartClassic         __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_11, __IPHONE_NA, __IPHONE_NA, "The Classic environment is no longer supported.") = 
                                 ^
make[1]: *** [src/unix/async.o] Error 1
make: *** [libuv.a] Error 2
ERROR: compilation failed for package ‘httpuv’
* removing ‘/usr/local/lib/R/site-library/httpuv’

The downloaded source packages are in
    ‘/private/var/folders/3r/1zwg7j0x79s13b4q46x4nzm40000gn/T/Rtmpxxqi5Q/downloaded_packages’
Warning message:
In install.packages("httpuv") :
  installation of package ‘httpuv’ had non-zero exit status

I need this in order to install.packages("shiny")

Compilationn fails on CentOS 6

CentOS 6.5 x86_64
gcc 4.4.7
R 3.1.0
Rcpp 0.10.3

RcppExports.cpp: In function 'SEXPREC* httpuv_daemonize(SEXPREC*)':
RcppExports.cpp:110: error: 'input_parameter' is not a member of 'Rcpp::traits'
RcppExports.cpp:110: error: expected primary-expression before '>' token
RcppExports.cpp:110: error: '::type' has not been declared
RcppExports.cpp:110: error: expected ';' before 'handle'
RcppExports.cpp:111: error: 'handle' was not declared in this scope
RcppExports.cpp: In function 'SEXPREC* httpuv_destroyDaemonizedServer(SEXPREC*)':
RcppExports.cpp:124: error: 'input_parameter' is not a member of 'Rcpp::traits'
RcppExports.cpp:124: error: expected primary-expression before '>' token
RcppExports.cpp:124: error: '::type' has not been declared
RcppExports.cpp:124: error: expected ';' before 'handle'
RcppExports.cpp:125: error: 'handle' was not declared in this scope
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package 'httpuv'

Any help would be much appreciated!

R crashes when calling stopDaemonizedServer in later::later

Following is a minimal example (will crash your session):

library(httpuv)
library(later)
server <- startDaemonizedServer('127.0.0.1', 8080L, list(call = function(req) {list(status=200L, headers=list('Content-Type' = 'text/html'), body = '')}))

later::later(function() {stopDaemonizedServer(server)}, 1)

This is observed running R 3.2.2 on macOS 10.12.5

Can't set multiple headers of the same name

I can't find a way to set multiple headers of the same name on a single response. Since the headers are kept in a list, I think it's impossible to set multiple cookies in a single response.

e.g.

Set-Cookie a=1;
Set-Cookie b=2;

would not be possible at the moment.

install.packages on Ubuntu 14.10 fails (while install_github works)

Ubuntu: 14.10
RStudio: 0.98.1087
gcc: 4.9.1

When installing via install.packages("httpuv") I get the following problem:

[snip]
g++ -shared -Wl,-Bsymbolic-functions -Wl,-z,relro -o httpuv.so RcppExports.o filedatasource-unix.o filedatasource-win.o http.o httpuv.o md5.o set_invalid_parameter.o uvutil.o websockets-base.o websockets-hixie76.o websockets-hybi03.o websockets-ietf.o websockets.o Started R session at Tue Dec 23 15:22:24 2014 Closing R session at Tue Dec 23 15:22:24 2014 ./libuv/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o -L/usr/lib/R/lib -lR
g++: error: Started: No such file or directory
g++: error: R: No such file or directory
g++: error: session: No such file or directory
g++: error: at: No such file or directory
g++: error: Tue: No such file or directory
[/snip]

If I install httpuv using devtools::install_github('httpuv', 'rstudio') instead, the package installs just nicely.
No idea how this "Started R session at ..." line slips in, however.

Build failure on OS X 10.9 - tool version numbers hard coded; symbol not found

A colleague has been trying to install httpuv to test my latest Shiny setup. He ran into the following error:

---- start ----

The downloaded binary packages are in
/tmp/RtmpwOYYzN/downloaded_packages
Installing github repo httpuv/master from rstudio
Downloading httpuv.zip from https://github.com/rstudio/httpuv/archive/master.zip
Installing package from /tmp/RtmpwOYYzN/httpuv.zip
arguments 'minimized' and 'invisible' are for Windows only
Installing httpuv
'/Library/Frameworks/R.framework/Resources/bin/R' --vanilla CMD INSTALL
'/private/tmp/RtmpwOYYzN/devtools468716a3aba1/httpuv-master'
--library='/Library/Frameworks/R.framework/Versions/3.0/Resources/library'
--install-tests

  • installing source package 'httpuv' ...
    ** libs
    llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include" -fPIC -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
    /bin/sh: llvm-g++-4.2: command not found
    make: *** [RcppExports.o] Error 127
    ERROR: compilation failed for package 'httpuv'
  • removing '/Library/Frameworks/R.framework/Versions/3.0/Resources/library/httpuv'
    Error: Command failed (1)
    Execution halted

---- end ----

By adding symbolic links from llvm-g++-4.2 to llvm-g++, and similarly for llvm-gcc, he got through the compilation. But then:

---- start ----

** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :

unable to load shared object '/Library/Frameworks/R.framework/Versions/3.0/Resources/library/httpuv/libs/httpuv.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/httpuv/libs/httpuv.so, 6): Symbol not found: __ZN4Rcpp11EnvironmentixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
Referenced from: /Library/Frameworks/R.framework/Versions/3.0/Resources/library/httpuv/libs/httpuv.so
Expected in: flat namespace
in /Library/Frameworks/R.framework/Versions/3.0/Resources/library/httpuv/libs/httpuv.so
Error: loading failed
Execution halted
ERROR: loading failed

---- end ----

Build failing on Mac OSX with clang, clang++

Hi guys,

Building this package from source fails for me with the following output:

(cd base64 && clang++ -g -std=c99 -O3 -Wall -pedantic -fPIC -c base64.cpp -o base64.o)
error: invalid argument '-std=c99' not allowed with 'C++/ObjC++'

This is due to the line in my .R/Makevars with -std=c99; however, I wonder if the intention was to pass CXXFLAGS and/or CPPFLAGS when compiling base64.cpp, rather than CFLAGS in the src/Makevars file.

I note that Makevars.win passes CXXFLAGS and CPPFLAGS as well, when compiling base64.cpp.

httpuv endpoint cannot handle nagios' check_http and apache benchmark (ab) calls.

Hi! By default, connection is not closed on server side during normal processing, you can see it with simples endpoint:
grappa@adel /tmp/httpuv/demo $ curl -v http://127.0.0.1:9876

  • Rebuilt URL to: http://127.0.0.1:9876/
  • Trying 127.0.0.1...
  • Connected to 127.0.0.1 (127.0.0.1) port 9876 (#0)

GET / HTTP/1.1
Host: 127.0.0.1:9876
User-Agent: curl/7.47.0
Accept: /

< HTTP/1.1 200 OK
< Content-Type: text/html
< Content-Length: 3
<

  • Connection #0 to host 127.0.0.1 left intact
    (see last line).

There is no option to force closing connection at the end of response. It could be done by adding "Connection: close" header support in case of HTTP/1.1

Getting the request body

What is the easiest way to get the full binary request body from a http POST/PUT request in httpuv? The rook spec is a bit confusing on the input stream part.

change std::auto_ptr: it's deprecated

Installing/upgrading httpuv fails with clang compiler because

websockets.cpp:217:8: warning: ‘template<class> class std::auto_ptr’ is deprecated
std::auto_ptr<WebSocketProto_IETF> ietf(new WebSocketProto_IETF());    

also on websockets.cpp line#223, with corresponding declaration in websockets.h line#49. Easy to work around, but perhaps you guys had better fix that.

set server response header

I don't think httpuv currently sets a Server response header. Most webservers (apache, nginx, rstudio) set this response header to some fixed value, which can be useful for debugging.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.