Given a debian source package - How do I install the build-deps?

27,154

Solution 1

Actually I can use dpkg-checkbuilddeps which shows the build dependencies. That gets me 99% of what I need

Solution 2

Use mk-build-deps which is part of devscripts.

Solution 3

Here is an example workflow using ptman's suggestion.

Assuming you have downloaded the .dsc file, the .orig.*z file, and maybe also a .debian.*z file, then unpack the source package with:

dpkg-source -x [package_name]_[package_version].dsc

Move into the extracted source folder and run:

sudo mk-build-deps -i

This will create the file [package_name]-build-deps_[version].deb and install it, and also install all the dependencies it suggests.

Now you should be able to build your package from source:

debuild

When you are finished, you can easily remove the dependencies that were pulled in, by removing the build-deps package which you generated:

sudo apt-get purge --auto-remove [package_name]-build-deps

Solution 4

I usually use debuild from devscripts to build packages, and if relevent it prints a line of the missing build-deps.

The "proper" way is to use pbuilder or similar which will build the package in a minimal chroot, and just install any additional build-deps as specified by the package, this also removes a bunch of other potential issues (local installations of non-packaged libraries for example).

Share:
27,154

Related videos on Youtube

Araejay
Author by

Araejay

Updated on September 17, 2022

Comments

  • Araejay
    Araejay over 1 year

    I have a debian (well technically ubuntu) source package, i.e. the .dsc, the .tar.gz, etc., I want to build this. The dpkg-buildpackage fails, since I don't have all the build dependencies.

    Normally I'd use apt-get build-dep, but this package isn't in apt.

    Is there a 'clean', 'proper' way to install all the build dependencies, given a source package. I know I could just open the debian/control file, but I'm curious if there's a 'proper' way.

    I have installed build-essential, and have all the normal compilers etc., this package requires extra software.

  • Araejay
    Araejay about 14 years
    I have install build-essential. This package requires extra software.
  • Lanselot
    Lanselot about 14 years
    And it doesn't explain what requires? maybe libncurses-dev also.
  • Matthias Urlichs
    Matthias Urlichs over 8 years
    That's not the point; of course it does. The point is to have a command that actually installs the dependencies, not one that just displays them.
  • Lucas
    Lucas over 6 years
    You can also pass -r to sudo mk-build-deps -i to remove the package after installing it. Also, instead of building as root, you can install as root using --root-cmd sudo. In the end, use mk-build-deps --install --root-cmd sudo --remove
  • Srinivaso
    Srinivaso almost 5 years
    Also, you may need to sudo apt install devscripts equivs first.
  • ayao1337
    ayao1337 about 3 years
    For those looking to create a source package for normal depends, use equivs-build. This would be the "other half" of mk-build-deps.