【问题标题】:udunits2 R install: udunits2.h not foundudunits2 R 安装:未找到 udunits2.h
【发布时间】:2018-10-25 23:53:53
【问题描述】:

我正在尝试在 R 中安装 udunits2 以满足 ggforce 包的依赖关系。但是,安装程序在检查 udunits2 时一直失败。我已经尝试过this 中的说明(如here 所示安装了udunits 2 devel。) 和this 线程,它产生same result 试图install.packages('udunits2')

我只需安装 udunits2-dev 就可以让它在我的 Mint 机器上运行,但是我对 Fedora 还是很陌生,不确定是什么原因造成的。

系统信息:

Fedora 28,R-3.4.4

编辑

尝试使用install.packages("udunits2", configure.args = "--with-udunits2-lib=/usr/bin/udunits2") 安装时输出错误:

* installing *source* package ‘udunits2’ ...
** package ‘udunits2’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -m64
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 -m64 accepts -g... yes
checking for gcc -m64 option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... yes
checking how to run the C preprocessor... gcc -m64 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/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... no
checking udunits2.h presence... no
checking for udunits2.h... no
checking for ut_read_xml in -ludunits2... yes
-----Error: udunits2.h not found-----
     If the udunits2 library is installed in a non-standard location,
     use --configure-args='--with-udunits2-lib=/usr/local/lib' for example,
     or --configure-args='--with-udunits2-include=/usr/include/udunits2'
     replacing paths with appropriate values for your installation.
     You can alternatively use the UDUNITS2_INCLUDE and UDUNITS2_LIB
     environment variables.
     If udunits2 is not installed, please install it.
     It is required for this package.

【问题讨论】:

  • 请将命令输出添加到您的问题中(使用适当的格式)。

标签: r


【解决方案1】:

在 Fedora 上,头文件安装在 /usr/include/udunits2,c.f.这个Github issue。那里提供的解决方案:

sudo yum install udunits2-devel

接着是:

install.packages("udunits2",configure.args='--with-udunits2-include=/usr/include/udunits2/')

【讨论】:

  • 这是有道理的。谢谢!
  • @wolff 欢迎您。还请按照我的上述要求,并在您的问题中包含错误消息作为文本。这使问题更容易找到,因此对面临类似问题的其他人更有用。
  • 完成。很抱歉,下次会记住的。
  • 在安装udunits2-devel之前可能需要运行sudo yum-config-manager --enable epel
【解决方案2】:

从网站获取udunits2的源代码:ftp://ftp.unidata.ucar.edu/pub/udunits

下载、编译和安装udunits2:

# Download the library
wget ftp://ftp.unidata.ucar.edu/pub/udunits/udunits-2.2.26.tar.gz

# Decompress the archive
tar xf udunits-2.2.26.tar.gz

# Navigate to the archive
cd ./udunits-2.2.26

# Configure the build for your system
./configure prefix=$HOME/.local

# Use 4 jobs to build quickly
make -j 4

# Install to our prefix
make install

启动一个新的 R 会话并安装 udunits2 R 包:

(确保将$HOME 更改为您的实际主路径)

install.packages(
  "udunits2",
   configure.args = '--with-udunits2-include=$HOME/.local/include/'
)

在此系统上测试:

R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.5 (Santiago)

【讨论】:

    【解决方案3】:

    作为一个未经sudo yum 许可的超级计算机服务器用户,我发现安装udunits2-devel 非常困难。或者,我找到了 spack https://spack.readthedocs.io/en/latest/basic_usage.html 对于安装 udunits2&units R 包非常有用:

    spack install r-udunits2
    spack install r-units
    

    spack会自动安装依赖包,我不用自己安装udunits2-devel。 由于我为ggforce R包安装了units R包,而ggforce不能通过spack安装,我需要在进入R之前加载units,然后安装ggforce:

    $source <(spack module tcl loads r-units)
    $source <(spack module tcl loads r-udunits2)
    $R
    >install.packages("ggforce")
    

    一切都很顺利。

    【讨论】:

      猜你喜欢
      • 2021-12-07
      • 2017-07-06
      • 2018-04-14
      • 1970-01-01
      • 1970-01-01
      • 2013-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多