c - 如何使用 libtool 从一堆静态库中创建一个静态库

标签 c libtool

我有大约 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/

相关文章:

gdb - 整个程序中库的调试符号缺少行号,但不是单独的

vmware - 使用 libtool 而不使用链接

linux - libtool 自定义脚本是如何通过配置生成的?

c++ - Libtool 版本不匹配

循环队列实现

c-客户端服务器套接字编程-发送文件

c - K&R - 了解 float - 基数、尾数和基数

c - 函数调用后释放指针内存

c - 如何拦截编辑框中的粘贴事件?

linux - libtool 的 .la 文件有什么用?