将多个静态归档组合成一个新的归档 [英] Combining several static archives into a new one
问题描述
我正在为移动设备制作游戏引擎。我想编译我的代码,链接它对几个静态库,然后结合我的编译代码与那些静态库形成一个新的静态库。但是,我的Google Fu放弃了我。
I'm making a game engine for mobile devices. I want to compile my code, link it against a few static libraries and then combine my compiled code with those static libraries to form a new static library. However, my Google Fu is abandoning me.
假设我拥有静态库 aa
, ba
ca
和我的代码。我想把所有这些编译到 awesome.a
。
Suppose I have static libraries a.a
, b.a
and c.a
and my code. I want to compile all that into awesome.a
.
我该怎么办?
我正在使用CodeSourcery的 arm-none-linux-gnueabi-ar
。
I'm using CodeSourcery's arm-none-linux-gnueabi-ar
by the way.
提前感谢。
推荐答案
假设 aa
, ba
和 ca
都在CWD中,类似:
Assuming that a.a
, b.a
, and c.a
are in the CWD, something like:
mkdir a-objs && ( cd a-objs && ar -x ../a.a )
mkdir b-objs && ( cd b-objs && ar -x ../b.a )
mkdir c-objs && ( cd c-objs && ar -x ../c.a )
rm -f awesome.a && ar -r awesome.a a-objs/* b-objs/* c-objs/* && ranlib awesome.a
应该可以正常工作。
这篇关于将多个静态归档组合成一个新的归档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!