You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在R v4.2.2中安装gamm4包失败,求助解决minqa编译错误

解决R v4.2.2中安装gamm4包时minqa编译失败的问题

问题根源

编译minqa包时触发clang错误:Unknown command line argument '-x86-pad-for-align=false',这是由于编译器版本不兼容导致传递了无效的编译参数。minqa是lme4的依赖,而lme4是gamm4的依赖,因此整个安装链中断。

解决步骤

1. 优先安装预编译二进制包

macOS下CRAN提供了大部分包的预编译二进制版本,无需编译即可安装,直接运行:

install.packages("gamm4", type = "binary")

2. 调整编译环境变量

如果二进制包不可用,临时修改编译参数以跳过无效flag:

# 设置编译选项,移除有问题的参数
Sys.setenv(CFLAGS = "-O2")
Sys.setenv(FFLAGS = "-O2")
Sys.setenv(CXXFLAGS = "-O2")

# 重新安装gamm4
install.packages("gamm4")

3. 更新编译器工具链

若上述方法无效,更新系统编译器和gfortran:

  1. 更新Xcode命令行工具:
xcode-select --install
  1. 通过Homebrew更新gcc/gfortran:
brew update && brew upgrade gcc

完成后重启R,再尝试安装gamm4。

4. 手动安装minqa包

若仍失败,单独安装minqa并指定编译参数:

install.packages("minqa", configure.vars = "FCFLAGS=-O2")

安装成功后再安装gamm4:

install.packages("gamm4")

原始问题信息

会话信息

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin21.6.0 (64-bit)
Running under: macOS Monterey 12.6.1

Matrix products: default
BLAS:   /usr/local/Cellar/openblas/0.3.21/lib/libopenblasp-r0.3.21.dylib
LAPACK: /usr/local/Cellar/r/4.2.2/lib/R/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     

loaded via a namespace (and not attached):
[1] compiler_4.2.2 tools_4.2.2 

安装日志

> install.packages('gamm4')
Installing package into ‘/usr/local/lib/R/4.2/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘minqa’, ‘lme4’

trying URL 'https://cran.case.edu/src/contrib/minqa_1.2.5.tar.gz'
Content type 'application/x-gzip' length 54415 bytes (53 KB)
==================================================
downloaded 53 KB

trying URL 'https://cran.case.edu/src/contrib/lme4_1.1-31.tar.gz'
Content type 'application/x-gzip' length 2947739 bytes (2.8 MB)
==================================================
downloaded 2.8 MB

trying URL 'https://cran.case.edu/src/contrib/gamm4_0.2-6.tar.gz'
Content type 'application/x-gzip' length 14969 bytes (14 KB)
==================================================
downloaded 14 KB

* installing *source* package ‘minqa’ ...
** package ‘minqa’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
/usr/local/opt/gcc/bin/gfortran -fno-optimize-sibling-calls  -fPIC  -g -O2  -c altmov.f -o altmov.o
altmov.f:42:72:

   42 |    10 HCOL(K)=ZERO
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 10 at (1)
altmov.f:45:72:

   45 |       DO 20 K=1,NPT
      |                                                                        1
Warning: Fortran 2018 deleted feature: Shared DO termination label 20 at (1)
altmov.f:46:72:

   46 |    20 HCOL(K)=HCOL(K)+TEMP*ZMAT(K,J)
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 20 at (1)
altmov.f:53:72:

   53 |    30 GLAG(I)=BMAT(KNEW,I)
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 30 at (1)
altmov.f:57:72:

   57 |    40 TEMP=TEMP+XPT(K,J)*XOPT(J)
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 40 at (1)
altmov.f:59:72:

   59 |       DO 50 I=1,N
      |                                                                        1
Warning: Fortran 2018 deleted feature: Shared DO termination label 50 at (1)
altmov.f:60:72:

   60 |    50 GLAG(I)=GLAG(I)+TEMP*XPT(K,I)
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 50 at (1)
altmov.f:76:72:

   76 |    60 DISTSQ=DISTSQ+TEMP*TEMP
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 60 at (1)
altmov.f:173:72:

  173 |    90 XNEW(I)=DMAX1(SL(I),DMIN1(SU(I),TEMP))
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 90 at (1)
altmov.f:238:72:

  238 |   140 GW=GW+GLAG(I)*W(I)
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 140 at (1)
altmov.f:249:72:

  249 |   150 TEMP=TEMP+XPT(K,J)*W(J)
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 150 at (1)
altmov.f:250:72:

  250 |   160 CURV=CURV+HCOL(K)*TEMP*TEMP
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 160 at (1)
altmov.f:256:72:

  256 |   170     XALT(I)=DMAX1(SL(I),DMIN1(SU(I),TEMP))
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 170 at (1)
altmov.f:269:72:

  269 |   180     W(N+I)=XALT(I)
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 180 at (1)
altmov.f:276:72:

  276 |   190     XALT(I)=W(N+I)
      |                                                                        1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 190 at (1)
clang (LLVM option parsing): Unknown command line argument '-x86-pad-for-align=false'.  Try: 'clang (LLVM option parsing) --help'
clang (LLVM option parsing): Did you mean '--x86-slh-loads=false'?
make: *** [altmov.o] Error 1
ERROR: compilation failed for package ‘minqa’
* removing ‘/usr/local/lib/R/4.2/site-library/minqa’
ERROR: dependency ‘minqa’ is not available for package ‘lme4’
* removing ‘/usr/local/lib/R/4.2/site-library/lme4’
ERROR: dependency ‘lme4’ is not available for package ‘gamm4’
* removing ‘/usr/local/lib/R/4.2/site-library/gamm4’

The downloaded source packages are in
    ‘/private/var/folders/2q/qbb1m4q52md022yt2cqbd9mm0000gn/T/RtmpYkdEv8/downloaded_packages’
Warning messages:
1: In install.packages("gamm4") :
  installation of package ‘minqa’ had non-zero exit status
2: In install.packages("gamm4") :
  installation of package ‘lme4’ had non-zero exit status
3: In install.packages("gamm4") :
  installation of package ‘gamm4’ had non-zero exit status

内容的提问来源于stack exchange,提问作者Pierre

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 15:20:53