Help creating a package with rstan_create_package()

I’ve created a package using rstan_create_package() that I can

  • Successfully build and install locally
  • Successfully build and install from Github

But I use a Mac, and a colleague of mine who is working on Windows runs into the following problem when he tries to build the package

 
"C:/rtools40/mingw32/bin/"g++  -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/gafox/Documents/R/win-library/StanHeaders/include/srcSun Sep 27 16:04:06 2020 " -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DRCPP_PARALLEL_USE_TBB=1 -I'C:/Users/gafox/R/win-library/4.0/BH/include' -I'C:/Users/gafox/R/win-library/4.0/Rcpp/include' -I'C:/Users/gafox/R/win-library/4.0/RcppEigen/include' -I'C:/Users/gafox/Documents/R/win-library/RcppParallel/include' -I'C:/Users/gafox/Documents/R/win-library/rstan/include' -I'C:/Users/gafox/Documents/R/win-library/StanHeaders/include'      Working Directory is: C:/Users/gafox/AppData/Local/Temp/RtmpAdPH5Q/R.INSTALL3cc0c77411b/Hickory/src-i386  --  use setwd(dir) to change it    -DRCPP_PARALLEL_USE_TBB=1Sun Sep 27 16:04:07 2020  Adios  Working Directory is: C:/Users/gafox/AppData/Local/Temp/RtmpAdPH5Q/R.INSTALL3cc0c77411b/Hickory/src-i386  --  use setwd(dir) to change it   -I"C:/Users/gafox/Documents/R/win-library/RcppParallel/include" -D_REENTRANT -DSTAN_THREADS  Sun Sep 27 16:04:07 2020  Adios   -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o
 
sh: -c: line 0: syntax error near unexpected token `('
 
sh: -c: line 0: `"C:/rtools40/mingw32/bin/"g++  -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/gafox/Documents/R/win-library/StanHeaders/include/srcSun Sep 27 16:04:06 2020 " -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DRCPP_PARALLEL_USE_TBB=1 -I'C:/Users/gafox/R/win-library/4.0/BH/include' -I'C:/Users/gafox/R/win-library/4.0/Rcpp/include' -I'C:/Users/gafox/R/win-library/4.0/RcppEigen/include' -I'C:/Users/gafox/Documents/R/win-library/RcppParallel/include' -I'C:/Users/gafox/Documents/R/win-library/rstan/include' -I'C:/Users/gafox/Documents/R/win-library/StanHeaders/include'      Working Directory is: C:/Users/gafox/AppData/Local/Temp/RtmpAdPH5Q/R.INSTALL3cc0c77411b/Hickory/src-i386  --  use setwd(dir) to change it    -DRCPP_PARALLEL_USE_TBB=1Sun Sep 27 16:04:07 2020  Adios  Working Directory is: C:/Users/gafox/AppData/Local/Temp/RtmpAdPH5Q/R.INSTALL3cc0c77411b/Hickory/src-i386  --  use setwd(dir) to change it   -I"C:/Users/gafox/Documents/R/win-library/RcppParallel/include" -D_REENTRANT -DSTAN_THREADS  Sun Sep 27 16:04:07 2020  Adios   -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o'
 
make: *** [C:/PROGRA~1/R/R-40~1.2/etc/i386/Makeconf:229: RcppExports.o] Error 1
ERROR: compilation failed for package 'Hickory'

It looks to me as if somehow this string "Working Directory is: C:/Users/gafox/AppData/Local/Temp/RtmpAdPH5Q/R.INSTALL3cc0c77411b/Hickory/src-i386 – use setwd(dir) to change it " is included in the command to g++, but I don’t have access to a Windows machine to investigate the problem. This is also the first time I’ve tried to create a package using Stan. I’d appreciate any pointers on how to diagnose and cure the problem.

In case it is helpful, here’s a link to the Github repository: https://github.com/kholsinger/Hickory.

Kent

1 Like

UPDATE: My colleague was having problems with some other software on his machine. After a rather extensive cleanup to get that software working, he tried installing again - and it worked. So whatever the problem was, it’s been fixed on his machine. I’d still be interested in knowing whether anyone can identify the source of this error so that if other Windows users encounter it, I can help them fix it.

Kent

1 Like

It was some C++ toolchain thing, which is an ongoing struggle on Windows.

Thanks. If I were still using Windows, I probably could have figured it out, but I moved to Mac about a decade ago.