将精简存档变成普通存档 [英] Turn thin archive into normal one

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

问题描述

我正在构建 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天全站免登陆