无法 dlopen 加载模块 '/usr/lib/pa20_64/libpthread.1'因为它包含线程特定的数据
我在使用 dlopen() 加载库时遇到此错误:
Cannot dlopen load module '/usr/lib/pa20_64/libpthread.1' because it contains thread specific data.
我在谷歌上查找了这个错误,以下导出修复了它。
export LD_PRELOAD=/usr/lib/hpux64/libpthread.so.1
谁能告诉我 LD_PRELOAD 到底做什么以及为什么我必须预加载这个库?为什么链接器不加载它?
使用 -lpthread 编译也没有帮助。
ENV:HP-UX hhtenb1 B.11.31 U ia64 3881169896 无限用户许可证
I get this error while loading a lib with dlopen():
Cannot dlopen load module '/usr/lib/pa20_64/libpthread.1' because it contains thread specific data.
I looked this up on google and the following export fixed it.
export LD_PRELOAD=/usr/lib/hpux64/libpthread.so.1
Can anybody tell me what exactly LD_PRELOAD does and why I have to preload this lib? Why does the linker not load it?
Compiling with -lpthread does not help either.
ENV: HP-UX hhtenb1 B.11.31 U ia64 3881169896 unlimited-user license
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我无法告诉您有关 HPUX 的所有详细信息,但请尝试使用 -lpthread 链接您的程序 - 这可能会解决您的问题。
事实上,您正在 dlopen() 处理的库似乎在运行时挖掘以查找 libpthread 的版本。 LD_PRELOAD 只是加载指定的库,就像您已经 dlopened 它们一样,但它是在程序有机会开始运行之前执行的。
不确定细节,但有一个模糊的猜测:您正在使用的某些库在 dlopen 触发 libpthread 加载之前调用了 pthread 静态数据函数(但是如果第一个库将其作为依赖项,那么为什么它会尝试加载 pthread ? - 不确定/也许这表明以前的库静态链接了一些 pthread 内容?)。
I can't tell you all the details on HPUX, but try linking your program with -lpthread - that may solve your problem.
As is, the library you're dlopen()ing seems to be digging around at run-time to find a version of libpthread. LD_PRELOAD just loads the specified library as if you'd dlopened them, but it does it before the program has a chance to start running.
Not sure of details, but a vague guess: some library you're using has called the pthread static data functions before your dlopen triggers a load of libpthread (but why would it try to load pthread then if the first library had it as a dependency? - not sure / maybe that indicates the former library statically linked some pthread content?).
我们在运行 DB2-10.1.2 的 hpux-11.31 IA64 上遇到了以下错误并进行了
修复。
We had this error below on hpux-11.31 IA64 running DB2-10.1.2 and doing the
fixed it.