R安装rgdal包 - 错误:在libgdal中找不到GDALAllRegister

5

我正在尝试在Fedora平台上安装R包。然而,出现了以下错误信息:configure: error: GDALAllRegister not found in libgdal
我不知道该如何处理这个错误信息。 在这篇文章中已经有了同样的问题,但是在Ubuntu平台上:
Install rgdal library in rstudio - GDALAllRegister not found in libgdal
那里的解决方案显然对我没有用。
有人能帮我解决这个问题吗?

> install.packages("rgdal")
Installiere Paket nach ‘/home/user/R/x86_64-redhat-linux-gnu-library/4.2’
(da ‘lib’ nicht spezifiziert)
versuche URL 'https://cran.rstudio.com/src/contrib/rgdal_1.6-5.tar.gz'
Content type 'application/x-gzip' length 4465310 bytes (4.3 MB)
==================================================
downloaded 4.3 MB

* installing *source* package ‘rgdal’ ...
** Paket ‘rgdal’ erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
configure: R_HOME: /usr/lib64/R
configure: CC: gcc
configure: CXX: g++ -std=gnu++14
configure: CFLAGS: -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
configure: CPPFLAGS: -I/usr/local/include
configure: CXXFLAGS: -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
configure: LDFLAGS: -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1
configure: LDFLAGS: -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1
configure: CXX17 is: g++, CXX17STD is: -std=gnu++17
configure: CXX is: g++ -std=gnu++17
configure: C++17 support available
configure: rgdal: 1.6-5
checking for /usr/bin/svnversion... no
configure: svn revision: 1199
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.5.2
checking GDAL version != 3.6.0... yes
checking GDAL version >= 1.11.4... yes
checking GDAL version <= 2.5 or >= 3.0... yes
checking GDAL: linking with --libs only... no
checking GDAL: linking with --libs and --dep-libs... no
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQcmdStatus@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQfname@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQsetNoticeProcessor@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQftable@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQcancel@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQstatus@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQftablecol@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQconnectdb@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQescapeStringConn@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `lo_close@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQputCopyEnd@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQgetvalue@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQgetisnull@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQftype@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQfmod@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `lo_creat@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQresultStatus@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `lo_read@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQexec@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQsetClientEncoding@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQgetlength@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQputCopyData@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQgetResult@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `lo_write@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQfinish@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQclear@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQerrorMessage@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQnfields@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `lo_open@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQexecParams@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQgetCancel@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQntuples@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQresultErrorMessage@RHPG_9.6'
/usr/bin/ld: /usr/lib64/libgdal.so: undefined reference to `PQfreeCancel@RHPG_9.6'
collect2: error: ld returned 1 exit status
/usr/bin/ld: cannot find -lodbcinst: No such file or directory
/usr/bin/ld: cannot find -larmadillo: No such file or directory
/usr/bin/ld: cannot find -lqhull_r: No such file or directory
/usr/bin/ld: cannot find -lgeotiff: No such file or directory
/usr/bin/ld: cannot find -lLerc: No such file or directory
/usr/bin/ld: cannot find -lpoppler: No such file or directory
/usr/bin/ld: cannot find -lgif: No such file or directory
/usr/bin/ld: cannot find -lnetcdf: No such file or directory
/usr/bin/ld: cannot find -lcfitsio: No such file or directory
/usr/bin/ld: cannot find -lhdf5: No such file or directory
/usr/bin/ld: cannot find -lgta: No such file or directory
/usr/bin/ld: cannot find -lwebp: No such file or directory
/usr/bin/ld: cannot find -ldf: No such file or directory
/usr/bin/ld: cannot find -lmfhdf: No such file or directory
/usr/bin/ld: cannot find -lopenjp2: No such file or directory
/usr/bin/ld: cannot find -lOpenEXR: No such file or directory
/usr/bin/ld: cannot find -lOpenEXRUtil: No such file or directory
/usr/bin/ld: cannot find -lImath: No such file or directory
/usr/bin/ld: cannot find -lIex: No such file or directory
/usr/bin/ld: cannot find -lkmlbase: No such file or directory
/usr/bin/ld: cannot find -lkmldom: No such file or directory
/usr/bin/ld: cannot find -lkmlengine: No such file or directory
/usr/bin/ld: cannot find -lspatialite: No such file or directory
/usr/bin/ld: cannot find -lsqlite3: No such file or directory
/usr/bin/ld: cannot find -lxerces-c: No such file or directory
/usr/bin/ld: cannot find -lmysqlclient: No such file or directory
/usr/bin/ld: cannot find -lodbc: No such file or directory
/usr/bin/ld: cannot find -lfreexl: No such file or directory
/usr/bin/ld: cannot find -logdi: No such file or directory
/usr/bin/ld: cannot find -lexpat: No such file or directory
/usr/bin/ld: cannot find -lgeos_c: No such file or directory
/usr/bin/ld: cannot find -lproj: No such file or directory
/usr/bin/ld: cannot find -ljson-c: No such file or directory
collect2: error: ld returned 1 exit status
configure: Install failure: compilation and/or linkage problems.
configure: error: GDALAllRegister not found in libgdal.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/home/user/R/x86_64-redhat-linux-gnu-library/4.2/rgdal’
Warning in install.packages :
  Installation des Pakets ‘rgdal’ hatte Exit-Status ungleich 0

3
抱歉我没有答案给你。但是想让你知道,rgdal 今年应该会被弃用。显然,我不知道你打算用它做什么,但你可能需要考虑一种替代工作流程来实现你的想法。我知道 rgdal 经常与 sp 一起使用,而其他库也依赖于它。sfsp 的一个很好的替代品,它不依赖于 rgdal - John Polo
编译失败通常是由于未安装所需的系统依赖关系引起的。在 Fedora 上自己编译软件包通常不是推荐的安装软件包的方式,因为可以通过 COPR 获取预编译的二进制文件。我在另一个问题的答案中解释了如何设置。如果您仍然想继续编译,请确保已安装 CRAN 上列出的系统要求 - shs
1个回答

2

我最近遇到了这个问题,并且通过这个response成功地恢复到以前的版本并构建了rgdal。

在您的R控制台中,输入:

packageurl <- "https://cran.r-project.org/src/contrib/Archive/rgdal/rgdal_1.6-3.tar.gz"

然后:

install.packages(packageurl, repos=NULL, type="source")


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接