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

Unable to install nvimcom from Vim (Windows, non-admin user) #130

Closed
jawhiteley opened this issue Nov 29, 2016 · 4 comments
Closed

Unable to install nvimcom from Vim (Windows, non-admin user) #130

jawhiteley opened this issue Nov 29, 2016 · 4 comments

Comments

@jawhiteley
Copy link

I am trying to get Nvim-R to work on my work computer (Windows 7, 64-bit), without admin rights.

I managed to extract both R and gVim (to ~/AppData/Local/Programs/). I also installed Rtools, and edited the PATH variable for my account; I even manually added the path to Rtools to the PATH in R via .Rprofile for the user.

When I try to launch R from gVim, installation of nvimcom always fails. There are two errors in the log:

*** arch - x64
c:/Rtools/mingw_64/bin/gcc  -I"C:/Users/USERNAME/AppData/Local/Programs/R/R-3.3.2/include" -DNDEBUG     -I"d:/Compiler/gcc-4.9.3/local330/include"  -D`C:/Users/USERNAME/AppData/Local/Programs/R/R-3.3.2/bin/R --slave -e 'cat(Sys.info()[[1]])'` -DLWS_NO_FORK  -DWIN32   -O2 -Wall  -std=gnu99 -mtune=core2 -c nvimcom.c -o nvimcom.o
**** Loaded Rprofile ****
c:/Rtools/mingw_64/bin/gcc -shared -s -static-libgcc -o nvimcom.dll tmp.def nvimcom.o -lWs2_32 -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/Users/USERNAME/AppData/Local/Programs/R/R-3.3.2/bin/x64 -lR
(cd apps; make -f Makefile.win)
make[1]: Entering directory `/cygdrive/c/Users/USERNAME/AppData/Local/Temp/1/Rtmp2ftmlB/R.INSTALL268220b6a96/nvimcom/src-x64/apps'
gcc -m64 -mwindows -std=gnu99 -O3 -Wall -DWIN32 nclientserver.c -o nclientserver.exe -lWs2_32
nclientserver.c:1:0: sorry, unimplemented: 64-bit mode not compiled in
 #include <stdio.h>
 ^
make[1]: *** [nclientserver.exe] Error 1
make[1]: Leaving directory `/cygdrive/c/Users/USERNAME/AppData/Local/Temp/1/Rtmp2ftmlB/R.INSTALL268220b6a96/nvimcom/src-x64/apps'
make: *** [nvimapps] Error 2
Warning: running command 'make -f "Makevars.win" -f "C:/Users/USERNAME/AppData/Local/Programs/R/R-3.3.2/etc/x64/Makeconf" -f "C:/Users/USERNAME/AppData/Local/Programs/R/R-3.3.2/share/make/winshlib.mk" SHLIB="nvimcom.dll" WIN=64 TCLBIN=64 OBJECTS="nvimcom.o"' had status 2
ERROR: compilation failed for package 'nvimcom'

I notice that under *** arch - i386, everything seems to work fine. The errors are under *** arch - x64

Is there a way to install nvimcom without needing Rtools or admin rights? It would be so much easier if this could be done by install.packages("nvimcom") (although I recognize that this would be extra work for the developer).

@jalvesaq
Copy link
Owner

This might be useful: #100

@jawhiteley
Copy link
Author

jawhiteley commented Nov 30, 2016

Thanks for the link. I actually found a slightly simpler and more effective fix, after reading the following Stack Overflow posts:
http://stackoverflow.com/questions/18114308/getting-g-error-when-installing-r-code-from-source
http://stackoverflow.com/questions/9669660/win64-compiling-package-from-source-sorry-unimplemented-64-bit-mode-not-comp

I think you were correct in the previous issue in that there was an incompatibility between Rtools and R.
The Stack Overflow answers suggest that changing the system PATH variable should correct the problem by pointing to the appropriate version of gcc, to match the architecture of the version of R that the package is being built for.

Here is what I did, in case it helps anyone else in a similar situation:

My problem is that I cannot change the system PATH, as I do not have admin rights. I changed my user PATH (click Start > type "environment" and select "Edit environment variables for your account"), and added the paths to my local (user) installation of Rtools:

C:\Users\USERNAME\AppData\Local\Programs\Rtools\bin;
C:\Users\USERNAME\AppData\Local\Programs\Rtools\gcc-4.6.3\bin

Note: the second one is NOT the default suggested by Rtools during installation (\Rtools\mingw_32\bin, which is likely 32-bit only); this answer suggested the alternative above, which seems to support both 32-bit and 64-bit versions of R.

Changing the user PATH may not be enough, however (see Stack Overflow posts linked above). I noticed that in R, Sys.getenv('PATH') (or the prettier Sys.getenv()['PATH']) returns the system PATH, not my user PATH. So, I manually added the appropriate paths to the beginning of the PATH environment variable directly in R, via my user account's .Rprofile file (this might better fit in a Rprofile.site file, but I have never felt the need to use one yet):

## Add Rtools to PATH within R
Sys.setenv(PATH=paste0("C:\\Users\\jwhiteley\\AppData\\Local\\Programs\\Rtools\\bin;\nC:\\Users\\jwhiteley\\AppData\\Local\\Programs\\Rtools\\gcc-4.6.3\\bin;", Sys.getenv('PATH')))

I have no idea if that is sane or sensible, but it seemed to work! I opened a new window with an Rscript in gVim, typed \rf to start an R session, and nvimcom was successfully installed. A 32-bit R console opened up, and things are working as expected.

I hope that helps.

@jalvesaq
Copy link
Owner

Thanks for the feedback. It will be useful for other people.

@jalvesaq
Copy link
Owner

jalvesaq commented Dec 2, 2016

I improved the detection of causes of errors when building nvimcom on Windows: 3fd0793

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

No branches or pull requests

2 participants