gcc中共享库函数的静态链接 [英] Static link of shared library function in gcc

查看:103
本文介绍了gcc中共享库函数的静态链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在gcc中静态链接共享库函数?

解决方案

参考:

http://www.linuxquestions.org/questions/linux-newbie-8/forcing-static-linking-of-shared-libraries-696714/



http:// linux。 derkeiler.com/Newsgroups/comp.os.linux.development.apps/2004-05/0436.html



您需要库的静态版本链接。
$ b 共享库实际上是一个特殊格式的可执行文件
,指定了入口点(并且包含一些粘性寻址问题
)。它没有静态需要
链接的所有信息。


您不能静态链接共享库(或动态链接静态)

标志 - 静态强制链接器使用静态库(.a)而不是共享(.so)
但是。静态库并不总是默认安装。所以如果你需要静态链接,你必须安装静态库。

另一种可能的方法是使用 statifier Ermine 。这两种工具都将动态链接的可执行文件作为输入,并将输出创建为包含所有共享库的自包含可执行文件。


How can I link a shared library function statically in gcc?

解决方案

Refer to:

http://www.linuxquestions.org/questions/linux-newbie-8/forcing-static-linking-of-shared-libraries-696714/

http://linux.derkeiler.com/Newsgroups/comp.os.linux.development.apps/2004-05/0436.html

You need static version of the library to link.

A shared library is actually an executable in a special format with entry points specified (and some sticky addressing issues included). It does not have all the information needed to link statically.

You can't statically link shared library (or dynamically link static)

Flag -static will force linker to use static library (.a) instead of shared (.so) But. Static libraries not always installed by default. So if you need static link you have to install static libraries.

Another possible approach is use statifier or Ermine. Both tools take as input dynamically linked executable and as output create self-contained executable with all shared libraries embedded.

这篇关于gcc中共享库函数的静态链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