什么是“无版本信息可用"?来自Linux动态链接器的错误是什么意思? [英] What does the "no version information available" error from linux dynamic linker mean?

查看:222
本文介绍了什么是“无版本信息可用"?来自Linux动态链接器的错误是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的产品中,我们提供了一些Linux二进制文件,这些二进制文件动态链接到系统库,例如"libpam".在某些客户系统上,程序运行时在stderr上会出现以下错误:

In our product we ship some linux binaries that dynamically link to system libraries like "libpam". On some customer systems we get the following error on stderr when the program runs:

./authpam: /lib/libpam.so.0: no version information available (required by authpam)

应用程序运行良好,并从动态库执行代码.因此,这不是致命错误,实际上只是警告.

The application runs fine and executes code from the dynamic library. So this is not a fatal error, it's really just a warning.

当系统安装的库缺少我们的可执行文件期望的内容时,我认为这是来自动态链接器的错误.我对动态链接过程的内部知识了解不多...搜索该主题并没有多大帮助. :(

I figure that this is error comes from the dynamic linker when the system installed library is missing something our executable expects. I don't know much about the internals of the dynamic linking process ... and googling the topic doesn't help much. :(

任何人都知道导致此错误的原因是什么? ...我如何诊断原因? ...以及如何更改可执行文件来避免此问题?

Anyone know what causes this error? ... how I can diagnose the cause? ... and how we could change our executables to avoid this problem?

更新:客户已升级到最新版本的debian测试",并且发生了相同的错误.因此,它不是一个过时的libpam库.我想我想了解链接器在抱怨什么?如何调查根本原因等?

Update: The customer upgraded to the latest version of debian "testing" and the same error occurred. So it's not an out of date libpam library. I guess I'd like to understand what the linker is complaining about? How can I investigate the underlying cause, etc?

推荐答案

无可用版本信息"表示库版本号在共享库上较低.例如,如果您在生成二进制文件的计算机上的major.minor.patch编号为7.15.5,而在安装计算机上的major.minor.patch编号为7.12.1,则ld将显示警告.

The "no version information available" means that the library version number is lower on the shared object. For example, if your major.minor.patch number is 7.15.5 on the machine where you build the binary, and the major.minor.patch number is 7.12.1 on the installation machine, ld will print the warning.

您可以通过编译与目标操作系统随附的共享库版本匹配的库(标头和共享库)来解决此问题.例如,如果您要安装到RedHat 3.4.6-9,则不想在Debian 4.1.1-21上进行编译.这就是大多数发行版都提供特定Linux发行版编号的原因之一.

You can fix this by compiling with a library (headers and shared objects) that matches the shared object version shipped with your target OS. E.g., if you are going to install to RedHat 3.4.6-9 you don't want to compile on Debian 4.1.1-21. This is one of the reasons that most distributions ship for specific linux distro numbers.

否则,您可以静态链接.但是,您不想使用PAM之类的工具来执行此操作,因此您实际上想安装一个与客户的生产环境相匹配的开发环境(或至少安装并链接到正确的库版本.)

Otherwise, you can statically link. However, you don't want to do this with something like PAM, so you want to actually install a development environment that matches your client's production environment (or at least install and link against the correct library versions.)

建议重命名.so文件(用版本号填充它们)源于共享库未使用版本符号的时间.因此,不要指望使用.so.n.n.n命名方案会有所帮助(很多-如果您的系统已被删除,可能会有所帮助.)

Advice you get to rename the .so files (padding them with version numbers,) stems from a time when shared object libraries did not use versioned symbols. So don't expect that playing with the .so.n.n.n naming scheme is going to help (much - it might help if you system has been trashed.)

您的最后一个选择是使用自定义链接脚本使用具有不同次要版本号的库进行编译: http://www.redhat.com /docs/manuals/enterprise/RHEL-4-Manual/gnu-linker/scripts.html

You last option will be compiling with a library with a different minor version number, using a custom linking script: http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gnu-linker/scripts.html

为此,您需要编写一个自定义脚本,并且需要一个自定义安装程序,该安装程序使用自定义脚本针对客户端的共享对象运行ld.这要求您的客户在其生产系统上具有gcc或ld.

To do this, you'll need to write a custom script, and you'll need a custom installer that runs ld against your client's shared objects, using the custom script. This requires that your client have gcc or ld on their production system.

这篇关于什么是“无版本信息可用"?来自Linux动态链接器的错误是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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