在运行

./configure --prefix=/mingw 

在我之前运行的一个库的MinGW/MSYS系统上

'./configure --prefix=/mingw && make && make install' 

我看到了这条信息:

警告:Vamp插件SDK的一个版本已经安装。如果您安装了新版本而没有先删除旧版本,那么您将会感到担忧和痛苦。(继续)

这让我很担心。“make install”的反义词是什么,即如何在Linux中卸载库?“清洁”能起作用吗,或者还有其他步骤吗?


当前回答

Make

Make是用来安装从源代码编译的程序的程序。它不是Linux包管理器,所以它不会跟踪它安装的文件。这使得之后很难卸载这些文件。

Make Install命令将构建的程序和包从makefile复制到库目录和指定位置。这些位置 可能会根据配置脚本执行的检查而有所不同。

CheckInstall

CheckInstall是用于安装或卸载从源代码编译的程序的程序。它监视并复制使用make程序安装的文件。它还使用Linux包管理器安装文件,这允许它像任何常规包一样卸载。

CheckInstall命令用于调用Make Install命令。它监视已安装的文件并从中创建一个二进制包。它还使用Linux包管理器安装二进制包。

将“source_location.deb”和“name”替换为屏幕截图中的信息。

在源包目录下执行以下命令:

安装CheckInstall sudo apt-get Install CheckInstall 执行配置脚本sudo ./ Configure 执行Make命令sudo Make 执行CheckInstall sudo CheckInstall命令 重新安装软件包sudo dpkg——install——force-overwrite source_location.deb 删除包sudo apt Remove name

这是我写的一篇文章,涵盖了整个过程的解释。

其他回答

Make clean通常只清理包含源代码本身的目录中的构建文件,很少涉及任何已安装的软件。

makefile通常不包含卸载目标——通常必须自己卸载,从安装它们的目录中删除文件。例如,如果您构建了一个程序并将其安装到/usr/local中(使用make install),那么您将希望查看/usr/local/bin、/usr/local/libexec、/usr/local/share/man等,并删除不需要的文件。有时Makefile包含卸载目标,但并非总是如此。

当然,通常在Linux系统上,您使用包管理器安装软件,包管理器能够“自动地”卸载软件。

如果sudo make uninstall不可用:

在基于Debian的系统中,你可以运行sudo checkinstall来生成一个自动安装的.deb文件,而不是(或在*之后)执行make install。然后,您可以使用系统包管理器(例如apt/synaptic/aptitude/dpkg)删除它。Checkinstall还支持创建其他类型的包,例如RPM。

参见http://community.linuxmint.com/tutorial/view/162和一些基本的checkinstall用法和debian checkinstall包。


*:如果你是在安装了make install后阅读这篇文章,你仍然可以按照上面的说明,然后执行dpkg -r $PACKAGE_NAME_YOU_CHOSEN。

序言

下面可能会工作,也可能不会,这都是按原样给出的,你,只有你是负责任的人,以防一些损坏,数据丢失等。但我希望一切顺利!

要撤消make install,我将这样做(我确实这样做了):

想法:检查任何脚本安装和撤销这与简单的bash脚本。

Reconfigure your build dir to install to some custom dir. I usually do this: --prefix=$PWD/install. For CMake, you can go to your build dir, open CMakeCache.txt, and fix CMAKE_INSTALL_PREFIX value. Install project to custom directory (just run make install again). Now we push from assumption, that make install script installs into custom dir just same contents you want to remove from somewhere else (usually /usr/local). So, we need a script. 3.1. Script should compare custom dir, with dir you want clean. I use this:

anti-install.sh

RM_DIR=$1
PRESENT_DIR=$2

echo "Remove files from $RM_DIR, which are present in $PRESENT_DIR"

pushd $RM_DIR

for fn in `find . -iname '*'`; do
#  echo "Checking $PRESENT_DIR/$fn..."
  if test -f "$PRESENT_DIR/$fn"; then
    # First try this, and check whether things go plain
    echo "rm $RM_DIR/$fn"

    # Then uncomment this, (but, check twice it works good to you).
    # rm $RM_DIR/$fn
  fi
done

popd

3.2. 现在只需运行这个脚本(它将进行试运行)

bash anti-install.sh <dir you want to clean> <custom installation dir>

例如,你不想清理/usr/local,而你的自定义安装目录是/user/me/llvm。构建/安装,然后就是

bash anti-install.sh /usr/local /user/me/llvm.build/install

3.3. 仔细检查日志,如果命令对你来说是好的,取消注释rm $RM_DIR/$fn并重新运行它。但是停止!你真的仔细检查过吗?可以再检查一下吗?

指令来源: https://dyatkovskiy.com/2019/11/26/anti-make-install/

好运!

不幸的是,没有标准,这是从源代码安装的危险之一。一些makefile文件将包含“卸载”,因此

make uninstall

从源目录可以工作。否则,可能需要手动撤销make install所做的一切。

Make clean通常只是清理源目录-删除生成/编译的文件之类的,可能不是你想要的。

我知道很少有包支持“make uninstall”,但更多的包支持“make install DESTDIR=xxx”进行分期安装。

您可以使用它来创建一个包来安装,而不是直接从源代码安装。我没有运气与checkinstall,但fpm工作得很好。

这还可以帮助您删除之前使用make install安装的包。您只需强制在make installed的包上安装您构建的包,然后卸载它。

例如,我最近使用它来处理protobuf-3.3.0。 RHEL7:

make install DESTDIR=dest
cd dest
fpm -f -s dir -t rpm -n protobuf -v 3.3.0 \
 --vendor "You Not RedHat" \
 --license "Google?" \
 --description "protocol buffers" \
 --rpm-dist el7 \
 -m you@youraddress.com \
 --url "http:/somewhere/where/you/get/the/package/oritssource" \
 --rpm-autoreqprov \
 usr

 sudo rpm -i -f protobuf-3.3.0-1.el7.x86_64.rpm
 sudo rpm -e protobuf-3.3.0      

如果可以的话,你更喜欢yum而不是rpm。

Debian9:

make install DESTDIR=dest
cd dest
fpm -f -s dir -t deb -n protobuf -v 3.3.0 \
-C `pwd` \
--prefix / \
--vendor "You Not Debian" \
--license "$(grep Copyright ../../LICENSE)" \
--description "$(cat README.adoc)" \
--deb-upstream-changelog ../../CHANGES.txt \
 --url "http:/somewhere/where/you/get/the/package/oritssource" \
 usr/local/bin \
 usr/local/lib \
 usr/local/include

 sudo apt install -f *.deb
 sudo apt-get remove protobuf

在你能做到的地方,你更喜欢倾向于dpkg。

我也把答案贴在这里了