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

Nik*_*hil 8 c libtool

我有大约80个静态库.我想从中创建一个静态库.

这个答案对我不起作用,因为我收到以下错误:

libtool: unrecognized option `-static'
Run Code Online (Sandbox Code Playgroud)

我也很困惑它需要在哪种模式下完成.是"链接"还是"安装"因为有20个奇数库,我还能用"*"来指定所有吗?

我没有在文件中找到任何信息,期望不能真正回答我的问题.

FYI ..这些是模式:

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
Run Code Online (Sandbox Code Playgroud)

lai*_*dir 6

我可能天真地忽略了某些后果,但是您不能将文件直接视为档案吗?

for i in *.a; ar x $i; done
ar r libfoo.a *.o
ranlib libfoo.a
Run Code Online (Sandbox Code Playgroud)

当然,如果任何.o文件相同,您将需要某种重命名方案。大概是这样的libname_objectname.o