Why does my static build require shared libraries?

 ̄綄美尐妖づ 提交于 2019-12-10 14:59:28

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/1092456/why-does-my-static-build-require-shared-libraries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!