Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install fails when .Rprofile prints to console #47

Closed
jrowen opened this issue Apr 27, 2015 · 2 comments · Fixed by #66
Closed

Install fails when .Rprofile prints to console #47

jrowen opened this issue Apr 27, 2015 · 2 comments · Fixed by #66

Comments

@jrowen
Copy link

jrowen commented Apr 27, 2015

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.

@wch
Copy link
Collaborator

wch commented Apr 27, 2015

It's probably because of this line:
https://github.com/rstudio/httpuv/blob/5b02e6e/src/Makevars#L9

If you have a cat statement in your .Rprofile, then every time R or Rscript is invoked, it'll print that message to the screen. I suggest modifying your .Rprofile so that the cat is only run in interactive sessions. For example:

if (interactive()) {
  cat('text')
}

@jrowen
Copy link
Author

jrowen commented Apr 27, 2015

I wasn't aware of the interactive function--I'll make the update, thanks.

It also looks like Rcpp:::LdFlags() is deprecated in Rcpp v0.11.5 and returns "", so the Rscript command may no longer be needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants