将精简归档文件转换为普通归档文件 [英] Turn thin archive into normal one

查看:106
本文介绍了将精简归档文件转换为普通归档文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建 V8 ,默认情况下,它将构建为精简"存档,其中.a文件实际上仅包含指向文件系统上目标文件的指针,而不是包含目标文件本身.有关详细信息,请参见 man ar .

I'm building V8, and by default it builds as a "thin" archive, where the .a files essentially just contain pointers to the object files on your filesystem instead of containing the object files themselves. See man ar for details.

我希望能够将此库放在一个中央位置,以便其他人可以链接到它,并且提供一个普通的存档文件比提供一些目标文件显然要容易得多.

I want to be able to put this library in a central place so that other people can link to it, and it would be obviously much easier to provide a normal archive file instead of providing a gaggle of object files as well.

如何获取构建生成的精简归档文件并将其转换为普通归档文件?我认为这就像枚举精简归档文件中的目标文件并使用这些文件重建归档文件一样简单,但是我不知道可以使用什么命令来列出归档文件的目标文件.

How do I take the thin archives produced by the build and turn them into normal ones? I assume it would be as simple as enumerating the object files in the thin archive and rebuilding an archive using those, but I don't know what command can be used to list the archive's object files.

推荐答案

在进行了一些进一步的研究之后,可以使用ar -t枚举存档中的目标文件,因此,只需将该列表提供给ar就像创建归档文件时一样.

After some additional research, ar -t can be used to enumerate the object files in an archive, so after that it's just a matter of providing that list to ar as you usually would when creating an archive.

以下脚本可立即对所有库进行处理:

The following script handled this for all of the libraries at once:

for lib in `find -name '*.a'`;
    do ar -t $lib | xargs ar rvs $lib.new && mv -v $lib.new $lib;
done

这篇关于将精简归档文件转换为普通归档文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