在 RStudio 中加载 rgdal 时遇到问题

发布于 2024-12-11 06:27:41 字数 2102 浏览 0 评论 0原文

为什么 rgdalRStudio (0.94.110) 中无法加载,但在 R (2.13.2) 中却无法加载?

abarbour% R

R version 2.13.2 (2011-09-30)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

[编辑以删除无关信息]

> library(rgdal)
Loading required package: methods
Loading required package: sp
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.8.1, released 2011/07/09
Path to GDAL shared files: /Library/Frameworks/GDAL.framework/Versions/1.8/Resources/gdal
Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
Path to PROJ.4 shared files: (autodetected)

但是,在 RStudio 中:

R version 2.13.2 (2011-09-30)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

[再次编辑]

> library(rgdal)
Loading required package: methods
Loading required package: sp
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Users/abarbour/kook.processing/R/PACKAGES/rgdal/libs/x86_64/rgdal.so':
  dlopen(/Users/abarbour/kook.processing/R/PACKAGES/rgdal/libs/x86_64/rgdal.so, 6): Symbol not found: ___emutls_get_address
  Referenced from: /usr/local/lib/libstdc++.6.dylib
  Expected in: /Library/Frameworks/R.framework/Resources/lib/libgcc_s.1.dylib
 in /usr/local/lib/libstdc++.6.dylib
Error: package/namespace load failed for 'rgdal'

有人知道为什么会发生这种情况吗?是否有某种我不知道的 RStudio 默认设置?

请注意,rgdal 是使用以下命令安装的,并且已经安装了 KyngChaos (GDAL完整框架):

sudo R CMD INSTALL --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/unix/bin/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib' rgdal_0.7-1.tar.gz

Why is rgdal failing to load in RStudio (0.94.110) but not in R (2.13.2)?

abarbour% R

R version 2.13.2 (2011-09-30)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

[edited to remove extraneous info]

> library(rgdal)
Loading required package: methods
Loading required package: sp
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.8.1, released 2011/07/09
Path to GDAL shared files: /Library/Frameworks/GDAL.framework/Versions/1.8/Resources/gdal
Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
Path to PROJ.4 shared files: (autodetected)

But, in RStudio:

R version 2.13.2 (2011-09-30)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

[again, edited]

> library(rgdal)
Loading required package: methods
Loading required package: sp
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Users/abarbour/kook.processing/R/PACKAGES/rgdal/libs/x86_64/rgdal.so':
  dlopen(/Users/abarbour/kook.processing/R/PACKAGES/rgdal/libs/x86_64/rgdal.so, 6): Symbol not found: ___emutls_get_address
  Referenced from: /usr/local/lib/libstdc++.6.dylib
  Expected in: /Library/Frameworks/R.framework/Resources/lib/libgcc_s.1.dylib
 in /usr/local/lib/libstdc++.6.dylib
Error: package/namespace load failed for 'rgdal'

Anyone know why this is happening? Is there some sort of RStudio default that I don't know about?

Note that rgdal was installed using the following command, having already installed the KyngChaos (GDAL Complete framework):

sudo R CMD INSTALL --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/unix/bin/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib' rgdal_0.7-1.tar.gz

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼眸 2024-12-18 06:27:41

归功于 RStudio 支持人员的 Josh(请参阅 讨论)。

RStudio 中:

> setRepositories()

[输入“1 2”]

> install.packages("rgdal")
> library(rgdal)

给出正常的加载行为:

> library(rgdal)
Loading required package: methods
Loading required package: sp
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.8.0, released 2011/01/12
Path to GDAL shared files: /Users/abarbour/kook.processing/R/PACKAGES/rgdal/gdal
Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
Path to PROJ.4 shared files: /Users/abarbour/kook.processing/R/PACKAGES/rgdal/proj

Credit due to Josh from the RStudio support staff (see the discussion).

From within RStudio:

> setRepositories()

[enter "1 2"]

> install.packages("rgdal")
> library(rgdal)

gives the normal load behavior:

> library(rgdal)
Loading required package: methods
Loading required package: sp
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.8.0, released 2011/01/12
Path to GDAL shared files: /Users/abarbour/kook.processing/R/PACKAGES/rgdal/gdal
Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
Path to PROJ.4 shared files: /Users/abarbour/kook.processing/R/PACKAGES/rgdal/proj
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文