linux - 如何删除损坏的 glibc 安装

标签 linux installation makefile gnu glibc

我刚刚尝试将 glibc 版本 2.19 安装到我的计算机,如下所示:

1) 我克隆了 glibc git repo

$ cd ~
$ git clone git://sourceware.org/git/glibc.git

2) 我检查了版本 2.19

$ git co tags/glibc-2.19

3) 我在我的主目录中创建了一个目录 objdir ,并在其中构建了安装

$ cd ~/objdir
$ ~/glibc/configure --prefix=$HOME
$ make

4)我测试了这个品牌

$ make check

这给了我一个错误,但是我通过 Google 搜索找到的一些网页告诉我这个特定的错误并不是什么大问题。 (我希望我能记住错误和网页是什么,但我不能,而且我使用我现在无法访问的计算机找到了该网页,因此它不在我现在正在输入的网络历史记录中.)

5) 我尝试使用

安装glibc
$ make install

这就是让我疯狂的地方。安装中途失败,现在使用损坏的 glibc,我的用户帐户完全停止工作。

幸运的是,我的系统管理员能够移动我的 .bashrc ——它指向我的主目录下损坏的 glibc ——并将我恢复为默认值.bashrc。这样我就可以再次登录我的帐户并执行操作。

我的问题是,我应该怎样做才能完全删除我的主目录下损坏的 glibc 安装?

最佳答案

what should I do to completely remove the broken installation of glibc that resides under my home directory

cd && ls -lrt

将显示已安装的文件和目录。可能您有 include/lib/ (或 lib64/)、etc/ 以及其他可能的内容。只需删除这些目录,就可以了。

您可能还想阅读this answer .

更新:

that command shows me all the directories in my home directory, of which there are many.

它按时间顺序列出它们(最新的最后),因此最近修改的所有文件都位于底部。这些是您想要删除的内容。

given that i've installed things besides glibc to my home directory

我希望您现在意识到,将任何东西安装到您的主目录中都是一个坏主意(TM)。

假设您在失败的 glibc 安装之后没有安装任何东西,并且失败的 glibc 安装发生在过去 3 天内,以下命令可能会产生令人满意的结果:

find include lib etc -mtime -3 | egrep -v '^(include|etc|lib)$' |
  tee /tmp/to-delete

现在检查 /tmp/to-delete 是否有您不想删除的文件(如果我的假设成立,就不应该有任何此类文件)。

最后,使用以下命令删除它们:

cat /tmp/to-delete | xargs rm -rf 

更新2:

unfortunately, i don't think your "last 3 days" heuristic is going to work here. i installed a bunch of C libraries yesterday -- MPFC, GMP, MPC, and glibc -- and it's not at all clear to me which files are part of glibc and not the others.

那么好吧。您想要做的是找到属于 glibc 安装一部分的文件列表。您可以这样做:

cd glibc-2.19-src; mkdir build;
cd build; ../configure --prefix `pwd`/../install
make -j12 all && make install

您现在在 glibc-2.19-src/install 中有一个“干净安装”的目录。您可以在那里获取文件列表:

cd ../install; find . -type f > /tmp/to-delete

最后你准备好清理了:

cd; cat /tmp/to-delete | xargs rm -f

这可能仍然会留下一些空目录,但这通常不是什么大问题。如果您也想删除它们:

cd ~/glibc-2.19-src/install
find . -type d > /tmp/dirs-to-delete
cd; cat /tmp/dirs-to-delete | xargs rm 2>/dev/null

(最后一个命令将无法删除任何非空目录,这正是您想要的。)

关于linux - 如何删除损坏的 glibc 安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33070135/

相关文章:

生成文件扩展名

Android Debug Bridge (adb) 命令行工具存在于 $PATH 中,但在 linux 中为 "command not found"

windows - 当我们安装或卸载 .msi 或 .exe 包时会发生什么?

java - 端口 8086 和 8009 的 Tomcat v7.0 服务器设置

path - Visual Studio Community 2017 安装路径

c++ - 已使用 VS2015 项目和解决方案构建后的 vc++ 解决方案清理项目的 msbuild

linux - 意外创建了带有句点的目录。特点

linux -/etc/cron.daily/cyrus-imapd 的 fatal error

linux - grep -o 并使用 ls 显示部分文件名

bash - 如何从 Makefile 运行 bash 脚本?