Problem with Compiling Rinside Examples Under Windows

Error with compiling RInside examples under Windows

The error is very clear: RInside.h: No such file or directory

You need to figure why the -I.... instruction for the RInside header directory does not come through, or whether that directory vanished, or ...

These build instructions are a few years old and reasonably well tested: they generally work.

Problem with compiling RInside examples under Windows

I have a similar setup at work, so I gave this a shot. I'm able to build the examples after I specify R_LIBS_SITE. Note that it must be a Windows path, not a Cygwin path!

export R_LIBS_SITE=c:/R/site-library

Compiling RInside programs on Windows

It fails because you installed R in C:\Program Files\R even though the FAQ for R on Windows tells you not to install R in a path with spaces. See "Question 2.2: How do I install R for Windows":

If you want to be able to build packages from sources, we recommend
that you choose an installation path not containing spaces.

The Rcpp / RInside documentaion repeats that recommendation. Do not install R in a path with spaces. If you must, you have to fix the Makefile to avoid the path expansion from breaking.

Multiple definition error building RInside samples on Windows 7 x64

Is there a reason you do not use the Makefile I supplied and which works? Just say

 make rinside_sample1

which, on my machine, leads to

edd@max:~/svn/rinside/pkg/inst/examples/standard$ make rinside_sample1
g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include \
-I/usr/local/lib/R/site-library/RInside/include -O3 -pipe -g -Wall \
rinside_sample1.cpp -L/usr/lib/R/lib -lR -lblas -llapack \
-L/usr/local/lib/R/site-library/Rcpp/lib \
-lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib \
-L/usr/local/lib/R/site-library/RInside/lib \
-lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib \
-o rinside_sample1
edd@max:~/svn/rinside/pkg/inst/examples/standard$

after which we can do

edd@max:~/svn/rinside/pkg/inst/examples/standard$ ./rinside_sample1
Running ls()
[1] "argv" "M"
Showing M
[,1] [,2] [,3] [,4]
[1,] 0 1 2 3
[2,] 10 11 12 13
[3,] 20 21 22 23
[4,] 30 31 32 33
Showing colSums()
[1] 60 64 68 72
In C++ element 0 is 60
In C++ element 1 is 64
In C++ element 2 is 68
In C++ element 3 is 72
edd@max:~/svn/rinside/pkg/inst/examples/standard$

It works the same on Windows, but you need to do

make -f Makefile.win rinside_sample1

Compiling a program under Windows gives a bunch of error: template with C linkage reports

The problem turned out not to be related to OpenGL, neither to MSYS(2)/MinGW(-w64) or MS Visual Studio 2013.

For anyone who might be facing the same problems as I was, the vast majority of all the error reports was generated because there was a custom windows.h header file present in my project's include path. A header with the same name is present in standard Windows header library and is essential for proper functionality of other libraries.

Lesson learned: never try to name a file with system-specific code after the operating system.

HAVE_UINTPTR_T defined both in RInside.h and R.h

That was indeed a new warning with R 3.4.0, but it is now suppressed following this commit to the master branch:

edd@max:~/git/rinside(master)$ R CMD INSTALL .
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘RInside’ ...
** libs
ccache g++ -I/usr/share/R/include -DNDEBUG -I. -I../inst/include/
-I"/usr/local/lib/R/site-library/Rcpp/include"
-fpic -g -O2 -fstack-protector-strong
-Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g
-O3 -Wall -pipe -Wno-unused -pedantic -Wextra -Wno-deprecated-declarations
-c MemBuf.cpp -o MemBuf.o
ccache g++ -I/usr/share/R/include -DNDEBUG -I. -I../inst/include/
-I"/usr/local/lib/R/site-library/Rcpp/include"
-fpic -g -O2 -fstack-protector-strong
-Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g
-O3 -Wall -pipe -Wno-unused -pedantic -Wextra -Wno-deprecated-declarations
-c RInside.cpp -o RInside.o
g++ -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro
-o RInside.so MemBuf.o RInside.o -L/usr/lib/R/lib -lR
g++ -o libRInside.so MemBuf.o RInside.o -Wl,-S -shared -Wl,-Bsymbolic-functions
-Wl,-z,relro -L/usr/lib/R/lib -lR
ar qc libRInside.a MemBuf.o RInside.o
cp libRInside.so ../inst/lib
cp libRInside.a ../inst/lib
rm libRInside.so libRInside.a
installing to /usr/local/lib/R/site-library/RInside/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (RInside)
edd@max:~/git/rinside(master)$ git pu
Fetching origin
Already up-to-date.
edd@max:~/git/rinside(master)$

Compilation errors while compiling V8 engine on Windows 10 with MSVC

I encountered the same problem, and I solved it like this:

  1. Download the visual studio 2019 installer, and install vs2019, notice that no need to check the Windows SDK item as it's not the point and no need to reinstall/add a new version of Windows SDK. And, vs2019 could exists along with vs2022.
  2. Switch to vs2019 compile environment: Open a new Windows Terminal tab, and execute command:
> set vs2019_install=[path to your \Microsoft Visual Studio\2019\Community]
> set WINDOWSSDKDIR=[path to your \Windows Kits\10]
> set DEPOT_TOOLS_WIN_TOOLCHAIN=0
> gclient sync


  1. OK, you could build v8 with vs2019 now:
> python tools\dev\gm.py x64.release

Hope this helps.



Related Topics



Leave a reply



Submit