philchalmers / mirt

Multidimensional item response theory
https://philchalmers.github.io/mirt/
201 stars 75 forks source link

Install Issue on Linux #189

Closed giac01 closed 4 years ago

giac01 commented 4 years ago

Just leaving this here incase its useful. Love the package btw!

I couldn't install the latest version on my university computer, got the following error:

> if (!"mirt" %in% installed.packages()){install.packages("mirt")}
Installing package into ?/home/gb01/R/x86_64-redhat-linux-gnu-library/3.6?
(as ?lib? is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/mirt_1.32.1.tar.gz'
Content type 'application/x-gzip' length 811759 bytes (792 KB)
==================================================
downloaded 792 KB

* installing *source* package ?mirt? ...
** package ?mirt? successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG  -I"/usr/lib64/R/library/Rcpp/include" -I"/home/gb01/R/x86_64-redhat-linux-gnu-library/3.6/RcppArmadillo/include" -I/usr/local/include -fopenmp -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c Estep.cpp -o Estep.o
Estep.cpp:9:0: warning: ignoring #pragma omp declare [-Wunknown-pragmas]
 #pragma omp declare reduction(vec_double_plus : std::vector<double> : \
 ^
Estep.cpp: In function ?void _Estep(std::vector<double>&, std::vector<double>&, const std::vector<double>&, const std::vector<double>&, const IntegerMatrix&, const NumericMatrix&, const bool&)?:
Estep.cpp:29:36: error: expected ?+?, ?*?, ?-?, ?&?, ?^?, ?|?, ?&&?, ?||?, ?min? or ?max? before ?vec_double_plus?
 #pragma omp parallel for reduction(vec_double_plus : r1vec)
                                    ^
Estep.cpp: In function ?void _Estep2(std::vector<double>&, std::vector<double>&, const NumericMatrix&, const IntegerMatrix&, const NumericMatrix&, const bool&)?:
Estep.cpp:94:36: error: expected ?+?, ?*?, ?-?, ?&?, ?^?, ?|?, ?&&?, ?||?, ?min? or ?max? before ?vec_double_plus?
 #pragma omp parallel for reduction(vec_double_plus : r1vec)
                                    ^
Estep.cpp: In function ?void _Estepbfactor(std::vector<double>&, std::vector<double>&, std::vector<double>&, std::vector<double>&, const NumericMatrix&, const NumericMatrix&, const std::vector<double>&, const std::vector<double>&, const IntegerMatrix&, const IntegerMatrix&, const bool&)?:
Estep.cpp:173:36: error: expected ?+?, ?*?, ?-?, ?&?, ?^?, ?|?, ?&&?, ?||?, ?min? or ?max? before ?vec_double_plus?
 #pragma omp parallel for reduction(vec_double_plus : r1vec)
                                    ^
make: *** [Estep.o] Error 1
ERROR: compilation failed for package ?mirt?
* removing ?/home/gb01/R/x86_64-redhat-linux-gnu-library/3.6/mirt?
Warning in install.packages :
  installation of package ?mirt? had non-zero exit status

The downloaded source packages are in
    ?/tmp/RtmpcOFx2K/downloaded_packages?
> if (!"mirt" %in% installed.packages()){ devtools::install_version("mirt", version = "1.31") }

Worked fine!

For your info:

> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8      
 [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats4    parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] mirt_1.31          mixOmics_6.10.9    lattice_0.20-38    patchwork_1.0.0    data.table_1.12.8  RColorBrewer_1.1-2 doParallel_1.0.15  iterators_1.0.10   foreach_1.5.0      jtools_2.0.5       ltm_1.1-1         
[12] polycor_0.7-10     msm_1.6.8          MASS_7.3-51.4      reshape2_1.4.4     stringr_1.3.1      ggplot2_3.3.2      dplyr_1.0.0       

loaded via a namespace (and not attached):
 [1] pkgload_1.1.0         tidyr_1.1.0           splines_3.6.0         ellipse_0.4.2         assertthat_0.2.0      expm_0.999-4          BiocManager_1.30.10   pander_0.6.3          dcurver_0.9.1        
[10] remotes_2.1.1         sessioninfo_1.1.1     pillar_1.4.4          backports_1.1.8       glue_1.4.1            digest_0.6.25         GPArotation_2014.11-1 colorspace_1.3-2      Matrix_1.2-17        
[19] plyr_1.8.4            psych_1.9.12.31       pkgconfig_2.0.2       devtools_2.3.0        purrr_0.3.4           corpcor_1.6.9         mvtnorm_1.0-8         scales_1.0.0          processx_3.4.2       
[28] RSpectra_0.16-0       tibble_3.0.1          mgcv_1.8-28           generics_0.0.2        usethis_1.6.1         ellipsis_0.3.1        withr_2.1.2           cli_2.0.2             mnormt_1.5-7         
[37] survival_2.44-1.1     magrittr_1.5          crayon_1.3.4          memoise_1.1.0         ps_1.3.3              fs_1.4.1              fansi_0.4.0           nlme_3.1-139          vegan_2.5-6          
[46] pkgbuild_1.0.8        tools_3.6.0           prettyunits_1.0.2     lifecycle_0.2.0       matrixStats_0.56.0    munsell_0.5.0         cluster_2.0.8         callr_3.4.3           Deriv_4.0            
[55] compiler_3.6.0        rlang_0.4.6           grid_3.6.0            rstudioapi_0.11       igraph_1.2.5          testthat_2.3.2        gtable_0.2.0          codetools_0.2-16      rARPACK_0.11-0       
[64] curl_4.3              R6_2.3.0              gridExtra_2.3         rprojroot_1.3-2       permute_0.9-5         desc_1.2.0            stringi_1.2.4         Rcpp_1.0.0            vctrs_0.3.1          
[73] tidyselect_1.1.0     
> 
philchalmers commented 4 years ago

That's a little strange as to why this would work. On Linux the package should be installed from source, and therefore use the native compilers on the OS. The output above suggests that devtools is somehow calling different default compilers than the CRAN installation approach (not sure why). I think this could be an isolated incident, but feel free to reopen if you can locate the problem and believe the package can be changed to avoid issues like this. Cheers.