Seyed Omid Nabavi
Seyed Omid Nabavi

Reputation: 497

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.

Upvotes: 4

Views: 2501

Answers (4)

Siebren
Siebren

Reputation: 53

I had the same error. From your combined answers I figured it was Conda. Fix:

  • conda deactivate
  • make distclean, configure and make

Upvotes: 3

m4hmud
m4hmud

Reputation: 39

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

Upvotes: 3

Seyed Omid Nabavi
Seyed Omid Nabavi

Reputation: 497

I could figure it out by reinstalling R using conda. Not only R but, other needed libraries and rstudio can be installed easily through conda. For example R, rstudio, and plotly (a library) are installed through following command:

conda install -c r r-essentials —-prefix=/where/to/install
conda install -c r rstudio  —-prefix=/where/to/install
conda install -c conda-forge r-plotly —-prefix=/where/to/install

Enjoy.

Upvotes: 0

Bruno Haible
Bruno Haible

Reputation: 1282

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

Upvotes: 5

Related Questions