How to install R version 3.2.1 – collect2: error: ld returned 1 exit status
For a full list of steps to install a version from source, skip the following lines and read on with Install from source
To install/remove the GNU R statistical computation and graphics system you need the package r-base
.
Therefore
sudo apt-get install r-base
or
sudo apt-get purge r-base
To install/remove the GNU R collection of recommended packages you need r-recommended
sudo apt-get install r-recommended
or
sudo apt-get install r-recommended
Install from source
The version 3.2.1 is in the Wily Universe repositories.
To install the version 3.2.1 on older Ubuntu versions, you have to compile the packages for yourself
-
Download and extract
cd wget https://cran.r-project.org/src/base/R-3/R-3.2.1.tar.gz sudo apt-get install tcl tcl-dev tk-dev tk tar xf R-3.2.1.tar.gz cd R-3.2.1
-
Create a Makefile with
configure
and enable shared libraries (--enable-R-shlib
) and Tcl/TK-support (--with-tcltk
)./configure --prefix=/usr/local --enable-R-shlib --with-tcltk
or simply with (without
shared libraries
)./configure
-
And start the build process
make
-
After that, install. I prefer the installation with
checkinstall
, to create and install a deb packagesudo apt-get install checkinstall sudo checkinstall
But you could also use the standard way
sudo make install
And now, you have version 3.2.1 installed
% /usr/local/bin/R
R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
>
Install RStudio Desktop
Download the latest version here, e.g.
wget https://download1.rstudio.org/rstudio-0.99.467-amd64.deb
Install via
sudo dpkg -i rstudio-0.99.467-amd64.deb
Check the install output and install missing packages, e.g. in my case
sudo apt install libjpeg62
Start RStudio via Unity Dash or GNOME Activities or via command line
/usr/lib/rstudio/bin/rstudio
niyas
I'm a Data Science Engineer with extensive experience in building Data Applications. I have built solutions for Fortune 500 companies, helping them save millions by automating insights generation from data. The current core focus of interest is Machine Learning Engineering and Data Engineering.
Updated on September 18, 2022Comments
-
niyas almost 2 years
I'm trying to install R version 3.2.1. I executed the following code
./configure --enable-R-shlib
followed by
make
command. But the following error is obtained./usr/bin/ld: ../appl/dchdc.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC ../appl/dchdc.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status
Please help me to resolve this or let me know how to remove this specific version of R. Because when I run
sudo apt-get --purge autoremove R
,E: Unable to locate package R
-
niyas almost 9 yearsThere is no typo error. I tried the above code. But I got the previous error followed by these error
make[3]: *** [libR.so] Error 1
make[3]: Leaving directory
/home/niyas/Downloads/R-3.2.1/src/main'`make[2]: *** [R] Error 2
make[2]: Leaving directory
/home/niyas/Downloads/R-3.2.1/src/main'`make[1]: *** [R] Error 1
make[1]: Leaving directory
/home/niyas/Downloads/R-3.2.1/src'`make: *** [R] Error 1
-
niyas almost 9 yearsI can install R 3.2.1 using the following code..
./configure
make
sudo make install
. But when I pass--enable-R-shlib
to the configuration script it will throw the above error. And I can't open Rstudio without enabling R-Shlib. It throws an errorIf this is a custom build of R, was it built with the --enable-R-shlib option?
-
A.B. almost 9 yearsIt's a typo
./configure--enable-R-shlib
givesbash: ./configure--enable-R-shlib: No such file or directory
-
A.B. almost 9 yearsremove your source folder and follow my instructions step by step
-
A.B. almost 9 yearsHave you started
./configure
with--enable-R-shlib
? -
niyas almost 9 yearsYes. I did exact 5 steps in your answer. And I tried to manually copy the libR.so file, but it the permission got denied. Btw, I'm the admin.
-
A.B. almost 9 yearsGive me a second, I'm building the packages again.
-
A.B. almost 9 yearsRStudio Desktop 0.99.467?
-
niyas almost 9 yearsYes. rstudio-0.99.467-amd64
-
A.B. almost 9 yearsOk, go into the source folder and start a
make uninstall; make clean
and start the whole procedure again. -
Fabby almost 9 years@Niyas: what's the result of the last command?
-
niyas almost 9 years@Fabby The source folder is in my home directory. But I can't navigate to the source folder through terminal. Is there any command? It says, there is no directory R 3.2.1, but it is there. My file path is home/R-3.2.1
-
A.B. almost 9 years
/home/R-3.2.1/
? Really? -
A.B. almost 9 yearsI hope,
/home/R-3.2.1/
is really the source folder and not your home folder. Delete the folder withsudo rm -r /home/R-3.2.1
-
niyas almost 9 yearsI said /home/R-3.2.1/ is my source folder. I executed the above command. And it says
rm: cannot remove ‘/home/R-3.2.1’: No such file or directory
. -
A.B. almost 9 yearsOk, what is the output of
sudo ls -la --escape /home
-
niyas almost 9 yearstotal 12 drwxr-xr-x 3 root root 4096 May 16 2014 . drwxr-xr-x 23 root root 4096 Feb 8 11:43 .. drwxr-xr-x 38 niyas niyas 4096 Aug 2 20:46 niyas
-
A.B. almost 9 yearsAs you can see, there is no
/home/R-3.2.1
. Remove the folder inside your home folder. I assume/home/niyas/R-3.2.1
. Thereforerm -r /home/niyas/R-3.2.1
-
niyas almost 9 yearsThanks. I have removed the directory and uninstalled R. But I can access R 3.2.1 by command line even though it is not in software center. How is that possible?
-
A.B. almost 9 yearsHow did you uninstall the program? The Software Center and an installation with
make install
are completely different things. Therefore the hint to install withcheckinstall
as you can read in my answer. -
niyas almost 9 yearsLet us continue this discussion in chat.
-
A.B. almost 9 years@Pilot6 Test test
-
niyas almost 9 years@A.B. It worked. Thanks a lot. I have been working on this for almost a week.
-
guntbert over 8 yearsYou really should explain what this does and why it will help.