ecmerkle / blavaan

An R package for Bayesian structural equation modeling
https://ecmerkle.github.io/blavaan
87 stars 23 forks source link

package install on windows #17

Closed vankesteren closed 5 years ago

vankesteren commented 5 years ago

Current version of blavaan only installs on windows using the command

remotes::install_github("ecmerkle/blavaan", INSTALL_opts = "--no-multiarch")

and Rcpp needs to be built on the current version of R. When the --no-multiarch option is not set, R complains that no DLL was created. I don't know enough about this stuff to give good recommendations, but this workaround may help some people until the makevars.win file is edited appropriately!

ecmerkle commented 5 years ago

Thanks, I will add that later today. My windows testing is restricted to the win-builder service, so it is good to get windows feedback.

ecmerkle commented 5 years ago

Could you give it a try and see if this addresses the issue? (maybe the --no-multiarch thing is only needed when installing via devtools?)

vankesteren commented 5 years ago

Yeah, devtools / remotes does not look at the .Rproj file, so this does not help with that.

Here's the full output (without the --no-multiarch option)

* installing *source* package 'blavaan' ...
** using staged installation
** libs

*** arch - i386
"C:/PROGRA~1/R/R-36~1.0/bin/i386/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/stanmarg.stan
Wrote C++ file "stan_files/stanmarg.cc"
C:\\Rtools\\mingw_64\\bin\\g++ -std=c++1y  -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG -I"../inst/include" -I"`"C:/PROGRA~1/R/R-36~1.0/bin/i386/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"`" -I"`"C:/PROGRA~1/R/R-36~1.0/bin/i386/Rscript" --vanilla -e "cat(system.file('include', 'boost_not_in_BH', package = 'rstan'))"`" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_NO_CXX11_RVALUE_REFERENCES -I"C:/Users/erikj/Documents/R/win-library/3.6/StanHeaders/include" -I"C:/Users/erikj/Documents/R/win-library/3.6/rstan/include" -I"C:/Users/erikj/Documents/R/win-library/3.6/BH/include" -I"C:/Users/erikj/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/erikj/Documents/R/win-library/3.6/RcppEigen/include"        -O3 -c stan_files/stanmarg.cc -o stan_files/stanmarg.o
In file included from C:/Users/erikj/Documents/R/win-library/3.6/BH/include/boost/random/detail/integer_log2.hpp:19:0,
                 from C:/Users/erikj/Documents/R/win-library/3.6/BH/include/boost/random/detail/large_arithmetic.hpp:19,
                 from C:/Users/erikj/Documents/R/win-library/3.6/BH/include/boost/random/detail/const_mod.hpp:23,
                 from C:/Users/erikj/Documents/R/win-library/3.6/BH/include/boost/random/linear_congruential.hpp:30,
                 from C:/Users/erikj/Documents/R/win-library/3.6/BH/include/boost/random/additive_combine.hpp:27,
                 from C:/Users/erikj/Documents/R/win-library/3.6/rstan/include/rstan/stan_fit.hpp:15,
                 from C:/Users/erikj/Documents/R/win-library/3.6/rstan/include/rstan/rstaninc.hpp:3,
                 from stan_files/stanmarg.hpp:18,
                 from stan_files/stanmarg.cc:3:
C:/Users/erikj/Documents/R/win-library/3.6/BH/include/boost/pending/integer_log2.hpp:7:89: note: #pragma message: This header is deprecated. Use <boost/integer/integer_log2.hpp> instead.
 BOOST_HEADER_DEPRECATED("<boost/integer/integer_log2.hpp>");
                                                                                         ^
C:\\Rtools\\mingw_64\\bin\\g++ -std=c++1y  -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG -I"../inst/include" -I"`"C:/PROGRA~1/R/R-36~1.0/bin/i386/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"`" -I"`"C:/PROGRA~1/R/R-36~1.0/bin/i386/Rscript" --vanilla -e "cat(system.file('include', 'boost_not_in_BH', package = 'rstan'))"`" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_NO_CXX11_RVALUE_REFERENCES -I"C:/Users/erikj/Documents/R/win-library/3.6/StanHeaders/include" -I"C:/Users/erikj/Documents/R/win-library/3.6/rstan/include" -I"C:/Users/erikj/Documents/R/win-library/3.6/BH/include" -I"C:/Users/erikj/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/erikj/Documents/R/win-library/3.6/RcppEigen/include"        -O3 -c init.cpp -o init.o
C:\Rtools\mingw_32\bin\nm.exe: stan_files/stanmarg.o: File format not recognized
C:\Rtools\mingw_32\bin\nm.exe: init.o: File format not recognized
C:\Rtools\mingw_64\bin\g++ -std=c++1y -shared -s -static-libgcc -o blavaan.dll tmp.def stan_files/stanmarg.o init.o -LC:/PROGRA~1/R/R-36~1.0/bin/i386 -lR
C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/PROGRA~1/R/R-36~1.0/bin/i386/R.dll when searching for -lR
C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/PROGRA~1/R/R-36~1.0/bin/i386/R.dll when searching for -lR
C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lR
collect2.exe: error: ld returned 1 exit status
rm stan_files/stanmarg.cc
no DLL was created
ERROR: compilation failed for package 'blavaan'
* removing 'C:/Users/erikj/Documents/R/win-library/3.6/blavaan'
* restoring previous 'C:/Users/erikj/Documents/R/win-library/3.6/blavaan'
Error: Failed to install 'blavaan' from GitHub:
  (converted from warning) installation of package ‘C:/Users/erikj/AppData/Local/Temp/RtmpALmyTq/file450463310a3/blavaan_0.3-6.tar.gz’ had non-zero exit status

I think the makevars file needs to be edited!

ecmerkle commented 5 years ago

Thanks for the update. I wonder whether rstanarm and/or ctsem compile for you? I've been trying to use those as templates because I am no expert in these compilation settings. URLs:

https://github.com/stan-dev/rstanarm https://github.com/cdriveraus/ctsem

ecmerkle commented 5 years ago

Also see the link below... it suggests that the extra argument to install_github() is the correct thing to do, as opposed to changing Makevars.win:

https://discourse.mc-stan.org/t/rstan-contribute-to-build-a-bullet-proof-makevars-initialiser/10101/4

ecmerkle commented 5 years ago

I am curious where you stand on the issue by now... is there something more to do?

vankesteren commented 5 years ago

Sorry for the late response! I think it's ok like this. Maybe you could add something along these lines to the readme? That would prevent others from running into this issue!

To install the development version, run the following line:

remotes::install_github("ecmerkle/blavaan", INSTALL_opts = "--no-multiarch")