如何在 linux 机器上打包带有从 Windows 到 运行 的所有依赖项的 perl 脚本?
How to pack perl script with all dependencies from Windows to run on linux machine?
我已经使用 pp PAR::Packer 在 Windows 机器上为 运行 构建了一个独立的 exe 文件。
有人可以解释如何使用此 Windows 机器上的所有依赖包构建 Perl 脚本,以在 [=22= 上创建一个 运行 的独立文件]机?
从 Windows 机器 is not possible 开始在 Linux 机器上生成 运行 的二进制文件。
您使用 pp(来自 PAR-Packer
)命令的方式可能与您在 Windows
中使用的方式完全相同
pp -S -M Some::Module -M Some::Other::Module -o youBinary.bin Script1.pl Script2.pl ScriptN.pl
注意事项:
-M
标志可能是必需的,因为有时自动查找依赖项可能不起作用(其中一些是在 运行 时动态加载的,所以在您获得很好的组合)。当你在执行 pp
: 时看到这样的警告时要特别小心
Use of runtime loader module Module::Runtime detected. Results of static scanning may be incomplete.
Use of runtime loader module Module::Implementation detected. Results of static scanning may be incomplete.
将多个脚本打包成一个二进制文件的可能性。您可以为该二进制文件创建不同的符号链接以执行不同的脚本。
When a single input program is specified, the resulting executable will behave identically as that program. However, when multiple programs are packaged, the produced executable will run the one that has the same basename as [=15=] (i.e. the filename used to invoke it). If nothing matches, it dies with the error "Can't open perl script "[=15=]"
时不时很方便。
还要注意在带有 "older" libc 的机器上创建二进制文件。如果你在前沿 linux 上执行此操作,你将需要一个前沿 linux 到 运行 它,使其不那么便携。
Note that even if your perl was built with a shared library, the 'Stand-alone executable' above will not need a separate perl5x.dll or libperl.so to function correctly. But even in this case, the underlying system libraries such as libc must be compatible between the host and target machines.
享受独立的 Perl 二进制文件。
编辑
从 Windows 机器 is not possible.
开始在 Linux 机器上生成 运行 的二进制文件
The Perl Packager scripts says that it can create executable that runs in same OS. Can I use it to create Win32 binary with linux machine? Or what should I use to create Win32 executable binary on linux from my script?
It is not possible to create stand-alone binaries for different platform than what you are currently running on. This is a generally hard problem since you would have to cross-compile all XS modules and perl itself. Not nice.
For example, if you would like to develop an application on Linux and ship it for both Linux/x86 and Win32/x86, it works well to set up a Virtual Machine with a Windows (XP or 2000 or whatever) and a Perl installation. On that machine, use PAR/pp to package your application for Win32.
On what platforms can I run PAR? On what platforms will the resulting executable run?
Win32 (95/98/ME/NT4/2K/XP), FreeBSD, Linux, AIX, Solaris, Darwin and Cygwin.
The resulting executable will run on any platforms that supports the binary format of the generating platform.
我已经使用 pp PAR::Packer 在 Windows 机器上为 运行 构建了一个独立的 exe 文件。
有人可以解释如何使用此 Windows 机器上的所有依赖包构建 Perl 脚本,以在 [=22= 上创建一个 运行 的独立文件]机?
从 Windows 机器 is not possible 开始在 Linux 机器上生成 运行 的二进制文件。
您使用 pp(来自 PAR-Packer
)命令的方式可能与您在 Windows
pp -S -M Some::Module -M Some::Other::Module -o youBinary.bin Script1.pl Script2.pl ScriptN.pl
注意事项:
-M
标志可能是必需的,因为有时自动查找依赖项可能不起作用(其中一些是在 运行 时动态加载的,所以在您获得很好的组合)。当你在执行pp
: 时看到这样的警告时要特别小心
Use of runtime loader module Module::Runtime detected. Results of static scanning may be incomplete.
Use of runtime loader module Module::Implementation detected. Results of static scanning may be incomplete.
将多个脚本打包成一个二进制文件的可能性。您可以为该二进制文件创建不同的符号链接以执行不同的脚本。
When a single input program is specified, the resulting executable will behave identically as that program. However, when multiple programs are packaged, the produced executable will run the one that has the same basename as [=15=] (i.e. the filename used to invoke it). If nothing matches, it dies with the error "Can't open perl script "[=15=]"
时不时很方便。
还要注意在带有 "older" libc 的机器上创建二进制文件。如果你在前沿 linux 上执行此操作,你将需要一个前沿 linux 到 运行 它,使其不那么便携。
Note that even if your perl was built with a shared library, the 'Stand-alone executable' above will not need a separate perl5x.dll or libperl.so to function correctly. But even in this case, the underlying system libraries such as libc must be compatible between the host and target machines.
享受独立的 Perl 二进制文件。
编辑
从 Windows 机器 is not possible.
开始在 Linux 机器上生成 运行 的二进制文件The Perl Packager scripts says that it can create executable that runs in same OS. Can I use it to create Win32 binary with linux machine? Or what should I use to create Win32 executable binary on linux from my script?
It is not possible to create stand-alone binaries for different platform than what you are currently running on. This is a generally hard problem since you would have to cross-compile all XS modules and perl itself. Not nice.
For example, if you would like to develop an application on Linux and ship it for both Linux/x86 and Win32/x86, it works well to set up a Virtual Machine with a Windows (XP or 2000 or whatever) and a Perl installation. On that machine, use PAR/pp to package your application for Win32.
On what platforms can I run PAR? On what platforms will the resulting executable run?
Win32 (95/98/ME/NT4/2K/XP), FreeBSD, Linux, AIX, Solaris, Darwin and Cygwin.
The resulting executable will run on any platforms that supports the binary format of the generating platform.