1

I needed to install Rtools in a non-default directory because the Windows system that I'm using restores the C drive to an original image after a reboot. This image includes R 3.3 and R studio.

After setting the PATH environment variable without admin privileges using the setx /M PATH "%PATH%;foo/bar/bin;foo/bar/compiler/bin" command, I tested whether the compiler was accessible in R using: system('g++ -v'). This worked - success!

... except, when I compile a Stan model using the brms package in R I get the following error:

  Compilation ERROR, function(s)/method(s) not created! c:/Rtools/mingw_64/bin/g++: not found

I can get the model to compile if I copy the mingw_64 directory to a c:/Rtools directory, but this is a large folder and takes some time (~4 mins). Unfortunately I can't simply create a shortcut or symbolic link to the Rtools directory because I don't have admin privileges.

Is this default directory hardcoded into Stan? I had a brief look at the code on GitHub and couldn't see anything to that effect.

Are there other environment variables ect. that I need to set? Alternatively, do you have other ideas for a workaround?

Simon
  • 675
  • 1
  • 6
  • 15

1 Answers1

1

You have to amend the configuration instructions from cat('Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")', file = file.path(Sys.getenv("HOME"), ".Rprofile"), sep = "\n", append = TRUE) to whatever directory your Rtools is in.

Ben Goodrich
  • 4,870
  • 1
  • 19
  • 18
  • To state the obvious for others: replace `C:/Rtools/...` with the path to your Rtools. You may need a short name version of your path. If so, use this [link](https://stackoverflow.com/questions/4051088/get-dos-path-instead-of-windows-path) i.e. something to this effect `for %I in (.) do echo %~sI` – Simon Jan 03 '18 at 22:20