【问题标题】:Is there any method to compile the .so file in linux to be static linked to the execute file?有什么方法可以在linux中编译.so文件以静态链接到执行文件?
【发布时间】:2012-11-22 21:38:58
【问题描述】:

在 linux 中,.a 文件通常是静态库,.so 文件是动态文件? 我想知道有没有办法将.so文件编译成可执行文件作为它的一部分? 我google了一下,没有找到方法。 谁能帮帮我?

【问题讨论】:

标签: linux compiler-construction


【解决方案1】:

静态链接在 Linux 中已经死了,我建议你不要编译静态库,尽管你可以在 Linux 中编译。这种特性在Windows下是可以的,但在Linux目前的发展趋势中却不是这样。

Linux static linking is dead?

Static link of shared library function in gcc

【讨论】:

    【解决方案2】:

    如果 .so 文件是您自己从源代码构建的,那么您可以更改构建设置以使其成为 .a 文件,然后静态链接。

    如果其他人创建了 .so 文件,那么不,没有简单的方法将其静态链接到可执行文件中。

    【讨论】:

      猜你喜欢
      • 2013-06-24
      • 2022-01-17
      • 2011-01-19
      • 1970-01-01
      • 1970-01-01
      • 2020-08-16
      • 1970-01-01
      • 2011-06-07
      相关资源
      最近更新 更多