rdotnet/rClr

Installation problems on Windows 10

woodwards opened this issue · 10 comments

I'm struggling to install rClr. I have R-3.4.4 and I installed Open Mono x86. I'm on Windows 10. I have Visual Studio 2017 CE with MVC++ 2017 and C# Tools. Do I need MikTex too? This is the closest I've got:

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\WoodwardS>cd C:\Users\WoodwardS\Downloads\rClr-0.7-4\

C:\Users\WoodwardS\Downloads\rClr-0.7-4>set R="C:\R\R-3.4.4\bin\R.exe"

C:\Users\WoodwardS\Downloads\rClr-0.7-4>set BuildConfiguration=Release

C:\Users\WoodwardS\Downloads\rClr-0.7-4>set MonoBuildConfiguration=MonoInstall

C:\Users\WoodwardS\Downloads\rClr-0.7-4>%R% CMD INSTALL rClr-0.7-4
In R CMD INSTALL
* installing to library 'C:/Users/WoodwardS/Documents/R/win-library/3.4'
* installing *source* package 'rClr' ...
note: removing existing ./src/Makevars
note: removing existing ./src/rClr.props
warning: Path to the Mono SDK not found by querying the Windows registry. Mono support will be disabled
R_HOME=C:/R/R-3.4.4
note: No VS120COMNTOOLS or VS110COMNTOOLS environment variable. Build will be made with gcc, Mono and xbuild
Created ./src/Makevars
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture

R_ARCH=/x64
OBJECTS=rClrMono.o
SHLIB_EXT=.dll
CC=C:/Rtools/3.4/mingw_64/bin/gcc
gcc -std=c++11 -I"C:/R/R-3.4.4/include" -DNDEBUG       -mms-bitfields -mwindows -I"not found/include/mono-2.0" -I"not found/include/glib-2.0" -I"not found/lib/glib-2.0/include" -D MONO_CLR -D MONO_INST   -O2 -Wall  -std=gnu99 -mtune=generic -c rClr.cpp -o rClrMono.o -lsupc++
cc1plus.exe: warning: command line option '-std=gnu99' is valid for C/ObjC but not for C++
In file included from rClr.cpp:1:0:
rClr.h:32:27: fatal error: mono/jit/jit.h: No such file or directory
 #include <mono/jit/jit.h>
                           ^
compilation terminated.
make: *** [rClrMono.o] Error 1
Warning: running command 'make -f "Makevars" -f "C:/R/R-3.4.4/etc/x64/Makeconf" -f "C:/R/R-3.4.4/share/make/winshlib.mk" -f "C:\Users\WoodwardS\Documents/.R/Makevars" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="rClr.dll" WIN=64 TCLBIN=64 ' had status 2
ERROR: compilation failed for package 'rClr'
* removing 'C:/Users/WoodwardS/Documents/R/win-library/3.4/rClr'

C:\Users\WoodwardS\Downloads\rClr-0.7-4>

Which version of mono are you using?

mono -version

I don't think this package has worked with mono for the past three years though your error message suggests it's a linking issue. It installs perfectly fine on Windows without mono but if you have to use it then I'd try reverting back to version 3.12.

mono-5.10.0.160-gtksharp-2.12.45-win32-0.msi

Hm, maybe this is too technical for me. I just installed Mono because the instructions said to, I don't really know what it is. A kind of virtual machine?

I can't find build instructions for .Net rather than Mono.

mono is a cross-platform port of .NET for Linux/macOS developers. If your work is on a Windows machine then it's much easier to stick with the native .NET framework. Since you've already got Visual Studio and C# Tools everything on that side is installed already.

Seeing as you're installing from source, you'll need Rtools and then just call R CMD INSTALL without setting the mono build configuration. rClr will install with .NET if you don't set this beforehand.

You can also bypass all of this by installing the Windows pre-compiled binary:

devtools::install_url("https://github.com/ruaridhw/rClr/blob/windows-binary/rClr_0.7-4.zip", type = "win.binary")

I have RTools but it still doesn't install. From the command line:

