How do I find the dependencies when building software from source?

Solution 1:

the proviso

I'm assuming that you are using a recent version of ubuntu such as 12.04. The versions in the repository are considered stable - so perhaps you may wish to use that version.

However if you like living on the cutting-edge - compiling or installing from a PPA is the way-to go. Just remember, this route can leave your system in a potential unstable state.

how to compile

The dependencies you need to install this are as follows:

sudo apt-get install autotools-dev intltool libbluetooth-dev libcurl4-gnutls-dev libexif-dev libgconf2-dev libglade2-dev libgps-dev libgtk2.0-dev  libsoup2.4-dev  libsqlite3-dev libxml2-dev

Remember also to install the package build-essential i.e.

sudo apt-get install build-essential

so how did I know that

... well I sort of cheated.

Search on packages.ubuntu.com for your package - I looked for foxtrotgps in the Quantal repository.

enter image description here

Look at the resources and look for the debian.tar.xz file. Click on it - it will open in the archive manager. Navigate to the control file in the debian folder.

enter image description here

In the build-depends section are the packages Launchpad needs to build the source - its the same packages you need to install.

Solution 2:

Sometimes you can compile a new version without using the PPAs for the source dependencies, and use the great build-dep feature in Ubuntu. Make sure you have the source packages selected and have this line in your sources.list file:

deb-src http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse

You can check by entering in the terminal cat /etc/apt/sources.list.

I have successfully compiled Stellarium 0.11.3, Scummvm 1.5.0, and others by obtaining the dependencies with build-dep; for example:

sudo apt-get build-dep scummvm

For packages already in the repositories, you can check dependencies with:

apt-cache show foxtrotgps

and compare that with the dependencies required for the newer version, which will be listed on the program's website, or in a readme with the source code download.

Usually when obtaining the dependencies via the build-dep method you must then download the stable source code from the site of the program, and not the development or git version. It will not always be possible to compile a new version in this way, but it is worth trying. (Gimp 2.8, for example, requires a later version of Gtk and that can't be met by using the source files for Precise.)

However, I have used the build-dep method successfully for Foxtrotgps; simply follow these steps (assuming you have installed build-essential):

  • Download the most recent stable source code (version 1.1.1 at the moment) from the Foxtrot site

  • Open the terminal and enter sudo apt-get build-dep foxtrotgps

  • Uncompress the downloaded source code with tar xzvf <file> and cd to the foxtrot folder. Then run the following three commands:
  • ./configure
  • make
  • sudo checkinstall (install checkinstall if you don't have it, or use sudo make install)

Below is a screenshot of the compiled program, foxtrotgps:

foxtrot