Trying to install R 4.x from source but getting the error "../../lib/libR.so: undefined reference to `u_versionToString_58'"

I'm trying to compile and install R version 4 on my computer which is running Ubuntu 18.04.
I'm currently following these instructions Posit - Install R from Source - Posit Documentation
Using the Ubuntu/Debian tabs.

Everything runs as expected at first. However when I get to the make line I get the following errors.

../../lib/libR.so: undefined reference to `u_versionToString_58'
../../lib/libR.so: undefined reference to `u_getVersion_58'
../../lib/libR.so: undefined reference to `uloc_setDefault_58'
../../lib/libR.so: undefined reference to `ucol_setStrength_58'
../../lib/libR.so: undefined reference to `ucol_open_58'
../../lib/libR.so: undefined reference to `libiconv'
../../lib/libR.so: undefined reference to `ucol_close_58'
../../lib/libR.so: undefined reference to `libiconv_close'
../../lib/libR.so: undefined reference to `ucol_strcollIter_58'
../../lib/libR.so: undefined reference to `_libiconv_version'
../../lib/libR.so: undefined reference to `libiconv_open'
../../lib/libR.so: undefined reference to `ucol_setAttribute_58'
../../lib/libR.so: undefined reference to `uiter_setUTF8_58'
../../lib/libR.so: undefined reference to `ucol_getLocaleByType_58'
collect2: error: ld returned 1 exit status
Makefile:150: recipe for target 'R.bin' failed

I've found some other references to this problem elsewhere, but people seem to have slightly different systems to mine in these cases.

Similar Posts:

This post is similar, and has no posted solution:
Someone suggested compiling in docker, but that sounds ... challenging

I tried running

 ./configure \
    --prefix=/opt/R/${R_VERSION} \
    --enable-R-shlib \
    --enable-memory-profiling \
    --with-blas \
    --with-lapack \
	LDFLAGS="-L/home/jacob/Programs/icu-release-58-3"

Where I had downloaded but not extracted icu-release. However, I get the same error on make.

Any suggestions about how I move forward and get the installation to work? Thanks all.

You're much better off installing the binary, but if you have a specific need to install from source:

  1. Avoid Anaconda if using
  2. Make sure that your $PATH variable picks up the correct version of the programs called by makefile
  3. Make sure you have libconv; the following may help
sudo apt update
sudo apt install gdebi-core

Thanks! I think I could use the binary approach, since I realy just need multiple r-versions rather to install locally. I'm still running Ubuntu 18.04 and it seems like the binary requires at least Ubuntu version 20. Does this mean its time to update my OS or is there a work-around?

I'm unfortunately stuck using Anaconda on my system, as its required for other elements of my work-flow. apt install gdebi-core didn't magicly fix anything. I'll look into $PATH

Thanks!

Sorry, I didn't mean to abandon Anaconda, just avoid using it as an R package manager. I've seen lots of problems using it for that, but no enthusiastic endorsements.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.