在配备 Apple M1 芯片的 MacBook 上安装 gfortran 以在 R 中使用

Mar*_*ite 16 macos r gfortran apple-m1

我使用的是配备 Apple M1 芯片、运行 macOS 11.6 Big Sur 的 MacBook Air。我正在使用 R 4.1.1。我安装了适用于 Apple M1 的 Xtools 和 gfortran

\n
markwhite@marks-air ~ % which xcode-select\n/usr/bin/xcode-select\nmarkwhite@marks-air ~ % which gfortran\n/usr/local/bin/gfortran\n
Run Code Online (Sandbox Code Playgroud)\n

我能够成功安装并运行 R\xe2\x80\x94,但是安装一些软件包给我带来了麻烦:

\n
> install.packages("mvtnorm")\n\n  There is a binary version available but the source version is later:\n        binary source needs_compilation\nmvtnorm  1.1-2  1.1-3              TRUE\n\nDo you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes\ninstalling the source package \xe2\x80\x98mvtnorm\xe2\x80\x99\n\ntrying URL \'https://cran.rstudio.com/src/contrib/mvtnorm_1.1-3.tar.gz\'\nContent type \'application/x-gzip\' length 166421 bytes (162 KB)\n==================================================\ndownloaded 162 KB\n\n* installing *source* package \xe2\x80\x98mvtnorm\xe2\x80\x99 ...\n** package \xe2\x80\x98mvtnorm\xe2\x80\x99 successfully unpacked and MD5 sums checked\n** using staged installation\n** libs\nclang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o\nclang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c miwa.c -o miwa.o\n/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c mvt.f -o mvt.o\nmake: /opt/R/arm64/bin/gfortran: No such file or directory\nmake: *** [mvt.o] Error 1\nERROR: compilation failed for package \xe2\x80\x98mvtnorm\xe2\x80\x99\n* removing \xe2\x80\x98/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/mvtnorm\xe2\x80\x99\nWarning in install.packages :\n  installation of package \xe2\x80\x98mvtnorm\xe2\x80\x99 had non-zero exit status\n\nThe downloaded source packages are in\n    \xe2\x80\x98/private/var/folders/fx/f46lfqf56_df59fvzgqhcbyr0000gn/T/RtmpfGZUAF/downloaded_packages\xe2\x80\x99\n> \n
Run Code Online (Sandbox Code Playgroud)\n

我认为关键是:make: /opt/R/arm64/bin/gfortran: No such file or directory它在哪里寻找 gfortran 的错误位置。

\n

确认它不存在:

\n
> install.packages("mvtnorm")\n\n  There is a binary version available but the source version is later:\n        binary source needs_compilation\nmvtnorm  1.1-2  1.1-3              TRUE\n\nDo you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes\ninstalling the source package \xe2\x80\x98mvtnorm\xe2\x80\x99\n\ntrying URL \'https://cran.rstudio.com/src/contrib/mvtnorm_1.1-3.tar.gz\'\nContent type \'application/x-gzip\' length 166421 bytes (162 KB)\n==================================================\ndownloaded 162 KB\n\n* installing *source* package \xe2\x80\x98mvtnorm\xe2\x80\x99 ...\n** package \xe2\x80\x98mvtnorm\xe2\x80\x99 successfully unpacked and MD5 sums checked\n** using staged installation\n** libs\nclang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o\nclang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c miwa.c -o miwa.o\n/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c mvt.f -o mvt.o\nmake: /opt/R/arm64/bin/gfortran: No such file or directory\nmake: *** [mvt.o] Error 1\nERROR: compilation failed for package \xe2\x80\x98mvtnorm\xe2\x80\x99\n* removing \xe2\x80\x98/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/mvtnorm\xe2\x80\x99\nWarning in install.packages :\n  installation of package \xe2\x80\x98mvtnorm\xe2\x80\x99 had non-zero exit status\n\nThe downloaded source packages are in\n    \xe2\x80\x98/private/var/folders/fx/f46lfqf56_df59fvzgqhcbyr0000gn/T/RtmpfGZUAF/downloaded_packages\xe2\x80\x99\n> \n
Run Code Online (Sandbox Code Playgroud)\n

