Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between installing a package from source and from compiled binary [duplicate]

Tags:

r

In Debian, there are some compiled R packages in the official repositories. But one could also install a R package from source. I am interested to know why would a user prefer one method of installation to another.

like image 818
ggg Avatar asked Mar 10 '12 07:03

ggg


People also ask

What is the difference between installing software from source code and binary?

Source package include a tarball of the application's source code, and instructions on building it. When you install the package, it builds and compiles everything on-site, then installs. Binary packages have everything already built, and installing the package just takes everything out of it.

What is the difference between binaries and source?

Binary releases contain computer readable version of the application, meaning it is compiled. Source releases contain human readable version of the application, meaning it has to be compiled before it can be used.

What is the difference between installer and binary?

Binaries: .exe extension, previously compiled source code. These are compiled, don't need to compile anymore. Installer: assists with the correct installation and setup of the binaries (software). This contains binaries, but also additional resources.

What does it mean to install from source?

Installing a program "from source" means installing a program without using a package manager. You compile the source code and copy the binaries to your computer instead. Most of the time, you can download a project's source code from hosting services such as GitHub, GitLab, or Bitbucket.


3 Answers

It's sometimes preferable to 'compile' the sources on your server rather than just using an existing executable file.

This is because the compiler makes the exe file specifically for your machine so may run faster and work much better, for instance the compiler knows the processor you have so can optimise for this.

like image 95
creativetechnologist Avatar answered Oct 19 '22 22:10

creativetechnologist


I already provided a somewhat detailed answer in response to this SO question.

As an update, these days you even have lots of packages prebuilt thanks to updated cran2deb initiaives:

  • On Ubuntu you now have almost all CRAN packages prebuilt via Michael Rutter's 'cran2deb for ubuntu' ppa on Launchpad.

  • For Debian, Don Armstrong now provides a similar service (also covering BioConductor and OmegaHat) at debian-r.debian.net.

like image 2
Dirk Eddelbuettel Avatar answered Oct 19 '22 22:10

Dirk Eddelbuettel


The idea of pre-compiled R packages for Debian/Ubuntu is borrowing from Windows and MacOS. Those OSes have pre-compiled packages since they typically don't have the standard tools in standard locations for building packages from source (c and fortran compilers, latex, perl, etc.).

If there is a new release of a package on CRAN, is the pre-compiled package on Debian repos automatically updated? I believe that you better sync with CRAN. Check out the package ctv to help you manage large collections of R packages ("CRAN views"), both for installing and updating.

You need root privileges to install a pre-compiled package from the OS repos, while any regular user may install any packages using install.packages() in R (but I recommend to run sudo R, if you are the sysadmin, for installing CRAN views, so as to make them available system-wide, instead of inflating your ~/).

One inconvenient to source packages is that if you fetch many, the compiling will take extra time to install (depending on your machine). You might gain in performance from compiling, but it is not guaranteed to be noticeable.

like image 2
pbarill Avatar answered Oct 19 '22 20:10

pbarill