共有ライブラリ(他の共有ライブラリに依存)を構築するときに、コンパイル時リンカーによるシンボルの解決をスキップするgccフラグはありますか?undefined reference
依存関係が指定されて存在しているにもかかわらず、B.soとA.soに依存する共有ライブラリCを構築しようとすると、何らかの理由でツールチェーンでエラーが発生します。依存関係の解決を実行時に遅らせるためのgccフラグが存在すると聞きました。
1058 次
1 に答える
2
私はあなたが探していると思います--allow-shlib-undefined
。ld
マニュアルページから:
--allow-shlib-undefined
--no-allow-shlib-undefined
Allows (the default) or disallows undefined symbols in shared libraries.
This switch is similar to --no-undefined except that it determines the
behaviour when the undefined symbols are in a shared library rather than
a regular object file. It does not affect how undefined symbols in regular
object files are handled.
The reason that --allow-shlib-undefined is the default is that the shared
library being specified at link time may not be the same as the one that
is available at load time, so the symbols might actually be resolvable at
load time. Plus there are some systems, (eg BeOS) where undefined symbols
in shared libraries is normal. (The kernel patches them at load time to
select which function is most appropriate for the current architecture.
This is used for example to dynamically select an appropriate memset
function). Apparently it is also normal for HPPA shared libraries to have
undefined symbols.
ただし、未定義のシンボルを許可することがデフォルトであるため、問題は実際には別のものだと思います。
于 2010-02-26T00:43:59.667 に答える