首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >udunits2 R安装: udunits2.h未找到

udunits2 R安装: udunits2.h未找到
EN

Stack Overflow用户
提问于 2018-05-16 03:47:50
回答 3查看 4.3K关注 0票数 10

我试图在R中安装udunits2,以满足ggforce包的依赖性。但是,安装程序在检查udunits2时总是失败。我已经尝试了中的说明(udunits2devel是按这里所示安装的)。和线程,它生成相同结果作为尝试install.packages('udunits2')

我只安装了uduns2-dev就能让它在我的Mint机器上工作,但是我对Fedora还不太熟悉,也不知道是什么原因造成了这种情况。

系统信息:

费多拉28,R-3.4.4

编辑

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

代码语言:javascript
复制
* 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.
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2018-05-16 04:38:44

在Fedora上,头文件安装在/usr/include/udunits2,c.f中。这个Github问题。所提供的解决办法:

代码语言:javascript
复制
sudo yum install udunits2-devel

其次是:

代码语言:javascript
复制
install.packages("udunits2",configure.args='--with-udunits2-include=/usr/include/udunits2/')
票数 4
EN

Stack Overflow用户

发布于 2018-07-05 14:54:47

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

下载、编译和安装udunits2:

代码语言:javascript
复制
# 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更改为实际的主路径)

代码语言:javascript
复制
install.packages(
  "udunits2",
   configure.args = '--with-udunits2-include=$HOME/.local/include/'
)

在此系统上进行了测试:

代码语言:javascript
复制
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
EN

Stack Overflow用户

发布于 2019-01-11 13:02:48

作为一个未经sudo许可的超级计算机服务器用户,我发现安装udunits2 2-发展相当困难。或者,我发现spack usage.html对于安装udunits2 2&units软件包非常有用:

代码语言:javascript
复制
spack install r-udunits2
spack install r-units

Spack将自动安装依赖的软件包,我不需要自己安装udunits2 2-devel。由于我为ggforce R包安装了单元R包,而且spack无法安装ggforce,所以我需要在输入R之前加载单元,然后安装ggforce:

代码语言:javascript
复制
$source <(spack module tcl loads r-units)
$source <(spack module tcl loads r-udunits2)
$R
>install.packages("ggforce")

一切都很顺利。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50362201

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档