简体   繁体   English

Hexeditted 共享库“未找到版本 x.so”错误

[英]Hexeditted shared library 'Version x.so not found' error

My library A is dependant on external library B. When I use ld on A.so, I see B is linked as B.so.10, yet on my computer the links are:我的库 A 依赖于外部库 B。当我在 A.so 上使用 ld 时,我看到 B 链接为 B.so.10,但在我的计算机上,链接是:

B.so -> B.so.10 B.so -> B.so.10

B.so.10 -> B.so.10.5 B.so.10 -> B.so.10.5

Im trying to make A link to JUST B.so and use symbolic links for what version to load.我试图创建一个指向 JUST B.so 的链接,并使用符号链接来加载要加载的版本。 I hexeditted A.so and replaced all findings of B.so.10 with B.so, and ld links it just fine, but when I try to dlopen A.so, it says: 'Error loading A.so: Version B.so not found' I've read about symbol versioning and such, but honestly have no clue where to look for what would be causing the issue?我对 A.so 进行了十六进制编辑,并用 B.so 替换了 B.so.10 的所有发现,并且 ld 链接它就好了,但是当我尝试 dlopen A.so 时,它说:'加载 A.so 时出错:版本 B。所以找不到'我已经阅读了有关符号版本控制等的信息,但老实说,不知道在哪里寻找会导致问题的原因?

Ive checked readelf and compared a non editted version to mine and I see nothing in the diffs besides the SO name.我检查了 readelf 并将未编辑的版本与我的进行了比较,除了 SO 名称之外,我在差异中看不到任何东西。 Elfedit also did not work snd just turned the binary into garbage data. Elfedit 也不起作用,只是将二进制文件变成了垃圾数据。

If you run readelf -V B.so , you will likely discover that it doesn't define version B.so , but does define version B.so.10 .如果您运行readelf -V B.so ,您可能会发现它没有定义版本B.so ,但确实定义了版本B.so.10

By replacing all B.so.10 strings with B.so you state to the runtime loader that A.so depends on version B.so instead of B.so.10 that it used to depend on.通过用B.so替换所有B.so.10字符串,您 state 到A.so依赖于版本B.so而不是它曾经依赖的B.so.10的运行时加载程序。

Since not such version exists at runtime, loader correctly complains.由于在运行时不存在这样的版本,加载程序正确地抱怨。

Ive checked readelf and compared a non editted version to mine and I see nothing in the diffs besides the SO name.我检查了 readelf 并将未编辑的版本与我的进行了比较,除了 SO 名称之外,我在差异中看不到任何东西。

Check again.再检查一遍。 In particular, do this:特别是,这样做:

diff <(readelf -V A.so.orig) <(readelf -V A.so)

You should see some differences there.应该在那里看到一些差异。

Im trying to make A link to JUST B.so and use symbolic links for what version to load.我试图创建一个指向 JUST B.so 的链接,并使用符号链接来加载要加载的版本。

You appear to have an XY problem .您似乎有一个XY 问题 What are you really trying to achieve?真正想要达到什么目的?

Update:更新:

The initial problem is im trying to make my software CUDA version agnostic.最初的问题是我试图让我的软件 CUDA 版本不可知。 ... I can't take this binary and plop it on another system with a different cufft version as cufft links to a specific version even though the ABI hasn't changed in forever. ...我不能把这个二进制文件放在另一个具有不同 cufft 版本的系统上,因为 cufft 链接到特定版本,即使 ABI 并没有永远改变。

Ah, you do in fact have an XY problem.啊,你确实有一个 XY 问题。

You can not in fact deduce that the ABI has not changed, unless you verify that every structure potentially used in that ABI has not changed (this is different from verifying that the API has not changed, and you likely did that).事实上,您不能推断ABI没有改变,除非您验证该ABI中可能使用的每个结构都没有改变(这与验证API没有改变不同,您可能已经这样做了)。

If you succeed in patching out the version, the end result will likely be a mystery crash on a system with different version of CUFFT.如果您成功修补了版本,最终结果可能是在具有不同版本 CUFFT 的系统上发生神秘的崩溃。

If you are lucky, the crash will happen quickly and reproducibly.如果你幸运的话,崩溃会快速且可重复地发生。 If you are unlucky, it will happen rarely and will look completely mysterious and unrelated, will happen only on some systems, only on some customer machines, only after you make totally unrelated changes to your library, etc. etc.如果您不走运,它将很少发生并且看起来完全神秘且无关,只会在某些系统上,仅在某些客户机器上,仅在您对库进行完全不相关的更改等之后才会发生,等等。

TL;DR: You are setting yourself up for significant pain. TL;DR:你正在为自己的巨大痛苦做好准备。 Just don't do it.只是不要这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Android应用程序上加载现有共享库(.so)时出错(找不到unsatisfiedlinkerror本机方法) - Error loading existing shared library (.so) on Android app (unsatisfiedlinkerror native method not found) 编译后更改Linux共享库(.so文件)版本 - Change Linux shared library (.so file) version after it was compiled 强制二进制文件使用共享库 (.so) 的特定(较新)版本 - Forcing a binary to use a specific (newer) version of a shared library (.so) 错误“/lib/x86_64-linux-gnu/libc.so.6:找不到版本‘GLIBC_2.33’” - error "/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found" 错误 /lib/x86_64-linux-gnu/libc.so.6:找不到版本“GLIBC_2.34” - Error /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found C ++-找不到共享库liblog4cpp.so.4 - C++ - shared library liblog4cpp.so.4 not found 映射共享库节时出错:libhmmm.so:成功 - Error while mapping shared library sections: libhmmm.so: Success 加载共享库 libstdc++.so.6 时出错:没有这样的文件或目录(需要) - Error loading shared library libstdc++.so.6: No such file or directory (needed by) 创建具有扩展名的共享库 - Create shared library with extension so 加载共享库libc.so.6时mingetty错误 - mingetty error while loading shared library libc.so.6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM