简体   繁体   English

MacOS M1:在 R 中安装 sf 时出现问题 - 错误:package 'classInt' 的编译失败; 错误:package 'units' 的配置失败

[英]MacOS M1: problems with installing sf in R - ERROR: compilation failed for package ‘classInt’; ERROR: configuration failed for package ‘units’

I am working on a MacOS Monterey with an M1 chip and have R 4.2.1 arm64 version (build 554).我正在使用带有 M1 芯片的 MacOS Monterey 并拥有 R 4.2.1 arm64 版本(构建 554)。 In the last two months I have come across an issue with install.package("sf") and others but will start with sf.在过去的两个月中,我遇到了 install.package("sf") 和其他问题,但将从 sf 开始。 When it asks to install from sources and I enter "No", the library won't load so I enter "Yes" and it gets an error (full error below).当它要求从源安装并且我输入“否”时,库将不会加载,因此我输入“是”并出现错误(下面的完整错误)。

ERROR: compilation failed for package 'classInt' ERROR: configuration failed for package 'units'错误:package 'classInt' 的编译失败 错误:package 'units' 的配置失败

I have redownloaded the sf, classInt, units, and udunits2 packages from this link ( https://cran.r-project.org/web/packages/available_packages_by_name.html ), choosing the r re-release arm64 versions and it still doesn't work. I have redownloaded the sf, classInt, units, and udunits2 packages from this link ( https://cran.r-project.org/web/packages/available_packages_by_name.html ), choosing the r re-release arm64 versions and it still doesn不行。

I tried following along with this https://github.com/r-spatial/sf/issues/1542 until the.configure command was not found in the terminal.我尝试跟随这个https://github.com/r-spatial/sf/issues/1542直到在终端中找不到 .configure 命令。

I then tried: brew install udunits in the Mac terminal using Homebrew and the error did not change.然后我尝试:使用 Homebrew 在 Mac 终端中 brew install udunits 并且错误没有改变。

I installed sf defining the library with udunits2 and it didn't work: install.packages("sf", configure.args = "--/Library/Frameworks/R.framework/Versions/4.2/Resources/library/udunits2")我用 udunits2 安装了定义库的 sf,但它不起作用: install.packages("sf", configure.args = "--/Library/Frameworks/R.framework/Versions/4.2/Resources/library/udunits2")

I've spent over a full day troubleshooting and I'm not sure what to try next.我花了一整天的时间进行故障排除,但我不确定接下来要尝试什么。

Any help is appreciated!任何帮助表示赞赏!

> install.packages("sf", configure.args = "--/Library/Frameworks/R.framework/Versions/4.2/Resources/library/udunits2")
also installing the dependencies ‘classInt’, ‘units’

Packages which are only available in source form, and may need compilation of C/C++/Fortran: ‘classInt’ ‘units’ ‘sf’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source packages ‘classInt’, ‘units’, ‘sf’

trying URL 'https://packagemanager.rstudio.com/all/latest/src/contrib/classInt_0.4-7.tar.gz'
Content type 'binary/octet-stream' length 440183 bytes (429 KB)
==================================================
downloaded 429 KB

trying URL 'https://packagemanager.rstudio.com/all/latest/src/contrib/units_0.8-0.tar.gz'
Content type 'binary/octet-stream' length 864506 bytes (844 KB)
==================================================
downloaded 844 KB

trying URL 'https://packagemanager.rstudio.com/all/latest/src/contrib/sf_1.0-8.tar.gz'
Content type 'binary/octet-stream' length 3532612 bytes (3.4 MB)
==================================================
downloaded 3.4 MB

* installing *source* package ‘classInt’ ...
** package ‘classInt’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c fish1.f -o fish1.o
make: /opt/R/arm64/bin/gfortran: No such file or directory
make: *** [fish1.o] Error 1
ERROR: compilation failed for package ‘classInt’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/classInt’
Warning in install.packages :
  installation of package ‘classInt’ had non-zero exit status
* installing *source* package ‘units’ ...
** package ‘units’ successfully unpacked and MD5 sums checked
** using staged installation
configure: units: 0.8-0
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ -arch arm64 -std=gnu++14 accepts -g... yes
checking how to run the C++ preprocessor... clang++ -arch arm64 -std=gnu++14 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdbool.h that conforms to C99... no
checking for _Bool... no
checking for error_at_line... no
checking for gcc... clang -arch arm64
checking whether we are using the GNU C compiler... yes
checking whether clang -arch arm64 accepts -g... yes
checking for clang -arch arm64 option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... yes
checking udunits2.h usability... no
checking udunits2.h presence... no
checking for udunits2.h... no
checking udunits2/udunits2.h usability... no
checking udunits2/udunits2.h presence... no
checking for udunits2/udunits2.h... no
checking for ut_read_xml in -ludunits2... no
configure: error: in `/private/var/folders/4k/f9g3wpqj2tv7rvsmhjtkbdl80000gn/T/Rtmp6uUpFo/R.INSTALL1845f210c2dbd/units':
configure: error: 
--------------------------------------------------------------------------------
  Configuration failed because libudunits2.so was not found. Try installing:
    * deb: libudunits2-dev (Debian, Ubuntu, ...)
    * rpm: udunits2-devel (Fedora, EPEL, ...)
    * brew: udunits (OSX)
  If udunits2 is already installed in a non-standard location, use:
    --configure-args='--with-udunits2-lib=/usr/local/lib'
  if the library was not found, and/or:
    --configure-args='--with-udunits2-include=/usr/include/udunits2'
  if the header was not found, replacing paths with appropriate values.
  You can alternatively set UDUNITS2_INCLUDE and UDUNITS2_LIBS manually.
--------------------------------------------------------------------------------

See `config.log' for more details
ERROR: configuration failed for package ‘units’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/units’
Warning in install.packages :
  installation of package ‘units’ had non-zero exit status
ERROR: dependencies ‘classInt’, ‘units’ are not available for package ‘sf’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/sf’
Warning in install.packages :
  installation of package ‘sf’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/4k/f9g3wpqj2tv7rvsmhjtkbdl80000gn/T/RtmpPnpNin/downloaded_packages```

After installing gdal with homebrew, I used the link @wkl sent and the code install.packages('sf', configure.args = '--with-proj-include=/opt/homebrew/include/ --with-proj-lib=/opt/homebrew/lib/', configure.vars = 'GDAL_DATA=/opt/homebrew/opt/gdal/share/gdal/') I am still having problems with other packages but sf loaded.用 homebrew 安装 gdal 后,我使用了链接 @wkl sent 和代码install.packages('sf', configure.args = '--with-proj-include=/opt/homebrew/include/ --with-proj-lib=/opt/homebrew/lib/', configure.vars = 'GDAL_DATA=/opt/homebrew/opt/gdal/share/gdal/')我仍然遇到其他软件包的问题,但加载了 sf。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM