r - 在 Ubuntu 17.04 上编译 R-devel 时与 libiconv 绑定(bind)失败

标签 r compiler-errors

我花了一天时间尝试编译 R-devel。
我用过这个post这样做。

不管我做什么,我都有:

[...]/src/main/sysutils.c:794: undefined reference to `libiconv'
[...]
[...]/src/main/platform.c:3052: undefined reference to `u_getVersion_54'
[...]

添加许多其他类似的行,类似于 this post 的最后一条评论.

显然,我有:
$ sudo apt install libc6-dev
libc6-dev is already the newest version (2.24-9ubuntu2.2).

关于 libiconv 的配置步骤似乎没问题:
checking iconv.h usability... yes
checking iconv.h presence... yes
checking for iconv.h... yes
checking for iconv... yes
checking whether iconv accepts "UTF-8", "latin1", "ASCII" and "UCS-*"... yes
checking for iconvlist... no
checking for iconv... yes
checking for iconv declaration...
     extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);

命令iconv -l似乎工作正常。 this other post 中描述的 C 文件编译也没有问题。

我应该去哪里看?我使用 Gnome Ubuntu 17.04。

最佳答案

好吧,好吧,好吧:我已经做了大概十年或更长时间,而且我的一些旧帖子还在 float 。事实上,您使用的博客文章通过一封已有五年历史的电子邮件引用了我的脚本——这些仍然对我有用。

我的当前版本附在下面。这些年来,我一直在“无论当前的 Ubuntu 版本是什么”上构建它,但升级略有延迟。所以和你一样,我目前在 17.04,我只使用 libicu-dev这让我们得到 libicu57运行。

也就是说,您还可以通过我们的 Rocker 项目中的 Docker 镜像获得 r-devel “预构建”。这个这个recent arXiv preprint描述项目,并提及 r-develdrd , 均来自 hub.docker.com .

我的脚本如下。没有魔法。您可能需要删除 ccache或安装ccache .

#!/bin/sh

cd ~/svn/r-devel

R_PAPERSIZE=letter              \
R_BATCHSAVE="--no-save --no-restore"        \
R_BROWSER=xdg-open              \
PAGER=/usr/bin/pager                \
PERL=/usr/bin/perl              \
R_UNZIPCMD=/usr/bin/unzip           \
R_ZIPCMD=/usr/bin/zip               \
R_PRINTCMD=/usr/bin/lpr             \
LIBnn=lib                   \
AWK=/usr/bin/awk                                \
CC="ccache gcc"                 \
CFLAGS="-ggdb -pipe -std=gnu99 -Wall -pedantic" \
CXX="ccache g++"                \
CXXFLAGS="-ggdb -pipe -Wall -pedantic"      \
FC="ccache gfortran"                \
F77="ccache gfortran"               \
MAKE="make -j4"                 \
./configure                     \
    --prefix=/usr/local/lib/R-devel         \
    --enable-R-shlib                \
    --without-blas              \
    --without-lapack                \
    --without-recommended-packages

make 

echo "*** Done -- now run 'make install'"

值得一提的是,我得到了完全相同的 iconv 消息,它似乎只是提供信息:
checking iconv.h usability... yes                                                                                                                                                                                  checking iconv.h presence... yes                                                                                                                                                                                   
checking for iconv.h... yes                                                                                                                                                                                        checking for iconv... yes                                                                                                                                                                                          
checking whether iconv accepts "UTF-8", "latin1", "ASCII" and "UCS-*"... yes                                                                                                                                       checking for iconvlist... no                                                                                                                                                                                       
checking for iconv... yes                                                                                                                                                                                          checking for iconv declaration...                                                                                                                                                                                  
         extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);                                                                                               checking wchar.h usability... yes                                                                                                                                                                                  
checking wchar.h presence... yes 

那么,您的问题似乎是您缺少 libiconv-dev ,大概还有更多这样的-dev包:不只是libc6-dev .

编辑:想想看,前面提到的 Dockerfiles 可能是你需要的包的一个很好的代理。参见例如 here对于来自 drd 的相应 43 行 (!!)。

关于r - 在 Ubuntu 17.04 上编译 R-devel 时与 libiconv 绑定(bind)失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46907554/

相关文章:

iphone - 这段代码有什么错误?

c - 第一个示例由于编译器错误而无法编译

compiler-errors - Fortran “Error:Expected expression in WRITE statement”

r - tidyR 从长到宽的数据?

r - 使用 dplyr 将函数应用于每个组并返回指定的数据帧

r - 是否正式支持使用 [-0,] 删除 R 数据框中的所有行?

linux - Bison 示例代码未编译

r - 展平具有复杂嵌套结构的列表

r - 如何设置自定义 R 安装以在 Jupyter 中使用 rpy2?

c - 如何修复 "error: expected ; , or ) before"字符串参数