unamourdeswann
unamourdeswann

Reputation: 487

Binding with libiconv failed while compiling R-devel on Ubuntu 17.04

I have been spending one day to try to compile R-devel. I have used this post to do so.

Regardless of what I do, I have:

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

add many other similar lines, similar to the last comment of this post.

Obviously, I have:

$ sudo apt install libc6-dev
libc6-dev is already the newest version (2.24-9ubuntu2.2).

The configuration step regarding libiconv seems ok:

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);

The command iconv -l seems to work fine. The C file described in this other post compiles with no problem either.

Where should I look? I use Gnome Ubuntu 17.04.

Upvotes: 1

Views: 885

Answers (2)

unamourdeswann
unamourdeswann

Reputation: 487

Gotcha!

The problem was a conflict with Conda. Removing the Conda directory solved the problem.

Upvotes: 1

Dirk is no longer here
Dirk is no longer here

Reputation: 368241

Well, well, well: I have been doing for probably a decade or more and there are some older posts of mine floating. In fact, the blog post you use references my script via a five-year old email -- these still work for me.

My current version is attached below. I have been building this all these years on "whatever is the current Ubuntu version", with a slight upgrade delay. So like you I am currently on 17.04, and I just use libicu-dev which gets we the libicu57 runtime.

That said, you also get r-devel "prebuilt" via Docker images from our Rocker project. This this recent arXiv preprint descrining the project, and mentioning r-devel and drd, both available from hub.docker.com.

My script follows. There is no magic in. You may need to remove the ccache or install 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'"

And for what it is worth I get the exact same iconv message which appears to be just informative:

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 

Your problem, then, seems to be that you lack libiconv-dev, and presumably many more such -dev packages: it is not just libc6-dev.

Edit: Come to think about it, the aforementioned Dockerfiles are probably a good proxy for the packages you need. See eg here for the corresponding 43 lines (!!) from drd.

Upvotes: 1

Related Questions