philchalmers / mirt

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

Error trying to install the package on CentOS 7 #191

Closed Thelekerman closed 4 years ago

Thelekerman commented 4 years ago

I'm trying to install the package into a CentOS 7 machine and I keep getting the same error over and over. I've installed every dependency listed in the documentation. I have little knowledge of c ++ so I couldn't exploit the error enough by myself.

Here's the error I receive when trying to install:

* installing to library ‘/usr/lib64/R/library’

* installing *source* package ‘mirt’ ...
** using staged installation
** libs
g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG  -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/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] Erro 1
ERROR: compilation failed for package ‘mirt’
* removing ‘/usr/lib64/R/library/mirt’

Some Session Info:

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

locale:
 [1] LC_CTYPE=pt_BR.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=pt_BR.UTF-8        LC_COLLATE=pt_BR.UTF-8    
 [5] LC_MONETARY=pt_BR.UTF-8    LC_MESSAGES=pt_BR.UTF-8   
 [7] LC_PAPER=pt_BR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C       

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

loaded via a namespace (and not attached):
[1] compiler_3.6.0

I would appreciate if anyone could help me to figure out that problem.

philchalmers commented 4 years ago

Does issue #190 provide any insight for you? I don't have experience with CentOS so I'm not sure what information I could offer beyond basic google searching.

VincentGardeux commented 4 years ago

Hi,

I have exactly the same issue here. Also on CentOS 7. However, if this helps, I was able to install mirt_1.31 previously. It only fails when I try to upgrade the package to latest version.

I just tried, and it still works when installing previous version 1.31 from CRAN repos:

install.packages("https://cran.r-project.org/src/contrib/Archive/mirt/mirt_1.31.tar.gz", source=T)

The error only arises with version 1.32 (and further 1.32.1)

Could you correct for future updates?

Thanks

VincentGardeux commented 4 years ago

This is an issue with CentOS7 version of g++ (see here)

This can be solved by installing SCL (see here)

@Thelekerman can you try that?

Thelekerman commented 4 years ago

Sorry to keep you waiting, I was really suspecting that it would be a g++ problem since I tested it on an Ubuntu machine with a newer version of g++ and it worked on it. I will try and when I get the result I will notice.

Thelekerman commented 4 years ago

Thank you @VincentGardeux updating the g++ version worked.

If someone could try to find out which version of g ++ is needed to avoid this kind of problem I'm sure it would help some people who may have it in the future.

In addition, I thanks @philchalmers and @VincentGardeux for the help.