gpt4 book ai didi

r - install.packages() 找不到共享的 .so 目标文件

转载 作者:行者123 更新时间:2023-12-05 08:18:47 39 4
gpt4 key购买 nike

谁能提出前进的道路?

在尝试安装 udunit2(R 包)时,我收到以下错误,表明它找不到共享对象文件。是否缺少我缺少的环境变量?

/srv/shiny-server/r-packages 是我自定义的 R 包安装目录。

我根据 https://www.unidata.ucar.edu/software/udunits/udunits-current/doc/udunits/udunits2.html#Obtain 安装了 udunits2

udunits2 用作命令行工具。

更新:libudunits2.so.0 似乎存在于我的系统上:

$ la /usr/local/lib
total 568
drwxr-xr-x. 3 root root 4096 Apr 4 14:56 ./
drwxr-xr-x. 12 root root 4096 Dec 8 2016 ../
-rw-r--r--. 1 root root 199466 Apr 4 14:56 libudunits2.a
-rwxr-xr-x. 1 root root 889 Apr 4 14:56 libudunits2.la*
lrwxrwxrwx. 1 root root 20 Apr 4 10:04 libudunits2.so -> libudunits2.so.0.1.0*
lrwxrwxrwx. 1 root root 20 Apr 4 10:04 libudunits2.so.0 -> libudunits2.so.0.1.0*
-rwxr-xr-x. 1 root root 131080 Apr 4 10:04 libudunits2.so.0.1.0*

我正在使用安装了 DevToolSet-7 的 Red Hat Enterprise 6.9 系统(因此,g++ 7.2.1)。

> install.packages("udunits2")
Installing package into ‘/srv/shiny-server/r-packages’
(as ‘lib’ is unspecified)
trying URL 'http://cran.us.r-project.org/src/contrib/udunits2_0.13.tar.gz'
Content type 'application/x-gzip' length 67182 bytes (65 KB)
==================================================
downloaded 65 KB

* installing *source* package ‘udunits2’ ...
** package ‘udunits2’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
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 gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... yes
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... 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 udunits2.h usability... yes
checking udunits2.h presence... yes
checking for udunits2.h... yes
checking for ut_read_xml in -ludunits2... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/local/lib64/R/include -DNDEBUG -I/usr/local/include -fpic -I/include -c udunits2_R.c -o udunits2_R.o
gcc -std=gnu99 -shared -L/lib -o udunits2.so udunits2_R.o -ludunits2 -lexpat -lexpat -ludunits2
installing to /srv/shiny-server/r-packages/udunits2/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/srv/shiny-server/r-packages/udunits2/libs/udunits2.so':
libudunits2.so.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/srv/shiny-server/r-packages/udunits2’

The downloaded source packages are in
‘/tmp/RtmpRqD9L6/downloaded_packages’
Warning message:
In install.packages("udunits2") :
installation of package ‘udunits2’ had non-zero exit status

最佳答案

您误读了错误消息。它实际上说

libudunits2.so.0: cannot open shared object file: No such file or directory

您可以通过执行 RHEL 中的等价物来解决这个问题

sudo apt-get install libudunits2-dev

除了 libudunits2 之外,要获取构建 所需的 header 和可链接库,您可能已经拥有它,它只允许您运行 共享对象代码, 但不是针对它的链接。

对于 apt-get 示例,我深表歉意,我没有快速的方法来为您搜索 yum原则保持不变:您需要匹配的 -dev 包。

关于r - install.packages() 找不到共享的 .so 目标文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49657406/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com