为什么 Perl 的 PAR 找不到 Socket.pm 的可加载对象?

发布于 2024-07-14 17:12:37 字数 409 浏览 9 评论 0原文

我使用 PAR::Packer 在 Cygwin 上打包我的 Perl 应用程序,然后在 HPUX 上运行它。

一个简单的 hello world 效果很好,例如:

pp -p hello.pl

结果是 a.par,然后在 HPUX 上:

parl a.par

效果很好。

然而,当使用 -B 捆绑开关打包具有许多依赖项的更大应用程序时,没有这样的运气,相反我收到错误:

 Can't locate loadable object for module Socket in @INC

任何想法,也许 Windows/unix 网络存在一些问题? 有修复吗?

I was using PAR::Packer to package my Perl application on Cygwin and then running it on HPUX.

A simple hello world works well, e.g.:

pp -p hello.pl

That results in a.par and then on HPUX:

parl a.par

It works great.

However when package a bigger application with many dependencies with -B bundle switch, no such luck, instead I get the error:

 Can't locate loadable object for module Socket in @INC

Any ideas, maybe some problem with Windows/unix networking? Any fixes?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

倦话 2024-07-21 17:12:37

您遇到此问题是因为 Socket 加载了一个共享库,并且该库不可跨平台移植(也就是说,Windows 上的 Socket 共享库无法在 Linux 上工作,也无法在 HPUX 上工作)。

您可以尝试两件事:

  1. 确定需要共享库的所有位置,并在目标平台上本地安装它们。 您可能还需要从 PAR 存档中排除这些模块。
  2. 切换到纯 Perl 实现((更)可移植)。 如果您不是 Perl、C 和目标平台方面的高手,并且纯 Perl 版本尚未可用,那么您可能会运气不好。

You're hitting this because Socket loads a shared library, and that's not portable across platforms (that is, the Socket shared lib on Windows won't work on Linux won't work on HPUX).

You could try two things:

  1. Identify all the places you need shared libs, and have a native install of them on your target platform. You may also need to exclude those modules from your PAR archive.
  2. Switch to pure-Perl implementations (which are (more) portable). If you're not a whiz at Perl, C, and your target platform, and a pure-Perl version is not already available, you may be out of luck with this.
无人接听 2024-07-21 17:12:37

在 HPUX 上安装实际的 perl 的优点是您的 cygwin 应用程序可以在 hpux perl 上运行。 PAR 包通常无法在任何两个平台之间运行。 在我看来,这与在 cygwin 上生成 hello.exe 并尝试在 HPUX 上运行它没有什么不同。

The advantage of installing an actual perl on your HPUX is that your cygwin app can then run on the hpux perl. PAR packages aren't normally going to work between any two platforms. In my mind, it's not really any different than producing the hello.exe on cygwin and trying to run it on HPUX.

乞讨 2024-07-21 17:12:37

Perl blixtor 的建议来自评论我正在移动问题中的“编辑更新”来回答我自己的问题:

这里的大部分功劳都归功于 Andrew Barnett,两个关键问题是

  1. 本机 C 代码库
  2. perl LIB 路径

在这里我遵循的步骤是让 cygwin 创建的 par 在 HPUX 上运行,我相信步骤在任何 unix 上都应该大致相同:

遵循 Andrew 的建议并使用 pp -X IO::Socket 删除 IO::Socket 开关,但然后在 unix 上运行生成的 parl 我稍作修改,但仍然相关错误:

Can't locate Socket.pm in @INC (@INC contains: CODE(0x406ab018) CODE(0x4055c880) CODE(0x40563978)) at Net/Config.pm line 11

即使在 unix 上运行“perl -MCPAN -e shell”显示 Socket 应该已安装并且是最新的:

cpan[2]> install IO::Socket
IO::Socket is up to date (1.30_01).

所以除了排除之外带有 -X 开关 abobe 的套接字,我还必须在 HPUX 上创建一个包装器脚本,其中只有这 1 行,wrapper.pl:

use PAR { file => 'bdiff.par', run => 'bdiff.pl' };

然后要运行它,我没有使用 parl,而是只用 perl 调用它,我必须使用 -I 开关提供默认库路径的完整路径,如下所示:

perl -I/lib/perl5/lib/5.10.0/PA-RISC2.0 -I/lib/lib/site_perl wrapper.pl allparameters

由于某种原因,在使用 parl 时,默认库路径似乎被排除,因此上面的完整路径。

Perl blixtor's advice from comments I am moving the "edit updates" I had in the question to answer my own question here:

Most of the credit here goes to Andrew Barnett, the 2 key issues were the

  1. native C code library
  2. the perl LIB paths

Here were the steps I followed to get the cygwin created par to run on HPUX, I believe steps should be about same on any unix:

Followed Andrew's advice and removed IO::Socket with the pp -X IO::Socket switch, but then running the resulting parl on unix I get slightly modified but still related error:

Can't locate Socket.pm in @INC (@INC contains: CODE(0x406ab018) CODE(0x4055c880) CODE(0x40563978)) at Net/Config.pm line 11

even though running "perl -MCPAN -e shell" on the unix showed Socket should be installed and up to date:

cpan[2]> install IO::Socket
IO::Socket is up to date (1.30_01).

So in addition to excluding Socket with the -X switch abobe, I also had to create a wrapper script on HPUX with just this 1 line in in, wrapper.pl:

use PAR { file => 'bdiff.par', run => 'bdiff.pl' };

then to run this I didn't use parl, instead I would just call it with perl and I had to supply the entire paths to the default lib paths with the -I switch, like this:

perl -I/lib/perl5/lib/5.10.0/PA-RISC2.0 -I/lib/lib/site_perl wrapper.pl allparameters

for some reason when using parl it seems the default lib paths get excluded, hence the full paths above.

哎呦我呸! 2024-07-21 17:12:37

FWIW,PAR 的设计目的不是跨不同平台移植——不要指望在 cygwin 上创建的 par 包能够在 linux/hpux 上运行......

FWIW, PAR is not designed to be portable accross different platforms -- don't expect a par package created on cygwin to run on linux/hpux....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文