Hi Jonah, thanks for your reply! Here are the replies to your points:
1:
> .libPaths()
[1] "C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library"
> ip <- installed.packages()
> ip[ip[, "Package"] %in% c("rstan", "StanHeaders"), c("Package", "Version", "LibPath"), drop = FALSE]
Package Version
rstan "rstan" "2.32.7"
StanHeaders "StanHeaders" "2.39.1"
LibPath
rstan "C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library"
StanHeaders "C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library"
> Sys.getenv("PKG_CPPFLAGS")
[1] ""
> tools::makevars_user()
character(0)
> pkgbuild::has_build_tools(debug = TRUE)
Trying to compile a simple C fileRunning "C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/bin/x64/Rcmd.exe" SHLIB foo.c
using C compiler: 'gcc.exe (GCC) 14.3.0'
gcc -I"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/include" -DNDEBUG -I"C:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -std=gnu2x -mfpmath=sse -msse2 -mstackrealign -c foo.c -o foo.o
gcc -shared -s -static-libgcc -o foo.dll tmp.def foo.o -LC:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools45/x86_64-w64-mingw32.static.posix/lib -LC:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/bin/x64 -lR
[1] TRUE
Successfully removed and reinstalled rstan and StanHeader (just copy-pasting what you recommended above). Then restarting R, the checks gave this:
> packageVersion("rstan"); packageVersion("StanHeaders") # both should be 2.39.0.9000
[1] ‘2.32.7’
[1] ‘2.39.1’
so this is not what you want, apparently.
Defining my stan command and trying to set up the model, the error is still there. The environment of the output around the two error lines:
86 : "constrained_param_names",
487 : &rstan::stan_fit<stan_model,
488 : boost::random::ecuyer1988>::constrained_param_names)
489 : .method("standalone_gqs",
490 : &rstan::stan_fit<stan_model,
491 : boost::random::ecuyer1988>::standalone_gqs);
492 : }
493 :
494 :
495 : // declarations
496 : extern "C" {
497 : SEXP file28205bfd47f9( ) ;
498 : }
499 :
500 : // definition
501 : SEXP file28205bfd47f9() {
502 : return Rcpp::wrap("anon_model");
503 : }
make cmd is
make -f "C:/Users/RDSUEV~1/AppData/Local/Programs/R/R-45~1.3/etc/x64/Makeconf" -f "C:/Users/RDSUEV~1/AppData/Local/Programs/R/R-45~1.3/share/make/winshlib.mk" CXX='$(CXX17) $(CXX17STD)' CXXFLAGS='$(CXX17FLAGS)' CXXPICFLAGS='$(CXX17PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX17LDFLAGS)' SHLIB_LD='$(SHLIB_CXX17LD)' SHLIB="file28205bfd47f9.dll" WIN=64 TCLBIN= OBJECTS="file28205bfd47f9.o"
make would use
g++ -std=gnu++17 -I"C:/Users/RDSUEV~1/AppData/Local/Programs/R/R-45~1.3/include" -DNDEBUG -I"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/Rcpp/include/" -I"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppEigen/include/" -I"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppEigen/include/unsupported" -I"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/BH/include" -I"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/StanHeaders/include/src/" -I"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/StanHeaders/include/" -I"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/include/" -DRCPP_PARALLEL_USE_TBB=1 -DTBB_INTERFACE_NEW -IC:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/include -I"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DUSE_STANC3 -DSTRICT_R_HEADERS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -D_HAS_AUTO_PTR_ETC=0 -include "C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/StanHeaders/include/stan/math/prim/fun/Eigen.hpp" -std=c++1y -I"C:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c file28205bfd47f9.cpp -o file28205bfd47f9.o
if test "zfile28205bfd47f9.o" != "z"; then \
if test -e "file28205bfd47f9-win.def"; then \
echo g++ -shared -s -static-libgcc -o file28205bfd47f9.dll file28205bfd47f9-win.def file28205bfd47f9.o "C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/rstan/lib/x64/libStanServices.a" -L"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/lib/x64" -ltbb -LC:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/libs/x64 -lRcppParallel -LC:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"C:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools45/x86_64-w64-mingw32.static.posix/lib" -L"C:/Users/RDSUEV~1/AppData/Local/Programs/R/R-45~1.3/bin/x64" -lR ; \
g++ -shared -s -static-libgcc -o file28205bfd47f9.dll file28205bfd47f9-win.def file28205bfd47f9.o "C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/rstan/lib/x64/libStanServices.a" -L"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/lib/x64" -ltbb -LC:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/libs/x64 -lRcppParallel -LC:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"C:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools45/x86_64-w64-mingw32.static.posix/lib" -L"C:/Users/RDSUEV~1/AppData/Local/Programs/R/R-45~1.3/bin/x64" -lR ; \
else \
echo EXPORTS > tmp.def; \
nm file28205bfd47f9.o | sed -n 's/^.* [BCDRT] / /p' | sed -e '/[.]refptr[.]/d' -e '/[.]weak[.]/d' | sed 's/[^ ][^ ]*/"&"/g' >> tmp.def; \
echo g++ -shared -s -static-libgcc -o file28205bfd47f9.dll tmp.def file28205bfd47f9.o "C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/rstan/lib/x64/libStanServices.a" -L"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/lib/x64" -ltbb -LC:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/libs/x64 -lRcppParallel -LC:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"C:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools45/x86_64-w64-mingw32.static.posix/lib" -L"C:/Users/RDSUEV~1/AppData/Local/Programs/R/R-45~1.3/bin/x64" -lR ; \
g++ -shared -s -static-libgcc -o file28205bfd47f9.dll tmp.def file28205bfd47f9.o "C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/rstan/lib/x64/libStanServices.a" -L"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/lib/x64" -ltbb -LC:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/libs/x64 -lRcppParallel -LC:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"C:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools45/x86_64-w64-mingw32.static.posix/lib" -L"C:/Users/RDSUEV~1/AppData/Local/Programs/R/R-45~1.3/bin/x64" -lR ; \
rm -f tmp.def; \
fi \
fi
ERROR(s) during compilation: source code errors or compiler configuration errors!
....
436: RCPP_MODULE(stan_fit4model28205ed14161__mod) {
437: class_<rstan::stan_fit<stan_model, boost::random::ecuyer1988> >(
438: "stan_fit4model28205ed14161_")
439:
440: .constructor<SEXP, SEXP, SEXP>()
441:
442: .method(
443: "call_sampler",
444: &rstan::stan_fit<stan_model, boost::random::ecuyer1988>::call_sampler)
445: .method(
446: "param_names",
447: &rstan::stan_fit<stan_model, boost::random::ecuyer1988>::param_names)
448: .method("param_names_oi",
449: &rstan::stan_fit<stan_model,
450: boost::random::ecuyer1988>::param_names_oi)
451: .method("param_fnames_oi",
452: &rstan::stan_fit<stan_model,
453: boost::random::ecuyer1988>::param_fnames_oi)
454: .method(
455: "param_dims",
456: &rstan::stan_fit<stan_model, boost::random::ecuyer1988>::param_dims)
457: .method("param_dims_oi",
458: &rstan::stan_fit<stan_model,
459: boost::random::ecuyer1988>::param_dims_oi)
460: .method("update_param_oi",
461: &rstan::stan_fit<stan_model,
462: boost::random::ecuyer1988>::update_param_oi)
463: .method("param_oi_tidx",
464: &rstan::stan_fit<stan_model,
465: boost::random::ecuyer1988>::param_oi_tidx)
466: .method("grad_log_prob",
467: &rstan::stan_fit<stan_model,
468: boost::random::ecuyer1988>::grad_log_prob)
469: .method("log_prob",
470: &rstan::stan_fit<stan_model, boost::random::ecuyer1988>::log_prob)
471: .method("unconstrain_pars",
472: &rstan::stan_fit<stan_model,
473: boost::random::ecuyer1988>::unconstrain_pars)
474: .method("constrain_pars",
475: &rstan::stan_fit<stan_model,
476: boost::random::ecuyer1988>::constrain_pars)
477: .method(
478: "num_pars_unconstrained",
479: &rstan::stan_fit<stan_model,
480: boost::random::ecuyer1988>::num_pars_unconstrained)
481: .method(
482: "unconstrained_param_names",
483: &rstan::stan_fit<
484: stan_model, boost::random::ecuyer1988>::unconstrained_param_names)
485: .method(
486: "constrained_param_names",
487: &rstan::stan_fit<stan_model,
488: boost::random::ecuyer1988>::constrained_param_names)
489: .method("standalone_gqs",
490: &rstan::stan_fit<stan_model,
491: boost::random::ecuyer1988>::standalone_gqs);
492: }
493:
494:
495: // declarations
496: extern "C" {
497: SEXP file28205bfd47f9( ) ;
498: }
499:
500: // definition
501: SEXP file28205bfd47f9() {
502: return Rcpp::wrap("anon_model");
503: }
Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) :
bine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >]'
22 | return 0.5 * z.p.transpose() * z.inv_e_metric_ * z.p;
C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/StanHeaders/include/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp:21:0: required from here
21 | double T(dense_e_point& z) {
C:/Users/RDSuevegMa/AppData/Local/Programs/R/R-4.5.3/library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:654:74: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits<double>::type' {aka '__m128d'} [-Wignored-attributes]
654 | return internal::first_aligned<int(unpacket_traits<DefaultPacketType>::alignment),Derived>(m);
| ^~~~~~~~~
make: *** [C:/Users/RDSUEV~1/AppData/Local/Programs/R/R-45~1.3/etc/x64/Makeconf:302: file28205bfd47f9.o
Hope this is sufficient, let me know if you need anything else from the output.