Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installation of R fails because of "undefined reference to `libiconv'"

I have problem with the installation of R 3.5.1. Although I have defined the path of the library "libiconv" in "cshrc", the installation fails with following message:

-L"../../lib" -lRblas -L/usr/lib/gcc/x86_64-redhat-linux/4.4.4 -lgfortran -lm   -lreadline  -lpcre -llzma -lbz2 -lz -lrt -ldl -lm
platform.o: In function `do_eSoftVersion':
/opt/local/rstudio/R-3.5.1/src/main/platform.c:3088: undefined reference to `_libiconv_version'
sysutils.o: In function `Riconv':
/opt/local/rstudio/R-3.5.1/src/main/sysutils.c:799: undefined reference to `libiconv'
/opt/local/rstudio/R-3.5.1/src/main/sysutils.c:799: undefined reference to `libiconv'
/opt/local/rstudio/R-3.5.1/src/main/sysutils.c:799: undefined reference to `libiconv'
/opt/local/rstudio/R-3.5.1/src/main/sysutils.c:799: undefined reference to `libiconv'
sysutils.o: In function `Riconv_close':
 ...

BTW, I do not have root privilege.

After 2 days of searching, I could not find the reason.

Any help would be appreciated.

like image 523
Seyed Omid Nabavi Avatar asked Sep 19 '25 05:09

Seyed Omid Nabavi


2 Answers

You seem to be using a glibc system (witnesses: a compiler which targets x86_64-redhat-linux, and the tag centos that you set).

On a glibc system, you don't need GNU libiconv, because glibc has a full-featured iconv facility already included. So just uninstall libiconv, then rebuild R from scratch (make distclean; configure; make).

like image 101
Bruno Haible Avatar answered Sep 21 '25 17:09

Bruno Haible


I figured it out by editing $PATH, make was misled by conda.

echo $PATH
:/gatk:/opt/miniconda/envs/gatk/bin:/opt/miniconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/gatk:/opt/miniconda/envs/gatk/bin:/opt/miniconda/bin:
export PATH
like image 31
m4hmud Avatar answered Sep 21 '25 17:09

m4hmud