为什么我必须对 libcl.2 使用 LD_PRELOAD 才能在 HP/UX 上使用 XML::LibXML::Common? [英] Why do I have to use LD_PRELOAD for libcl.2 to use XML::LibXML::Common on HP/UX?

查看:51
本文介绍了为什么我必须对 libcl.2 使用 LD_PRELOAD 才能在 HP/UX 上使用 XML::LibXML::Common?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

强制 LD_PRELOAD 仅在 HP 平台上,而不是在其他 Unix 版本(AIX、Linux 和 Solaris)上.

A compulsion of LD_PRELOAD on HP platform only and not on other unix flavors (AIX,Linux, and Solaris).

我构建了 Perl 模块 XML::LibXML::CommonUnix 风格.我必须专门为 HP 平台上的 libcl.2 库执行 LD_PRELOAD.而在其他 Unix 平台上,则不需要这样做.

I built Perl Module XML::LibXML::Common on all of Unix flavors.I had to specifically do LD_PRELOAD for libcl.2 library on HP Platform only. While on other unix platforms nothing as such was required.

这是操作系统行为还是 HP 加载器/编译器中真的缺少某些东西?

Is this an OS behaviour or something really missing in HP loader/compiler?

我正在运行一个 perl 脚本,它只是创建了一个新的XML::LibXML::SAX"对象

I was running a perl script which simply creates a new object of "XML::LibXML::SAX"

use XML::LibXML::SAX;
$x = XML::LibXML::SAX->new();

它抱怨了

无法为模块 XML::LibXML::Common 加载 'site_perl/5.8.8/PA-RISC2.0-thread-multi/auto/XML/LibXML/Common/Common.sl': Exec 格式错误

Can't load 'site_perl/5.8.8/PA-RISC2.0-thread-multi/auto/XML/LibXML/Common/Common.sl' for module XML::LibXML::Common: Exec format error

当我为 libcl.2 执行 LD_PRELOAD 时,错误消失并且 Perl 是为多线程支持而构建的.

and when i do the LD_PRELOAD for libcl.2 the error goes away and the Perl is built for a multi threaded support.

推荐答案

我想您是在问为什么必须使用它.如果您正在运行 Perl 多线程,您正在调用的库之一将在 libc 之前加载,并且它可能是单线程的.作为其依赖性处理的一部分,它试图在您的环境中加载多线程库.通过使用 LD_PRELOAD,我认为您正在使用库插入原则来强制在加载不安全库之前加载该库.插入的概念是一个复杂的概念,您可能会从以下 链接 中获得一些好处一个>:

I think you are asking why you have to use it. If you are running Perl multi-threaded one of the libraries you are calling is getting loaded before libc and it is likely single threaded. As part of its dependency processing, it is attempting to load a multi-threaded library in your environment. By using LD_PRELOAD I think you are using the principle of library interposition to force that library to load prior to loading the unsafe library. The notion of interposition is a complex one and you might gain some benefit from the following link:

摘录:

要使用库插入,您需要创建一个特殊的共享库和设置 LD_PRELOAD 环境多变的.当设置 LD_PRELOAD 时,动态链接器将使用指定的图书馆在其他任何时候之前搜索共享库.

To use library interposition, you need to create a special shared library and set the LD_PRELOAD environment variable. When LD_PRELOAD is set, the dynamic linker will use the specified library before any other when it searches for shared libraries.

这篇关于为什么我必须对 libcl.2 使用 LD_PRELOAD 才能在 HP/UX 上使用 XML::LibXML::Common?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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