所以,我只是将 gfortran 从它所在的位置移动到 R 想要的位置:

\n
markwhite@marks-air ~ % cd /opt/R/arm64/\nmarkwhite@marks-air arm64 % ls -la\ntotal 0\ndrwxrwxr-x   8 root  wheel  256 Oct 18 11:04 .\ndrwxrwxr-x   3 root  wheel   96 May 13 20:40 ..\ndrwxrwxr-x  14 root  wheel  448 Oct 19 21:34 bin\ndrwxrwxr-x  29 root  wheel  928 May 13 20:47 include\ndrwxrwxr-x  20 root  wheel  640 May 14 18:50 lib\ndrwxrwxr-x   5 root  wheel  160 May 13 20:40 man\ndrwxr-xr-x   3 root  wheel   96 May 14 18:28 pkg\ndrwxrwxr-x   5 root  wheel  160 Oct 18 11:04 share\nmarkwhite@marks-air arm64 % \n
Run Code Online (Sandbox Code Playgroud)\n

然后,我重新启动 R 并重试:

\n
> install.packages("mvtnorm")\n\n  There is a binary version available but the source version is later:\n        binary source needs_compilation\nmvtnorm  1.1-2  1.1-3              TRUE\n\nDo you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes\ninstalling the source package \xe2\x80\x98mvtnorm\xe2\x80\x99\n\ntrying URL \'https://cran.rstudio.com/src/contrib/mvtnorm_1.1-3.tar.gz\'\nContent type \'application/x-gzip\' length 166421 bytes (162 KB)\n==================================================\ndownloaded 162 KB\n\n* installing *source* package \xe2\x80\x98mvtnorm\xe2\x80\x99 ...\n** package \xe2\x80\x98mvtnorm\xe2\x80\x99 successfully unpacked and MD5 sums checked\n** using staged installation\n** libs\nclang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o\nclang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c miwa.c -o miwa.o\n/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c mvt.f -o mvt.o\nmvt.f:861:11:\n\n  861 |       hs = sign( one, dh - r*dk )\n      |           1\nWarning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]\nmvt.f:862:11:\n\n  862 |       ks = sign( one, dk - r*dh )\n      |           1\nWarning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]\nmvt.f:1155:16:\n\n 1155 |             K = MOD( C(NP, MIN(NDIM-1,KLIM-1))*DBLE(K), DBLE(P(NP)) )\n      |                1\nWarning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]\nmvt.f:1215:17:\n\n 1215 |             JP = 1 + J*R(J)\n      |                 1\nWarning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]\nmvt.f:94:39:\n\n   94 |       DOUBLE PRECISION COV(NL*(NL+1)/2), A(NL), B(NL), DL(NL), Y(NL)\n      |                                       1\nWarning: Array \xe2\x80\x98cov\xe2\x80\x99 at (1) is larger than limit set by \xe2\x80\x98-fmax-stack-var-size=\xe2\x80\x99, moved from stack to static storage. This makes the procedure unsafe when called recursively, or concurrently from multiple threads. Consider using \xe2\x80\x98-frecursive\xe2\x80\x99, or increase the \xe2\x80\x98-fmax-stack-var-size=\xe2\x80\x99 limit, or change the code to use an ALLOCATABLE array. [-Wsurprising]\nmvt.f:86:33:\n\n   86 |       SUBROUTINE MVSUBR( N, W, NF, F )\n      |                                 1\nWarning: Unused dummy argument \xe2\x80\x98nf\xe2\x80\x99 at (1) [-Wunused-dummy-argument]\nclang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c mvtnorm-init.c -o mvtnorm-init.o\n/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c tvpack.f -o tvpack.o\ntvpack.f:395:14:\n\n  395 |          HS = SIGN( ONE, DH - R*DK )\n      |              1\nWarning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]\ntvpack.f:396:14:\n\n  396 |          KS = SIGN( ONE, DK - R*DH )\n      |              1\nWarning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]\ntvpack.f:60:52:\n\n   60 |       DOUBLE PRECISION ONE, ZRO, EPS, ZROS(3), HS(3), TVT, TVTL\n      |                                                    1\nWarning: Unused variable \xe2\x80\x98hs\xe2\x80\x99 declared at (1) [-Wunused-variable]\ntvpack.f:60:45:\n\n   60 |       DOUBLE PRECISION ONE, ZRO, EPS, ZROS(3), HS(3), TVT, TVTL\n      |                                             1\nWarning: Unused variable \xe2\x80\x98zros\xe2\x80\x99 declared at (1) [-Wunused-variable]\ntvpack.f:220:72:\n\n  220 |       END\n      |                                                                        ^\nWarning: \xe2\x80\x98fin\xe2\x80\x99 may be used uninitialized in this function [-Wmaybe-uninitialized]\ntvpack.f:196:58:\n\n  196 |       DOUBLE PRECISION EI(NL), AI(NL), BI(NL), FI(NL), FIN, ERR, KRNRDT\n      |                                                          ^\nnote: \xe2\x80\x98fin\xe2\x80\x99 was declared here\nclang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o mvtnorm.so C_FORTRAN_interface.o miwa.o mvt.o mvtnorm-init.o tvpack.o -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation\nld: warning: directory not found for option \'-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0\'\nld: warning: directory not found for option \'-L/opt/R/arm64/gfortran/lib\'\nld: library not found for -lgfortran\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\nmake: *** [mvtnorm.so] Error 1\nERROR: compilation failed for package \xe2\x80\x98mvtnorm\xe2\x80\x99\n* removing \xe2\x80\x98/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/mvtnorm\xe2\x80\x99\nWarning in install.packages :\n  installation of package \xe2\x80\x98mvtnorm\xe2\x80\x99 had non-zero exit status\n\nThe downloaded source packages are in\n    \xe2\x80\x98/private/var/folders/fx/f46lfqf56_df59fvzgqhcbyr0000gn/T/RtmpmlhiE8/downloaded_packages\xe2\x80\x99\n> \n
Run Code Online (Sandbox Code Playgroud)\n

