A user requested installing R 4.4.1 on our Ubuntu 22.04 server. It turns out to be non-trivial because of the missing libraries. Took me several hours to figure out the problems. My installation is a standard Ubuntu. If you have a minimal installation of Ubuntu, you might need to install extra packages. Here are the steps:
Install libxt-dev
apt install libxt-dev
Intall icu4c
cd /tmp wget https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-src.tgz tar xvf icu4c-73_2-src.tgz cd icu/source ./configure make sudo make install
Install libiconv
cd /tmp wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz tar -xvzf libiconv-1.16.tar.gz cd libiconv-1.16 ./configure make sudo make install
Install R
sudo mkdir /share/apps/R/R-4.4.1 cd /tmp wget https://cloud.r-project.org/src/base/R-4/R-4.4.1.tar.gz tar xvf R-4.4.1.tar.gz cd R-4.4.1 export CPPFLAGS="-I/usr/local/include" export LDFLAGS="-L/usr/local/lib" ./configure --prefix=/share/apps/R/R-4.4.1 --with-libiconv-prefix=/usr/local make sudo make install
I have included some of the error messages when I first tried to comile R without the libraries. Just in case you search for the error messages:
Error related to libxt-dev
configure: error: --with-x=yes (default) and X11 headers/libs are not available
Errors related to icu4c
/usr/bin/ld: ../../lib/libR.so: undefined reference to `ucol_setAttribute_73' /usr/bin/ld: ../../lib/libR.so: undefined reference to `ucol_close_73' /usr/bin/ld: ../../lib/libR.so: undefined reference to `libiconv' /usr/bin/ld: ../../lib/libR.so: undefined reference to `ucol_open_73' /usr/bin/ld: ../../lib/libR.so: undefined reference to `uiter_setUTF8_73' /usr/bin/ld: ../../lib/libR.so: undefined reference to `libiconv_close' /usr/bin/ld: ../../lib/libR.so: undefined reference to `ucol_getLocaleByType_73' /usr/bin/ld: ../../lib/libR.so: undefined reference to `_libiconv_version' /usr/bin/ld: ../../lib/libR.so: undefined reference to `ucol_setStrength_73' /usr/bin/ld: ../../lib/libR.so: undefined reference to `libiconv_open' /usr/bin/ld: ../../lib/libR.so: undefined reference to `u_versionToString_73' /usr/bin/ld: ../../lib/libR.so: undefined reference to `ucol_strcollIter_73' /usr/bin/ld: ../../lib/libR.so: undefined reference to `uloc_setDefault_73' /usr/bin/ld: ../../lib/libR.so: undefined reference to `u_getVersion_73'
Errors related to libiconv
/tmp/R-4.4.1/src/main/platform.c:3630: undefined reference to `_libiconv_version' /usr/bin/ld: sysutils.o: in function `iconv_open_internal': /tmp/R-4.4.1/src/main/sysutils.c:1029: undefined reference to `libiconv_open' /usr/bin/ld: sysutils.o: in function `Riconv': /tmp/R-4.4.1/src/main/sysutils.c:1126: undefined reference to `libiconv' /usr/bin/ld: sysutils.o: in function `Riconv_close': /tmp/R-4.4.1/src/main/sysutils.c:1218: undefined reference to `libiconv_close'
This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.
Leave a Reply