簡體   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’

我正在使用帶有 M1 芯片的 MacOS Monterey 並擁有 R 4.2.1 arm64 版本(構建 554)。 在過去的兩個月中,我遇到了 install.package("sf") 和其他問題,但將從 sf 開始。 當它要求從源安裝並且我輸入“否”時,庫將不會加載,因此我輸入“是”並出現錯誤(下面的完整錯誤)。

錯誤: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不行。

我嘗試跟隨這個https://github.com/r-spatial/sf/issues/1542直到在終端中找不到 .configure 命令。

然后我嘗試:使用 Homebrew 在 Mac 終端中 brew install udunits 並且錯誤沒有改變。

我用 udunits2 安裝了定義庫的 sf,但它不起作用: install.packages("sf", configure.args = "--/Library/Frameworks/R.framework/Versions/4.2/Resources/library/udunits2")

我花了一整天的時間進行故障排除,但我不確定接下來要嘗試什么。

任何幫助表示贊賞!

> 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```

用 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