看起来它仍然与目录路径混淆,或者mv实际上没有移动它需要移动的内容。

\n

如何将 R 指向正确的目录或在正确的目录中安装 gfortran?

\n

我知道这个问题现在很混乱,我已经查看了其他线程,但无法完全得到任何人建议的工作。

\n

che*_*men 24

这是在 Mac OS M1 系统上对我有用的方法。R 版本 4.2.1(根据此处的解决方案修改,可能适用于 Intel Mac)

  1. 安装包含 gfortran 的 gccbrew install gcc

  2. 创建一个文件~/.R/Makevars(如果尚不存在)。参见此处的示例。

  3. 将以下行添加到~/.R/Makevars

FC = /opt/homebrew/Cellar/gcc/11.3.0_2/bin/gfortran
F77 = /opt/homebrew/Cellar/gcc/11.3.0_2/bin/gfortran
FLIBS = -L/opt/homebrew/Cellar/gcc/11.3.0_2/lib/gcc/11

请注意,您可能必须将 gcc 版本更改11.3.0_2为您的 gcc 版本。


Mar*_*ite 8

我删除了与 gfortran 相关的所有内容并重新开始。

\n

我使用浏览器在此处下载了 .tar.xz 文件,该文件将文件转储到我的下载文件夹中。我双击它来解压它。

\n

我将该目录移动到 R 想要的位置:

\n
markwhite@marks-air ~ % sudo mv Downloads/gfortran /opt/R/arm64/\n
Run Code Online (Sandbox Code Playgroud)\n

然后我重新启动 R 并再次尝试。它向我抛出了一些 Fortran 编译消息\xe2\x80\x94,我不会在这里假装理解\xe2\x80\x94,但它已成功安装:

\n
> install.packages("mvtnorm")\n\n  There is a binary version available but the source version is later:\n        binary source needs_compilation\nmvtnorm  1.1-2  1.1-3              TRUE\n\nDo you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes\ninstalling the source package \xe2\x80\x98mvtnorm\xe2\x80\x99\n\ntrying URL \'https://cran.rstudio.com/src/contrib/mvtnorm_1.1-3.tar.gz\'\nContent type \'application/x-gzip\' length 166421 bytes (162 KB)\n==================================================\ndownloaded 162 KB\n\n* installing *source* package \xe2\x80\x98mvtnorm\xe2\x80\x99 ...\n** package \xe2\x80\x98mvtnorm\xe2\x80\x99 successfully unpacked and MD5 sums checked\n** using staged installation\n** libs\nclang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o\nclang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c miwa.c -o miwa.o\n/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c mvt.f -o mvt.o\nmvt.f:861:11:\n\n  861 |       hs = sign( one, dh - r*dk )\n      |           1\nWarning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]\nmvt.f:862:11:\n\n  862 |       ks = sign( one, dk - r*dh )\n      |           1\nWarning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]\nmvt.f:1155:16:\n\n 1155 |             K = MOD( C(NP, MIN(NDIM-1,KLIM-1))*DBLE(K), DBLE(P(NP)) )\n      |                1\nWarning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]\nmvt.f:1215:17:\n\n 1215 |             JP = 1 + J*R(J)\n      |                 1\nWarning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]\nmvt.f:94:39:\n\n   94 |       DOUBLE PRECISION COV(NL*(NL+1)/2), A(NL), B(NL), DL(NL), Y(NL)\n      |                                       1\nWarning: Array \xe2\x80\x98cov\xe2\x80\x99 at (1) is larger than limit set by \xe2\x80\x98-fmax-stack-var-size=\xe2\x80\x99, moved from stack to static storage. This makes the procedure unsafe when called recursively, or concurrently from multiple threads. Consider using \xe2\x80\x98-frecursive\xe2\x80\x99, or increase the \xe2\x80\x98-fmax-stack-var-size=\xe2\x80\x99 limit, or change the code to use an ALLOCATABLE array. [-Wsurprising]\nmvt.f:86:33:\n\n   86 |       SUBROUTINE MVSUBR( N, W, NF, F )\n      |                                 1\nWarning: Unused dummy argument \xe2\x80\x98nf\xe2\x80\x99 at (1) [-Wunused-dummy-argument]\nclang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c mvtnorm-init.c -o mvtnorm-init.o\n/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c tvpack.f -o tvpack.o\ntvpack.f:395:14:\n\n  395 |          HS = SIGN( ONE, DH - R*DK )\n      |              1\nWarning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]\ntvpack.f:396:14:\n\n  396 |          KS = SIGN( ONE, DK - R*DH )\n      |              1\nWarning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]\ntvpack.f:60:52:\n\n   60 |       DOUBLE PRECISION ONE, ZRO, EPS, ZROS(3), HS(3), TVT, TVTL\n      |                                                    1\nWarning: Unused variable \xe2\x80\x98hs\xe2\x80\x99 declared at (1) [-Wunused-variable]\ntvpack.f:60:45:\n\n   60 |       DOUBLE PRECISION ONE, ZRO, EPS, ZROS(3), HS(3), TVT, TVTL\n      |                                             1\nWarning: Unused variable \xe2\x80\x98zros\xe2\x80\x99 declared at (1) [-Wunused-variable]\ntvpack.f:220:72:\n\n  220 |       END\n      |                                                                        ^\nWarning: \xe2\x80\x98fin\xe2\x80\x99 may be used uninitialized in this function [-Wmaybe-uninitialized]\ntvpack.f:196:58:\n\n  196 |       DOUBLE PRECISION EI(NL), AI(NL), BI(NL), FI(NL), FIN, ERR, KRNRDT\n      |                                                          ^\nnote: \xe2\x80\x98fin\xe2\x80\x99 was declared here\nclang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o mvtnorm.so C_FORTRAN_interface.o miwa.o mvt.o mvtnorm-init.o tvpack.o -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation\nld: warning: could not create compact unwind for _mvkrsv_: register 75 saved somewhere other than in frame\nld: warning: could not create compact unwind for _mvkbrv_: stack size is too large for frameless function\nld: warning: could not create compact unwind for _mvstdt_: register 75 saved somewhere other than in frame\nld: warning: could not create compact unwind for _mvbvtl_: registers 78 and 79 not saved contiguously in frame\nld: warning: could not create compact unwind for _pntgnd_: registers 72 and 73 not saved contiguously in frame\nld: warning: could not create compact unwind for _mvbvu_: registers 72 and 73 not saved contiguously in frame\nld: warning: could not create compact unwind for _tvtmfn_: register 73 saved somewhere other than in frame\nld: warning: could not create compact unwind for _krnrdt_: registers 74 and 75 not saved contiguously in frame\nld: warning: could not create compact unwind for _mvbvn_: registers 21 and 22 not saved contiguously in frame\nld: warning: could not create compact unwind for _bvnd_: registers 78 and 79 not saved contiguously in frame\nld: warning: could not create compact unwind for _bvtl_: registers 78 and 79 not saved contiguously in frame\nld: warning: could not create compact unwind for _tvtlrcall_: registers 72 and 73 not saved contiguously in frame\nld: warning: could not create compact unwind for _mvbvt_: registers 21 and 22 not saved contiguously in frame\nld: warning: could not create compact unwind for _mvspcl_: register 73 saved somewhere other than in frame\nld: warning: could not create compact unwind for _mvsort_: register 77 saved somewhere other than in frame\nld: warning: could not create compact unwind for _mvvlsb_: registers 27 and 28 not saved contiguously in frame\nld: warning: could not create compact unwind for _mvtdst_: registers 23 and 24 not saved contiguously in frame\nld: warning: could not create compact unwind for _mvbvtc_: register 73 saved somewhere other than in frame\ninstalling to /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/00LOCK-mvtnorm/00new/mvtnorm/libs\n** R\n** inst\n** byte-compile and prepare package for lazy loading\n** help\n*** installing help indices\n** building package indices\n** installing vignettes\n** testing if installed package can be loaded from temporary location\n** checking absolute paths in shared objects and dynamic libraries\n** testing if installed package can be loaded from final location\n** testing if installed package keeps a record of temporary installation path\n* DONE (mvtnorm)\n\nThe downloaded source packages are in\n    \xe2\x80\x98/private/var/folders/fx/f46lfqf56_df59fvzgqhcbyr0000gn/T/RtmptXzvKK/downloaded_packages\xe2\x80\x99\n
Run Code Online (Sandbox Code Playgroud)\n


小智 5

我在尝试从源安装软件包时遇到了类似的问题。我的解决方案是

  1. 安装 gcc 的 Homebrew 版本(包括 gfortran)

    酿造安装海湾合作委员会

  2. 告诉 R 应该在哪里查找 gfortran 此信息存储在文件“Makeconf”中,在我的情况下可以在这里找到:/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/etc/Makeconf

在“Makeconf”中更改行

FLIBS =  -L/Volumes/Builds/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/Volumes/Builds/opt/R/arm64/gfortran/lib/gcc -L/Volumes/Builds/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm
Run Code Online (Sandbox Code Playgroud)

FLIBS =  -L/opt/homebrew/Cellar/gcc/11.3.0/lib/gcc/11/gcc/aarch64-apple-darwin21/11 -L/opt/homebrew/Cellar/gcc/11.3.0/lib/gcc/11 -lgfortran -lquadmath -lm
Run Code Online (Sandbox Code Playgroud)

您可能需要根据系统上安装的 gcc 版本来调整路径。

  1. 重新启动R