0

I run R-4.1.2 on a Windows 10 system with R-Studio 2022.12.0. I wanted to update several R packages, but some of them need to be compiled from source. I use Rtools 4.0 for some time now and never had any problems.

With install.packages("ranger", type = "source") I initiated the update, and after many compiler messages the process stopped with an error, and I read:

"C:/rtools40/mingw32/bin/"g++ -std=gnu++11  -I"C:/R-41~1.2/include" -DNDEBUG -DR_BUILD -DWIN_R_BUILD -I'C:/R-4.1.2/library/Rcpp/include' -I'C:/BITrusted/R-4.1.2/library/RcppEigen/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c Forest.cpp -o Forest.o
Forest.cpp: In member function 'std::unique_ptr<ranger::Data> ranger::Forest::loadDataFromFile(const string&)':
Forest.cpp:850:19: error: 'make_unique' is not a member of 'std'
     result = std::make_unique<DataDouble>();
                   ^~~~~~~~~~~
Forest.cpp:850:19: note: 'std::make_unique' is defined in header '<memory>'; did you forget to '#include <memory>'?
Forest.cpp:26:1:
+#include <memory>
 
Forest.cpp:850:19:
     result = std::make_unique<DataDouble>();

It looks like some dependencies don't match. make_unique is defined in unique_ptr.h, but I don't know how to make Rtools import this header. I reinstalled Rtools, checked the system variables, run from console and R-Studio. Any ideas? I should mention, that there are only a few packages that show me this error. Many others were compiled without any problems.

Stefan L.
  • 65
  • 10
  • That template is defined in `` as the message says, and that header is imported. So this shouldn't have happened, and it looks like a bug somewhere. Why not update to R 4.2.3 or 4.3.0, which use newer Rtools? – user2554330 May 08 '23 at 09:46
  • … As the error message correctly states, `unique_ptr` is defined in the standard header `memory`, *not* in `unique_ptr.h` (which is not a standard header). – Konrad Rudolph May 08 '23 at 09:46
  • It's possible that you're not installing the current version of `ranger` (which is 0.15.1) because of a dependency on a newer version of R, or a CRAN mirror that's not up to date. – user2554330 May 08 '23 at 09:59
  • Updating is a little tricky, because I run R on a company system. I want to stay at 4.1.2. The target ranger version is 0.15.1, so this is not the problem. Is it possible, that the newest ranger sources don't compile on an old R or Rtools? – Stefan L. May 08 '23 at 11:31

0 Answers0