在运行

./configure --prefix=/mingw 

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

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

我看到了这条信息:

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

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


当前回答

序言

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

要撤消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/

好运!

其他回答

序言

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

要撤消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/

好运!

清除源代码/构建树中的任何中间文件或输出文件。然而,它只影响源代码/构建树;它不会触及文件系统的其余部分,因此不会删除先前安装的软件。

如果幸运的话,运行make uninstall就可以了。然而,这取决于图书馆的作者来提供;有些作者提供了卸载目标,有些则没有。

如果你不幸运,你将不得不手动卸载它。运行make -n install可能会很有帮助,因为它将显示软件安装自己所采取的步骤,但实际上不会执行任何操作。然后可以手动反转这些步骤。

方法1

从源文件夹:

#让卸载

方法2

如果没有卸载步骤:

打开install_manifest.txt(由#make install创建) 删除所有列出的目录/文件 删除您遗漏的所有剩余文件: #xargs rm < install_manifest.txt 删除所有隐藏目录/文件: $rm -rf ~/.packagename

删除源文件夹。

方法3

如果以上选项都无效,请查看安装过程:

#make -n install

并反转安装过程:

#rm -rf创建的所有目录/文件

例子

例如,这是如何从源代码卸载nodejs, npm和nvm:

如何完全卸载Node.js,重新安装(Mac OS X)

你可以使用上面的任何一种方法。

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

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

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

“stow”实用程序就是用来解决这个问题的:http://www.gnu.org/software/stow/