【问题标题】:Binding with libiconv failed while compiling R-devel on Ubuntu 17.04在 Ubuntu 17.04 上编译 R-devel 时与 libiconv 绑定失败
【发布时间】:2017-10-24 09:59:44
【问题描述】:

我花了一天时间尝试编译 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。

【问题讨论】:

    标签: r compiler-errors


    【解决方案1】:

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

    我的当前版本附在下面。这些年来,我一直在“无论当前的 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 可能是你需要的包的一个很好的代理。有关来自 drd 的相应 43 行 (!!),请参见例如 here

    【讨论】:

    • 好像没有libiconv-dev这个包?命令$ sudo apt install libiconv-dev 给出E: Unable to locate package libiconv-dev,它确认this post。不过会尝试 Docker 解决方案。
    • 抱歉,我在考虑/混淆libculibiconv。 Iconc 确实带有 libc6 methinks。但是你的问题基本上是一样的:缺少 Depends。
    • 好吧,打败了我,但我可以向你保证,我在 Debian 上构建 R 本身已经有 20 多年了(并且大部分时间都在维护它)。有用。您可能有较早的错误,或者您混合使用 i386 和 amd64 库,或者...
    • 很可能是真的,但我不知道在哪里......而且我确实在 2 个月前安装了 R devel,没有问题。哦!
    • 您可以访问我们为 Debian 和 Ubuntu 提供的 r-sig-debian 邮件列表,人们可以为您提供帮助。
    【解决方案2】:

    明白了!

    问题在于与 Conda 的冲突。 删除 Conda 目录解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-11
      • 2016-10-26
      • 1970-01-01
      • 2017-03-03
      • 2017-09-20
      • 2011-05-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多