How can I remove all build dependencies for a particular package?
Tumbleweed writes:
For the future, I highly recommend using
mk-build-deps
... instead ofaptitude build-dep
. That leaves a package ... in your system, [which has dependencies] on the build-deps, that you can easily uninstall later.
mk-build-deps
can be installed with sudo apt install devscripts
To find out the build-dependencies of a program you can run apt-cache showsrc pkgname
and that will list, amongst other information the Build-Depends
, which are often files ending in -dev
; although it is worth checking if any of the files (particularly those not marked -dev
) are required by other programs. You could find this out by using apt-cache depends file
and apt-cache rdepends file
. The following example is for Shotwell
:
apt-cache showsrc shotwell
Build-Depends: debhelper (>= 7.0.50~), m4, valac-0.16 (>= 0.15), libgee-dev (>= 0.5.0), libgtk-3-dev (>= 3.0.11), libexif-dev (>= 0.6.16), libsqlite3-dev (>= 3.5.9), libgexiv2-dev (>= 0.4.1-1build1), libgnomevfs2-dev (>= 2.24.2), libgphoto2-2-dev (>= 2.4.2), libsoup2.4-dev (>= 2.26.0), libxml2 (>= 2.6.32), libunique-3.0-dev (>= 1.0.0), libwebkitgtk-3.0-dev (>= 1.1.5), libgudev-1.0-dev (>= 145), libdbus-glib-1-dev (>= 0.80), libraw-dev (>= 0.13.1-2), libusb-dev, libjson-glib-dev (>= 0.7.6), libgstreamer0.10-dev (>= 0.10.28), libgstreamer-plugins-base0.10-dev (>= 0.10.32), python-scour, libunity-dev, liblaunchpad-integration-3.0-dev (>= 0.1.36), librest-dev
There is a command to do it all in one go at the webupd8 site, but I have found that it doesn't seem to work reliably with the current version of Ubuntu in that it seems to remove too much. I tried it with Pinta and it suggested removing the entire mono library. There is discussion of such problems with using commands like the webupd8 one at Launchpad. Be very careful when experimenting with any 'solutions' you might find.
It is a shame that there is no autoremove
command for build-dep
installed packages.
Option 1:
Remember which packages were installed by sudo apt-get build-dep PACKAGE_NAME
and remove them after building.
Option 2:
apt-cache showsrc
gives a great deal of information about source packages, including a list of build-depends.
apt-cache showsrc PACKAGE_NAME
For example:
$ apt-cache showsrc pithos
Package: pithos
Binary: pithos
Version: 0.3.17~git07dcbd86a1
Section: python
Maintainer: Kevin Mehall <[email protected]>
Build-Depends: cdbs (>= 0.4.43), debhelper (>= 6), python, python-central (>= 0.6.11), python-distutils-extra (>= 2.10)
Architecture: all
Standards-Version: 3.8.2
Format: 1.0
Directory: pool/main/p/pithos
Files:
cdf2129923e62bb62c246965453b40bd 2023031 pithos_0.3.17~git07dcbd86a1.tar.gz
97689e8ada8be527d689f2c83415d3b0 1544 pithos_0.3.17~git07dcbd86a1.dsc
Python-Version: current
Checksums-Sha1: 35cbf3ae52922e50a0b81afcce2cd97a86afb254 2023031 pithos_0.3.17~git07dcbd86a1.tar.gz
Package-List: pithos deb python extra
Checksums-Sha256: 2b704d86f3dc1d36d180177d11e578bdcf74ea97b09b530144afe754e570b262 2023031 pithos_0.3.17~git07dcbd86a1.tar.gz
$ sudo apt-get remove cdbs debhelper python python-central python-distutils-extra
The risk with this option is that you may remove a package that is important for something besides building PACKAGE_NAME. Just read through the list of packages to be removed before going ahead.