philchalmers / mirt

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

Error trying to install development version of mirt package on GitHub from source #190

Closed isaactpetersen closed 3 years ago

isaactpetersen commented 4 years ago

I'm trying to install the latest development version of the mirt package on github from source, but am receiving errors. I am receiving errors on both PC and Mac. Note that both my PC and Mac are set up to install packages from source, and I have successfully installed packages from source on both systems. For instance, I have verified that I can successfully install the package jsonlite from source on both my PC and Mac with the following command: install.packages("jsonlite", type = "source"). I have Rtools 4.0 installed on my PC and Xcode and R Compiler Tools installed on my Mac. Any help would be greatly appreciated--thanks!

Here's the error I receive when trying to install from source on my PC:

> library('devtools')
Loading required package: usethis
> install_github('philchalmers/mirt')
Downloading GitHub repo philchalmers/mirt@HEAD
√  checking for file 'C:\Users\itpetersen\AppData\Local\Temp\RtmpSoIlHW\remotes375016b07061\philchalmers-mirt-34e9fec/DESCRIPTION' (397ms)
-  preparing 'mirt':
√  checking DESCRIPTION meta-information ... 
-  cleaning src
-  installing the package to process help pages (1.1s)
-  saving partial Rd database (1m 31.4s)
-  cleaning src
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
   Removed empty directory 'mirt/tests/tests/testdata'
-  building 'mirt_1.32.5.tar.gz'

Installing package into ‘C:/Program Files/R/Packages’
(as ‘lib’ is unspecified)

Welcome at Sat Jul 25 11:13:54 2020 
* installing *source* package 'mirt' ...
** using staged installation
** libs

*** arch - i386
"C:/rtools40/mingw32/bin/"g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG  -I'C:/Program Files/R/Packages/Rcpp/include' -I'C:/Program Files/R/Packages/RcppArmadillo/include'     -fopenmp   -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c Estep.cpp -o Estep.o
"C:/rtools40/mingw32/bin/"g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG  -I'C:/Program Files/R/Packages/Rcpp/include' -I'C:/Program Files/R/Packages/RcppArmadillo/include'     -fopenmp   -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c Misc.cpp -o Misc.o
"C:/rtools40/mingw32/bin/"g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG  -I'C:/Program Files/R/Packages/Rcpp/include' -I'C:/Program Files/R/Packages/RcppArmadillo/include'     -fopenmp   -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c dpars.cpp -o dpars.o
"C:/rtools40/mingw32/bin/"g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG  -I'C:/Program Files/R/Packages/Rcpp/include' -I'C:/Program Files/R/Packages/RcppArmadillo/include'     -fopenmp   -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c ggum_derivs.cpp -o ggum_derivs.o
"C:/rtools40/mingw32/bin/"g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG  -I'C:/Program Files/R/Packages/Rcpp/include' -I'C:/Program Files/R/Packages/RcppArmadillo/include'     -fopenmp   -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c traceLinePts.cpp -o traceLinePts.o
C:/rtools40/mingw32/bin/g++ -std=gnu++11 -shared -s -static-libgcc -o mirt.dll tmp.def Estep.o Misc.o dpars.o ggum_derivs.o traceLinePts.o Welcome at Sat Jul 25 11:14:33 2020 Goodbye at Sat Jul 25 11:14:34 2020 -LC:/PROGRA~1/R/R-40~1.2/bin/i386 -lRlapack -LC:/PROGRA~1/R/R-40~1.2/bin/i386 -lRblas -lgfortran -lm -lquadmath -fopenmp -LC:/PROGRA~1/R/R-40~1.2/bin/i386 -lR
g++.exe: error: Welcome: No such file or directory
g++.exe: error: at: No such file or directory
g++.exe: error: Sat: No such file or directory
g++.exe: error: Jul: No such file or directory
g++.exe: error: 25: No such file or directory
g++.exe: error: 11:14:34: Invalid argument
g++.exe: error: 2020: No such file or directory
g++.exe: error: Goodbye: No such file or directory
g++.exe: error: at: No such file or directory
g++.exe: error: Sat: No such file or directory
g++.exe: error: Jul: No such file or directory
g++.exe: error: 25: No such file or directory
g++.exe: error: 11:14:34: Invalid argument
g++.exe: error: 2020: No such file or directory
no DLL was created
ERROR: compilation failed for package 'mirt'
* removing 'C:/Program Files/R/Packages/mirt'
* restoring previous 'C:/Program Files/R/Packages/mirt'
Error: Failed to install 'mirt' from GitHub:
  (converted from warning) installation of package ‘C:/Users/ITPETE~1/AppData/Local/Temp/RtmpSoIlHW/file37505b067328/mirt_1.32.5.tar.gz’ had non-zero exit status

Session Info:

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
[1] devtools_2.3.1 usethis_1.6.1 

loaded via a namespace (and not attached):
 [1] rstudioapi_0.11   magrittr_1.5      knitr_1.29        pkgload_1.1.0     R6_2.4.1          rlang_0.4.7       fansi_0.4.1       tools_4.0.2      
 [9] pkgbuild_1.1.0    packrat_0.5.0     xfun_0.15         sessioninfo_1.1.1 cli_2.0.2         withr_2.2.0       remotes_2.2.0     htmltools_0.5.0  
[17] ellipsis_0.3.1    assertthat_0.2.1  digest_0.6.25     rprojroot_1.3-2   crayon_1.3.4      processx_3.4.3    callr_3.4.3       fs_1.4.2         
[25] ps_1.3.3          curl_4.3          testthat_2.3.2    memoise_1.1.0     glue_1.4.1        evaluate_0.14     rmarkdown_2.3     compiler_4.0.2   
[33] desc_1.2.0        backports_1.1.8   prettyunits_1.1.1