C:\Users\WoodwardS>cd C:\Users\WoodwardS\Downloads\rClr-0.7-4\

C:\Users\WoodwardS\Downloads\rClr-0.7-4>set R="C:\R\R-3.4.4\bin\R.exe"

C:\Users\WoodwardS\Downloads\rClr-0.7-4>%R% CMD INSTALL rClr-0.7-4
In R CMD INSTALL
* installing to library 'C:/Users/WoodwardS/Documents/R/win-library/3.4'
* installing *source* package 'rClr' ...
note: removing existing ./src/Makevars
note: removing existing ./src/rClr.props
warning: Path to the Mono SDK not found by querying the Windows registry. Mono support will be disabled
R_HOME=C:/R/R-3.4.4
note: No VS120COMNTOOLS or VS110COMNTOOLS environment variable. Build will be made with gcc, Mono and xbuild
Created ./src/Makevars
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture

R_ARCH=/x64
OBJECTS=rClrMono.o
SHLIB_EXT=.dll
CC=C:/Rtools/3.4/mingw_64/bin/gcc
gcc -std=c++11 -I"C:/R/R-3.4.4/include" -DNDEBUG       -mms-bitfields -mwindows -I"not found/include/mono-2.0" -I"not found/include/glib-2.0" -I"not found/lib/glib-2.0/include" -D MONO_CLR -D MONO_INST   -O2 -Wall  -std=gnu99 -mtune=generic -c rClr.cpp -o rClrMono.o -lsupc++
cc1plus.exe: warning: command line option '-std=gnu99' is valid for C/ObjC but not for C++
In file included from rClr.cpp:1:0:
rClr.h:32:27: fatal error: mono/jit/jit.h: No such file or directory
 #include <mono/jit/jit.h>
                           ^
compilation terminated.
make: *** [rClrMono.o] Error 1
Warning: running command 'make -f "Makevars" -f "C:/R/R-3.4.4/etc/x64/Makeconf" -f "C:/R/R-3.4.4/share/make/winshlib.mk" -f "C:\Users\WoodwardS\Documents/.R/Makevars" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="rClr.dll" WIN=64 TCLBIN=64 ' had status 2
ERROR: compilation failed for package 'rClr'
* removing 'C:/Users/WoodwardS/Documents/R/win-library/3.4/rClr'

C:\Users\WoodwardS\Downloads\rClr-0.7-4>

Looks like the VS environment variables are not set correctly?

From R;

> devtools::install_url("https://github.com/ruaridhw/rClr/blob/windows-binary/rClr_0.7-4.zip", type = "win.binary")
Downloading package from url: https://github.com/ruaridhw/rClr/blob/windows-binary/rClr_0.7-4.zip
Installation failed: utils::unzip(src, list = TRUE) : zip file 'C:\Users\WOODWA~1\AppData\Local\Temp\Rtmp4I7LJT\file2ec814c211d6.zip' cannot be opened
Warning message:
In utils::unzip(src, exdir = target) : error 1 in extracting from zip file
> 

Ok, try downloading the binary zip file and run

install.packages("path/to/rClr_0.7-4.zip", repos = NULL)

I assume the underscore is a typo?

install.packages("path/to/rClr-0.7-4.zip", repos = NULL)

This ran without errors but didn't install the package.

> install.packages("C:\\Users\\WoodwardS\\Downloads\\rClr-0.7-4.zip", repos = NULL)
Installing package into ‘C:/Users/WoodwardS/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
> library(rClr)
Error in library(rClr) : there is no package called ‘rClr’
> 
> install.packages("C:\\Users\\WoodwardS\\Downloads\\rClr-0.7-4.zip")
Installing package into ‘C:/Users/WoodwardS/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘C:\Users\WoodwardS\Downloads\rClr-0.7-4.zip’ is not available (for R version 3.4.4)
> 

Hey all!
I am facing exactly the same issue here. Did you find a way?

No, I gave up on C#, sticking with C++ which is so easy in R.

@rbalestro, running this code has worked for myself in the past provided Mono 3 is installed. Again, if using Windows 10 and you don't need to use mono, then the standard installation procedure is much more stable.