我有大约 80 个静态库。我想从中创建一个静态库。
This answer没有为我工作,因为我收到以下错误:
libtool: unrecognized option `-static'
我也对需要在哪种模式下完成感到困惑。是“链接”还是“安装” 既然有20多个库,我也可以用“*”来指定所有吗?
我没有在文档中找到任何信息 expect this这并没有真正回答我的问题。
仅供引用..这些是模式:
MODE must be one of the following:
clean remove files from the build directory
compile compile a source file into a libtool object
execute automatically set library path, then run a program
finish complete the installation of libtool libraries
install install libraries or executables
link create a library or an executable
uninstall remove libraries from an installed directory
最佳答案
我可能天真地忽略了一些后果,但你不能直接把文件当作文件吗?
for i in *.a; ar x $i; done
ar r libfoo.a *.o
ranlib libfoo.a
当然,如果任何 .o
文件相同,您将需要某种重命名方案。可能类似于 libname_objectname.o
。
关于c - 如何使用 libtool 从一堆静态库中创建一个静态库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24954747/