3

I'd like to compile Nginx 1.9.8 from source and install it on a Ubuntu 14.04 server. However, and this goes for any software, how do I figure out which dependencies I need to install on my local system in order to build the software?

Say I'd like to compile Nginx. I can always do aptitude show nginx to get dependencies for the current package available through a repository. On the other hand, this may not be a correct list as the repository may offer an old version where dependencies are different from the new version I'd like to compile.

In general, how do I collect the list of dependencies I need to have installed on a system for a given piece of software?

Given that the dependencies may differ based on the compilation options I provide, is this a matter of "trial and error". That is, should I attempt to compile, then wait for the first error, see what it complains about, add that dependency, and do the same iteration again?

sbrattla
  • 1,456
  • 3
  • 26
  • 48

1 Answers1

3

if you are lucky enough to have the software in your repositories, you can install dependencies with apt:

root # apt-get build-dep nginx 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libgd-dev' instead of 'libgd2-dev'
Note, selecting 'liblua5.1-0-dev' instead of 'liblua5.1-dev'
The following NEW packages will be installed:
  autotools-dev debhelper dh-apparmor dh-systemd geoip-bin gettext
  intltool-debian libcroco3 libfontconfig1-dev libfreetype6-dev libgd-dev
  libgeoip-dev libice-dev libice6 libjbig-dev libjpeg-dev libjpeg-turbo8-dev
  libjpeg8-dev liblua5.1-0 liblua5.1-0-dev liblzma-dev libmhash-dev libmhash2
  libpam0g-dev libpcre3-dev libpcrecpp0 libperl-dev libpng12-dev
  libpthread-stubs0-dev libreadline-dev libreadline6-dev libsm-dev libsm6
  libtiff5-dev libtiffxx5 libtinfo-dev libunistring0 libvpx-dev libx11-dev
  libxau-dev libxcb1-dev libxdmcp-dev libxml2-dev libxpm-dev libxslt1-dev
  libxt-dev libxt6 pkg-config po-debconf x11-common x11proto-core-dev
  x11proto-input-dev x11proto-kb-dev xorg-sgml-doctools xtrans-dev
0 upgraded, 55 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.6 MB of archives.
After this operation, 54.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Ayush
  • 245
  • 1
  • 3
  • 10
  • But then again, what if the nginx in my repositories is a different version from the one I'd like to install? I can't be sure the dependencies have not changed. – sbrattla Dec 09 '15 at 10:42
  • most of the times, small version changes do compile with same deps. I don't think there is a way to determine dependencies for an arbitary version – Ayush Dec 09 '15 at 10:44
  • Alright...so if I try to compile a piece of software which is not in any repository, it's a matter of some detective work then to figure out dependencies... – sbrattla Dec 09 '15 at 11:23
  • 3
    Yes. That's what package maintainers do. Typically, reading the docs will give some reasonable hints. – womble Dec 09 '15 at 11:28
  • if it's not in any ppa with source listings, then yes – Ayush Dec 09 '15 at 11:28