为什么我的静态构建需要共享库? [英] Why does my static build require shared libraries?

查看:161
本文介绍了为什么我的静态构建需要共享库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我的静态构建需要共享库?



每隔一段时间我都会从链接器获取这些警告......(目前正在使用openssh- 5.2p1)

警告看起来类似于:
在静态链接的应用程序中使用'function'需要在运行时使用glibc版本的共享库。 ..



当我谷歌,我只看到修复,而不是原因。

谢谢,
Chenz

解决方案

它本身不需要共享库,它只是警告你有些事情可能无法正常工作,如果你静态地链接到glibc。



其中一些是nsswitch,参见例如/etc/nsswitch.conf。在一个系统中,查找用户/组/主机名和其他东西的不同方法可以通过插件进行配置和修改 - 例如, samba提供了一个模块,用于管理透明地在Windows域/活动目录中配置的用户。

如果您将静态链接到glibc,则您的应用将无法兑现/etc/nsswitch.conf定制,诸如gethostbyname,getpwuid等功能将仅使用默认的查找方式这些东西。



同样适用于例如其他库你的应用程序可能会使用它,无论出于什么原因dlopen()本身钩入glibc或类似的。



另请参阅

静态链接被认为是有害的


Why does my static build require shared libraries?

Every so often I get these warnings from my linker... (at the moment it is happening with openssh-5.2p1)

The warnings look similar to: "Using 'function' in statically linked applications requires at runtime the shared libraries from the glibc version used for..."

When I google, I only see fixes, not reasons.

Thanks, Chenz

解决方案

It doesn't require shared libs per se, it just warns you that some things might not work properly if you link statically to glibc.

Some of those things are the nsswitch, see e.g. /etc/nsswitch.conf .On a system different ways of looking up users/groups/hostnames and other things can be configured and altered via plugins - e.g. samba comes with a module for managing users configured on a windows domain/active directory transparently.

Your app will not honor /etc/nsswitch.conf customization if you link statically to glibc, functions such as gethostbyname,getpwuid and others will just use the default ways of looking up things.

Same goes for e.g. other libraries your app might use that for whatever reason dlopen()s itself to hook into glibc or similar.

See also

Statically linking considered harmful

这篇关于为什么我的静态构建需要共享库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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