install.packages() 找不到共享的 .so 对象文件



任何人都可以提出前进的路吗?

尝试安装udunit2(r package(时,我在下面的错误中表明它找不到共享对象文件。我缺少有环境变量吗?

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

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

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系统(SO,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之外,它只允许您运行 run 共享对象代码,但不能链接到它。

apt-get示例表示歉意,我没有快速的方法来为您搜索yum该原理保持相同:您需要匹配的-dev软件包。

尝试以下:

在R控制台中,运行:

Sys.setenv(UDUNITS2_LIBS="/path/to/udunits2/lib")
Sys.setenv(UDUNITS2_INCLUDE="/path/to/udunits2/include")

然后

install.packages("udunits2")

update

此解决方案不再对我有用。从Ubuntu存储库中安装libudunits-dev工作。

相关内容

最新更新