Here's the error I receive when trying to install from source on my Mac:

> library('devtools')
Loading required package: usethis
Warning message:
package ‘devtools’ was built under R version 4.0.2 
> install_github('philchalmers/mirt')
Downloading GitHub repo philchalmers/mirt@HEAD
✓  checking for file ‘/private/var/folders/fx/w4mh6rhd0413sbbh3mjhgxtm0000gn/T/RtmpDgP3go/remotes3ca71c54e2a5/philchalmers-mirt-34e9fec/DESCRIPTION’ ...
─  preparing ‘mirt’:
✓  checking DESCRIPTION meta-information ...
─  cleaning src
─  installing the package to process help pages
         -----------------------------------
─  installing *source* package ‘mirt’ ...
   ** using staged installation
   ** libs
   clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Packages/Rcpp/include' -I'/Library/Frameworks/R.framework/Packages/RcppArmadillo/include' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include   -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c Estep.cpp -o Estep.o
   clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Packages/Rcpp/include' -I'/Library/Frameworks/R.framework/Packages/RcppArmadillo/include' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include   -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c Misc.cpp -o Misc.o
   clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Packages/Rcpp/include' -I'/Library/Frameworks/R.framework/Packages/RcppArmadillo/include' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include   -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c dpars.cpp -o dpars.o
   clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Packages/Rcpp/include' -I'/Library/Frameworks/R.framework/Packages/RcppArmadillo/include' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include   -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c ggum_derivs.cpp -o ggum_derivs.o
   clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Packages/Rcpp/include' -I'/Library/Frameworks/R.framework/Packages/RcppArmadillo/include' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include   -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c traceLinePts.cpp -o traceLinePts.o
   clang++ -mmacosx-version-min=10.13 -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -Wl,-rpath,/Library/Frameworks/R.framework/Resources/lib /Library/Frameworks/R.framework/Resources/lib/libc++abi.1.dylib -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o mirt.so Estep.o Misc.o dpars.o ggum_derivs.o traceLinePts.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
   clang-7: error: no such file or directory: '/Library/Frameworks/R.framework/Resources/lib/libc++abi.1.dylib'
   make: *** [mirt.so] Error 1
   ERROR: compilation failed for package ‘mirt’
─  removing ‘/private/var/folders/fx/w4mh6rhd0413sbbh3mjhgxtm0000gn/T/RtmpXY3oDr/Rinst3ce55d032811/mirt’
         -----------------------------------
   ERROR: package installation failed
Error: Failed to install 'mirt' from GitHub:
  System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines):
E> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Packages/Rcpp/include' -I'/Library/Frameworks/R.framework/Packages/RcppArmadillo/include' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include   -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c dpars.cpp -o dpars.o
E> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Packages/Rcpp/include' -I'/Library/Frameworks/R.framework/Packages/RcppArmadillo/include' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include   -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c ggum_derivs.cpp -o ggum_derivs.o
E> clang++ -mmacosx-version-

Session Info:

> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] devtools_2.3.1 usethis_1.6.1 

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5        rstudioapi_0.11   magrittr_1.5      hms_0.5.3         pkgload_1.1.0     R6_2.4.1          rlang_0.4.7       fansi_0.4.1       tools_4.0.0      
[10] pkgbuild_1.1.0    sessioninfo_1.1.1 cli_2.0.2         withr_2.2.0       remotes_2.2.0     ellipsis_0.3.1    rprojroot_1.3-2   assertthat_0.2.1  digest_0.6.25    
[19] tibble_3.0.3      lifecycle_0.2.0   crayon_1.3.4      processx_3.4.3    readr_1.3.1       callr_3.4.3       vctrs_0.3.2       fs_1.4.2          ps_1.3.3         
[28] curl_4.3          testthat_2.3.2    memoise_1.1.0     glue_1.4.1        compiler_4.0.0    pillar_1.4.6      backports_1.1.8   desc_1.2.0        prettyunits_1.1.1
[37] pkgconfig_2.0.3

I also received an error when trying the follow the special installation instructions for installing on Mac:

wireless-nat-inside:~ isaac$ curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   338  100   338    0     0   4970      0 --:--:-- --:--:-- --:--:--  4970
wireless-nat-inside:~ isaac$ sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /
tar: Error opening archive: Unrecognized archive format
philchalmers commented 3 years ago

Does the same issue occur when you install the CRAN version from source?

install.packages('mirt', type = 'source')

If so, it might be that your compilers need to be reconfigured. (e.g., on Windows, it looks like g++.exe is not in a path that R can see).

seonghobae commented 3 years ago

See this: https://stackoverflow.com/questions/61679216/r-4-0-cant-compile-c-sources-in-macos-catalina-clang-7-error

isaactpetersen commented 3 years ago

Does the same issue occur when you install the CRAN version from source?

install.packages('mirt', type = 'source')

If so, it might be that your compilers need to be reconfigured. (e.g., on Windows, it looks like g++.exe is not in a path that R can see).

Yes, I got the same error when trying to install the CRAN version from source. I was finally able to fix it on PC (see here). The issue was arising because my Rprofile.site file prints text to the console, and the text was being inserted into the g++ command. I was able to install the package from source on my PC after I commented out the lines in the Rprofile.site file that print text to the console. However, I'm still getting an error when trying to install from source on my Mac.

See this: https://stackoverflow.com/questions/61679216/r-4-0-cant-compile-c-sources-in-macos-catalina-clang-7-error

Thanks for this resource. I have already followed the instructions at that link for installing the R Compiler Tools on my mac (as linked in my original post).