微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

安装 rgdal MacOS 时出错 - 仍然

如何解决安装 rgdal MacOS 时出错 - 仍然

有很多关于安装 rgdal 包的问题的帖子。我经历了很多,尝试了许多推荐的解决方案,但仍然遇到问题。我在 OS10.15.7 (Catalina) 下的 Mac 上使用 R4.0.3。我使用 MacPorts 进行包管理。我包括了我使用的 R 命令和下面的结果,但将首先突出显示似乎是问题的内容

  1. 错误“无法定位 'svnversion'。我不明白这一点,因为输出中的前一行显示为“正在检查 /usr/bin/svnversion...是”并使用终端“which svnversion " 产生 "/usr/bin/svnversion"。有关命令行工具的后续消息已在别处讨论过,我已按照建议删除 COMMAND_TOOLS 目录并安装独立版本;这没有区别。

  2. gdal 配置?它存在并且是可执行的,但是在系统对 gdal-config 可用性检查回答“是”之前会出现此文本“cat: inst/SVN_VERSION: No such file or directory”。在网上寻找那个特定的信息没有任何帮助(至少对我来说)。

  3. pkg-config 项目?我使用 MacPorts 安装了项目

    % sudo 端口安装项目

密码: ---> 清洁项目 ---> 扫描二进制文件以查找链接错误 ---> 未找到损坏的文件
---> 未找到损坏的端口。

但是系统好像在找proj.pc。那是什么?

  1. pkg-config:找不到命令但是

    % which pkg-config

/opt/local/bin/pkg-config

我已经玩了几天了,非常感谢您的帮助,即使它只是将我指向我可能错过的以前的帖子。

从 R 内部发出命令

install.packages("rgdal",type="source",repos="http://R-Forge.R-project.org",configure.args=c('--with-gdal-config=/opt/local/bin/gdal-config'))

结果:

Installing package into ‘/Users/blesht/Library/R/4.0/library’
(as ‘lib’ is unspecified)
trying URL 'http://R-Forge.R-project.org/src/contrib/rgdal_1.5-19.tar.gz'
Content type 'application/x-gzip' length 4375551 bytes (4.2 MB)
==================================================
downloaded 4.2 MB

* installing *source* package ‘rgdal’ ...
** using staged installation
configure: R_HOME: /Library/Frameworks/R.framework/Resources
configure: CC: clang -mmacosx-version-min=10.13
configure: CXX: clang++ -mmacosx-version-min=10.13 -std=gnu++11
configure: CFLAGS: -Wall -g -O2
configure: CPPFLAGS: -I/usr/local/include
configure: CXXFLAGS: -Wall -g -O2
configure: LDFLAGS: -L/usr/local/lib
configure: LDFLAGS: -L/usr/local/lib
configure: CXX11 is: clang++ -mmacosx-version-min=10.13,CXX11STD is: -std=gnu++11
configure: CXX is: clang++ -mmacosx-version-min=10.13 -std=gnu++11
configure: C++11 support available
configure: rgdal: 1.5-19
checking for /usr/bin/svnversion... yes
svnversion: error: Failed to locate 'svnversion'.
svnversion: error: The subversion command line tools are no longer provided by Xcode.
configure: svn revision: 
configure: gdal-config set to /opt/local/bin/gdal-config
checking gdal-config exists... yes
checking gdal-config executable... yes
checking gdal-config usability... cat: inst/SVN_VERSION: No such file or directory
yes
configure: GDAL: 3.2.0
checking GDAL version >= 1.11.4... yes
checking GDAL version <= 2.5 or >= 3.0... yes
checking GDAL: linking with --libs only... yes
checking GDAL: gdal-config data directory readable... yes
checking GDAL: /opt/local/share/gdal/stateplane.csv readable... yes
configure: pkg-config proj not available
  set PKG_CONfig_PATH to the directory containing proj.pc
configure: PROJ version not determined using pkg-config proj
configure: PROJ CPP flags:  -I/Opt/local/include
configure: PROJ LIBS:  -lproj
checking PROJ header API:... yes
configure: API to be used as yet undetermined,searching ...
./configure: line 2509: pkg-config: command not found
configure: error: API to be used not found
ERROR: configuration Failed for package ‘rgdal’
* removing ‘/Users/blesht/Library/R/4.0/library/rgdal’

The downloaded source packages are in
    ‘/private/var/folders/l1/qvc9dqvn42b2y88cbyq_m3yw0000gn/T/RtmpsbrzxM/downloaded_packages’
Warning message:
In install.packages("rgdal",type = "source",repos = "http://R-Forge.R-project.org",:
  installation of package ‘rgdal’ had non-zero exit status

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。