【问题标题】:Translate makefile to produce static libxxx.a instead of dynamic libxxx.dylib翻译 makefile 以生成静态 libxxx.a 而不是动态 libxxx.dylib
【发布时间】:2010-09-17 14:08:31
【问题描述】:

我正在编译一个库 (http://www.antisphere.com/Wiki/tools:anttweakbar),但在我的 mac 上使用其包含的 makefile 发出“make”会生成一个动态库 (.dylib)。我宁愿有一个静态库,以便我可以将它与我的应用程序一起部署。翻译 makefile 中的标志以生成静态库是否容易/可能?

似乎“make”只是编译和链接一些 C/C++ 代码。

【问题讨论】:

  • 这就是为什么我希望人们只使用 automake 和 libtool。

标签: macos makefile compilation static-libraries dynamic-library


【解决方案1】:

看起来它没有使用任何特定于 dylib 的编译标志来构建对象,因此您可以使用以下方式手动构建库:

make && ar cru libAntTweakBar.a && ranlib libAntTweakBar.a

【讨论】:

  • 这或多或少是解决方案,虽然链接到我创建的静态库有点棘手。这是我对这个特定库的最终解决方案:alecjacobson.com/weblog/?p=1370
【解决方案2】:

我有个坏消息要告诉你。 This 可能会阻止你做你想做的事。

【讨论】:

  • @mangledorf 无法构建完全静态的二进制文件并不意味着他无法构建静态库。
猜你喜欢
  • 1970-01-01
  • 2022-11-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-10-07
  • 2022-07-11
  • 1970-01-01
相关资源
最近更新 更多