从源代码编译软件:如何收集依赖列表?

我想从源代码编译Nginx 1.9.8并将其安装在Ubuntu 14.04服务器上。 然而,这对于任何软件都是如此,我怎么知道为了构build软件我需要在本地系统上安装哪些依赖关系

假设我想编译Nginx。 我总是可以做aptitude show nginx来获取当前软件包的依赖关系。 另一方面,这可能不是一个正确的列表,因为存储库可能会提供一个旧版本,其依赖关系与我想要编译的新版本不同。

一般来说,如何收集我需要在给定的软件上安装在系统上的依赖列表?

鉴于依赖关系可能会因我提供的编译选项而有所不同,这是“试错”的问题。 也就是说,我应该尝试编译,然后等待第一个错误,看看它有什么抱怨,添加依赖关系,并再次做同样的迭代?

如果你有足够的幸运在你的仓库中有软件,你可以用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]