101

私たちの製品には、「libpam」などのシステム ライブラリに動的にリンクする Linux バイナリがいくつか含まれています。一部のお客様のシステムでは、プログラムの実行時に stderr で次のエラーが発生します。

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

アプリケーションは正常に動作し、動的ライブラリからコードを実行します。これは致命的なエラーではなく、単なる警告です。

これは、システムにインストールされたライブラリに実行可能ファイルが期待するものが欠落している場合に、動的リンカーから発生するエラーであると考えています。動的リンクプロセスの内部についてはあまり知りません...そしてトピックをグーグルで検索してもあまり役に立ちません。:(

このエラーの原因を知っている人はいますか? ...どうすれば原因を診断できますか? ...そして、この問題を回避するために実行可能ファイルを変更するにはどうすればよいでしょうか?

更新: お客様が最新バージョンの debian "testing" にアップグレードしたところ、同じエラーが発生しました。したがって、古い libpam ライブラリではありません。リンカーが何について不平を言っているのかを理解したいと思いますか?根本的な原因などを調査するにはどうすればよいですか?

4

5 に答える 5

70

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.

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.

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.)

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.)

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

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.

于 2008-10-01T05:57:23.387 に答える
4

fwiw、zenoss 監視システムがインストールされているシステムで check_nrpe を実行すると、この問題が発生しました。混乱を助長するために、root ユーザーとしては正常に機能しましたが、zenoss ユーザーとしては機能しませんでした。

zenoss ユーザーには、これらの警告を発行する zenoss ライブラリを使用する原因となる LD_LIBRARY_PATH があることがわかりました。すなわち:

root@monitoring:$ echo $LD_LIBRARY_PATH

su - zenoss
zenoss@monitoring:/root$ echo $LD_LIBRARY_PATH
/usr/local/zenoss/python/lib:/usr/local/zenoss/mysql/lib:/usr/local/zenoss/zenoss/lib:/usr/local/zenoss/common/lib::
zenoss@monitoring:/root$ /usr/lib/nagios/plugins/check_nrpe -H 192.168.61.61 -p 6969 -c check_mq
/usr/lib/nagios/plugins/check_nrpe: /usr/local/zenoss/common/lib/libcrypto.so.0.9.8: no version information available (required by /usr/lib/libssl.so.0.9.8)
(...)
zenoss@monitoring:/root$ LD_LIBRARY_PATH= /usr/lib/nagios/plugins/check_nrpe -H 192.168.61.61 -p 6969 -c check_mq
(...)

とにかく、私が言おうとしているのは、LD_LIBRARY_PATH、LD_PRELOAD などの変数も確認してください。

于 2010-08-02T12:33:20.487 に答える
3

アプリをどのようにコンパイルしていますか? コンパイラ フラグは何ですか?

私の経験では、Linux システムの広大な領域を対象とする場合は、サポートしたい最も古いバージョンでパッケージをビルドしてください。より多くのシステムは下位互換性がある傾向があるため、アプリは引き続き動作します。実際、これがライブラリのバージョン管理の理由です - 後方互換性を確保します。

于 2008-10-01T06:26:56.747 に答える
1

これはもう見ましたか?原因は、おそらくその顧客の片側の非常に古い libpam にあるようです。

または、バージョンのリンクが見つからない可能性があります: http://www.linux.org/docs/ldp/howto/Program-Library-HOWTO/shared-libraries.html

于 2008-09-26T04:42:33.040 に答える