我想从源代码编译Nginx 1.9.8并将其安装在Ubuntu 14.04服务器上.但是,这适用于任何软件,如何确定我需要在本地系统上安装哪些依赖项才能构建软件?
说我想编译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]