What are "build-essential" & "build-dep"?

69

25

I am researching how to install Ruby 1.9.1 in Xubuntu 10.04 and I came across the command build-essential and build-dep multiple times. Sometimes it is followed by packages and sometimes it is both preceded and post-ceded by packages.

The 2 examples I am looking at are:

sudo apt-get install build-essential zlib1g zlib1g-dev zlibc libruby1.9 libxml2 libxml2-dev libxslt-dev

sudo apt-get build-dep ruby1.9

and

sudo apt-get install ruby irb ri rdoc ruby1.8-dev libzlib-ruby libyaml-ruby libreadline-ruby libncurses-ruby libcurses-ruby libruby libruby-extras libfcgi-ruby1.8 build-essential libopenssl-ruby libdbm-ruby libdbi-ruby libdbd-sqlite3-ruby sqlite3 libsqlite3-dev libsqlite3-ruby libxml-ruby libxml2-dev

classer

Posted 2010-06-10T21:04:09.987

Reputation: 2 465

3Note that it's not a command, but a package in the Debian package system (APT). You could also acquire the package using GUI tools. – None – 2010-06-10T21:14:48.047

Thanks. How does it relate to Ruby though? I assume Ruby needs it to run but maybe I am wrong. – classer – 2010-06-10T22:01:39.007

Answers

51

The build-essential package is a reference for all the packages needed to compile a Debian package. It generally includes the GCC/g++ compilers and libraries and some other utilities.

Check out the documentation here.

Ismael

Posted 2010-06-10T21:04:09.987

Reputation: 650

7This answer is wrong. The answer below is the correct one. build-dep is an apt-get command and build-essential is a package. – David – 2014-08-03T13:03:56.937

2Ok but that still does not answer my question fully. I understand that 'build-essential' contains an informational list of packages which are essential for creating Debian packages. But what is considered a Debian package? Ruby? gcc/g++ compilers? And how does Debian packages and 'build-essential" relate to Ruby? Is Ruby built on top of the Debian package? Put another way, does Ruby need the build-essential package to run? I really wish to see a visual representation of the relationships between all these parts. – classer – 2010-06-10T22:00:26.510

3To put it simply, if you ( or some other package you want to install ) need a C/C++ compiler, you need to install build-essential. Usually it's the first thing I install in a new Ubuntu installation :-) – None – 2010-06-10T23:13:10.400

4@Adam Since Ruby is an interpreted language, the interpreter needs the C or C++ compiler to build itself to run on your machine. build-essential is a metapackage (a package that installs many other packages, like g++ and gcc: the GNU C & C++ compilers). It's required if you want to compile anything from source, and if you want to work with almost any programming language. HTH! – squircle – 2010-06-11T20:03:17.887

@Ismael @thepurplepixel great information, thanks – classer – 2010-06-11T23:44:55.490

2This is not the correct answer. The link provided gives no insight or explanation as to what is in the build-essential package. – andDevW – 2018-07-27T15:44:45.373

Cross: Errors while compiling with CMake

– Peter Mortensen – 2018-08-31T15:56:28.137

59

The command sudo apt-get build-dep packagename means "As root, install all dependencies for 'packagename' so that I can build it". So build-dep is an apt-get command just like install, remove, update, etc.

build-essential is a package which contains references to numerous packages needed for building software in general.

Kleist

Posted 2010-06-10T21:04:09.987

Reputation: 691

1Thanks for explaining the 'build-dep' command. So as I understand it, in this case Ruby1.9 has a dependency list attached to it that Linux looks to as a 'To Do/Build List' and one by one builds each of those items. The final infrastructure that gets built allows Ruby1.9 to function properly.

What I do not understand is why 'build-essential' ,or all of the other packages in the top line( zlib1g zlib1g-dev zlibc libruby1.9 etc. etc.), would not be included in the 'To Do/Build List' attached to Ruby1.9. Wouldn't it be simpler if there was just one command? – classer – 2010-06-10T22:11:53.860

6

build-essential has one magical property: it does not need to be listed as a build dependency under the Build-Depends control field (debian-packages) of source packages as documented at https://www.debian.org/doc/debian-policy/ch-source.html#s-pkg-relations

You can get a list of the build-essential packages at:

cat /usr/share/doc/build-essential/list

You can also determine if a package is part of build-essential with:

apt-cache show gcc

which says:

Build-Essential: yes

Ciro Santilli 新疆改造中心法轮功六四事件

Posted 2010-06-10T21:04:09.987

Reputation: 5 621

1+1 for pointing out where the list can be found. The build-essential package description states that "This package contains an informational list of packages which are considered essential for building Debian packages," but does not mention where that list is. I found /usr/share/doc/build-essential/list among the output of apt-file show build-essential, but is there a better way to get this information (like a help file or man page for the package)? – user001 – 2020-01-01T19:00:58.163

1@user001 I don't know. apt-file show is almost as good as man for me these days XD – Ciro Santilli 新疆改造中心法轮功六四事件 – 2020-01-01T19:54:28.800

4

"build-essential" contains tools (like the gcc compiler, make tool, etc) for compiling/building software from source. So you start with (usually C) source files and create executables from them.

If you are just trying to get Ruby installed, I would highly recommend just using RVM (Ruby Version Manager):

Follow the instructions under "Github Repository (recommended)"

Note that you will need the Git version control software installed first. Use apt-get install git-core if you don't have that yet.

Doug

Posted 2010-06-10T21:04:09.987

Reputation: 151