realised that about a second after posting ;)
[1] “C:/Users/Driver/Documents/R/win-library/4.0/rstan/lib/i386/libStanServices.a”
[2] “C:/Users/Driver/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a”
realised that about a second after posting ;)
[1] “C:/Users/Driver/Documents/R/win-library/4.0/rstan/lib/i386/libStanServices.a”
[2] “C:/Users/Driver/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a”
OK. That is weird, but then again this whole thread is. When you do
library(rstan)
example(stan_model, run.dontrun = TRUE)
and it gets to the “Compilation arguments” section, does the linker statement have something like -L"C:/Users/Driver/Documents/R/win-library/4.0/rstan/lib/x64/"?
It doesn’t seem to:
Compilation argument:
C:/PROGRA~1/R/R-4.0.2/bin/x64/R CMD SHLIB file31847ef54a24.cpp 2> file31847ef54a24.cpp.err.txt
“C:/rtools40/mingw64/bin/“g++ -std=gnu++14 -I"C:/PROGRA~1/R/R-4.0.2/include” -DNDEBUG -I"C:/Users/Driver/Documents/R/win-library/4.0/Rcpp/include/” -I"C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/unsupported" -I"C:/Users/Driver/Documents/R/win-library/4.0/BH/include" -I"C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/" -I"C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include “C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp” -std=c++1y -Wno-ignored-attributes -march=core2 -include C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp -I “C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include” -I “C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include” -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -O3 -mtune=native -march=native -O3 -mtune=native -march=native -c file31847ef54a24.cpp -o file31847ef54a24.o
COMPILING THE C++ CODE FOR MODEL ‘73fc79f8b1915e8208c736914c86d1a1’ NOW.
OS: x86_64, mingw32; rstan: 2.21.1; Rcpp: 1.0.5; inline: 0.3.15setting environment variables:
PKG_LIBS = C:/Users/Driver/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a -L"C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/lib/x64" -ltbb
PKG_CPPFLAGS = -I"C:/Users/Driver/Documents/R/win-library/4.0/Rcpp/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/unsupported" -I"C:/Users/Driver/Documents/R/win-library/4.0/BH/include" -I"C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/" -I"C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include “C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp” -std=c++1y
What is the next line after
...
file31847ef54a24.cpp -o file31847ef54a24.o
?
I can’t find file31847ef54a24.cpp in the output?
It will be a different filename each time, but it is whatever is after the end of what you posted previously
I was looking for
C:/rtools40/mingw64/bin/g++ -shared -s -static-libgcc -o file31846453fbf.dll tmp.def file31846453fbf.o -LC:/PROGRA~1/R/R-4.0.2/bin/x64 -lR
which is the same as what @andrjohns got. It can be worked around by doing
but we still don’t know why PKG_LIBS is not working in the first place.
Doesn’t work. Gist is updated with output.
Maybe
Sys.setenv(LOCAL_LIBS = paste(
shQuote('C:/R/win-library/4.0/rstan/lib/x64/libStanServices.a'),
"-L", shQuote('C:/R/win-library/4.0/StanHeaders/libs/x64'),
" -lStanHeaders -L", shQuote('C:/R/win-library/4.0/RcppParallel/lib/x64'),
" -ltbb"))
?
?
Still get:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! g++.exe: error: C:/R/win-library/4.0/rstan/lib/x64/libStanServices.a: No such file or directory
pm’d you in case it’s helpful.
OK. @Charles_Driver and I have likely tracked down the problem over Zoom.
The solution has to go into rstan. I’ll have binaries on winbuilder to test with in about an hour.
thank you!!
@andrjohns @Charles_Driver @JacobCoblentz
In a clean R session without any old stanfit objects being autoloaded, try doing
install.packages(
"https://win-builder.r-project.org/8bPDZPDG0522/rstan_2.21.2.zip",
repos = NULL, type = "win.binary")
then
example(stan_model, package = "rstan", run.dontrun = TRUE)
plus whatever examples were not working before.
yes, seems to be working now :)
works perfectly!
@bgoodri
Hi, thank you! However, a new error comes up.
Error: package or namespace load failed for ‘rstan’ in inDL(x, as.logical(local), as.logical(now), …):
unable to load shared object ‘C:/Users/Ihn-Whi Heo/Documents/R/win-library/3.6/rstan/libs/x64/rstan.dll’:
LoadLibrary failure: 지정된 프로시저를 찾을 수 없습니다 (cannot find the allocated procedure).
In addition: Warning message:
package ‘rstan’ was built under R version 4.0.2
What should I do?
Do you know what 지정된 프로시저를 찾을 수 없습니다 says in English?
Sure. That means “cannot find the allocated procedure”