我正在尝试mirt
从源代码安装 R 包,但收到错误消息。我在 PC 和 Mac 上都收到错误消息。请注意,我的 PC 和 Mac 都设置为从源代码安装软件包,并且我已在两个系统上成功地从源代码安装软件包。例如,我已经验证我可以jsonlite
使用以下命令在我的 PC 和 Mac 上成功地从源代码安装包:install.packages("jsonlite", type = "source")
. 我的 PC 上安装了Rtools 4.0 ,Mac 上安装了Xcode 和R 编译器工具。该软件包的创建者 Phil Chalmersmirt
建议我的编译器可能需要重新配置(因为看起来 g++.exe 不在 R 可以看到的路径中)。我该如何解决这个问题,以便我可以mirt
从源代码安装包?
这是我在我的 PC 上尝试从源代码安装时收到的错误:
> install.packages('mirt', type = 'source')
Installing package into ‘C:/R/Packages’
(as ‘lib’ is unspecified)
trying URL 'https://cran.r-project.org/src/contrib/mirt_1.32.1.tar.gz'
Content type 'application/x-gzip' length 811759 bytes (792 KB)
downloaded 792 KB
Welcome at Tue Jul 28 22:32:44 2020
* installing *source* package 'mirt' ...
** package 'mirt' successfully unpacked and MD5 sums checked
** using staged installation
** libs
*** arch - i386
"C:/rtools40/mingw32/bin/"g++ -std=gnu++11 -I"C:/R/R-40~1.2/include" -DNDEBUG -I'C:/R/Packages/Rcpp/include' -I'C:/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:/R/R-40~1.2/include" -DNDEBUG -I'C:/R/Packages/Rcpp/include' -I'C:/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:/R/R-40~1.2/include" -DNDEBUG -I'C:/R/Packages/Rcpp/include' -I'C:/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:/R/R-40~1.2/include" -DNDEBUG -I'C:/R/Packages/Rcpp/include' -I'C:/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:/R/R-40~1.2/include" -DNDEBUG -I'C:/R/Packages/Rcpp/include' -I'C:/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 Tue Jul 28 22:33:21 2020 Goodbye at Tue Jul 28 22:33:21 2020 -LC:/R/R-40~1.2/bin/i386 -lRlapack -LC:/R/R-40~1.2/bin/i386 -lRblas -lgfortran -lm -lquadmath -fopenmp -LC:/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: Tue: No such file or directory
g++.exe: error: Jul: No such file or directory
g++.exe: error: 28: No such file or directory
g++.exe: error: 22:33:21: 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: Tue: No such file or directory
g++.exe: error: Jul: No such file or directory
g++.exe: error: 28: No such file or directory
g++.exe: error: 22:33:21: Invalid argument
g++.exe: error: 2020: No such file or directory
no DLL was created
ERROR: compilation failed for package 'mirt'
* removing 'C:/R/Packages/mirt'
* restoring previous 'C:/R/Packages/mirt'
Warning in install.packages :
installation of package ‘mirt’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\Isaac\AppData\Local\Temp\RtmpwfAN3M\downloaded_packages’
会话信息:
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
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
loaded via a namespace (and not attached):
[1] compiler_4.0.2 tools_4.0.2
验证 Rtools 4.0 已安装:
> Sys.which("make")
make
"C:\\rtools40\\usr\\bin\\make.exe"
但是,R 似乎不知道在哪里g++.exe
:
> system("g++ -v")
[1] 127