在构建模块时如何覆盖 perl 的编译标志?

发布于 2024-08-08 02:12:03 字数 430 浏览 2 评论 0原文

构建 Perl 模块时,ExtUtils::MakeMaker 使用 Config.pm 中定义的标志(请参阅 perldoc Config)作为 ccflags 和 ldflags 等值。

如何覆盖这些值(除了编辑 Makefile.PL)?

perl Makefile.PL ldflags=<options> 

似乎不起作用。

语境: 我正在尝试在 OS X 10.6 上编译 Term::Readline::Gnu。 默认的 OS X perl 是通用二进制文件,因此具有诸如 -arch i386 -arch ppc 等 ccflags。
另一方面,我的 Gnu Readline (6.0) 版本仅是从 -arch i386 的源代码编译的。因此,它不包含尝试使用 -arch ppc 链接到它的模块的预期符号。

When building a Perl module ExtUtils::MakeMaker uses the flags defined in Config.pm (see perldoc Config) for values such as ccflags and ldflags.

How do I override theses values (short of editing the Makefile.PL)?

perl Makefile.PL ldflags=<options> 

does not seem to work.

Context:
I am trying to compile Term::Readline::Gnu on OS X 10.6.
The default OS X perl is a universal binary and thus has ccflags like -arch i386 -arch ppc etc.
On the other hand my version of Gnu Readline (6.0) has been compiled from source for -arch i386 only. As such it does not contain the expected symbols for a module trying to link to it using -arch ppc.

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

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

发布评论

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

评论(2

澉约 2024-08-15 02:12:03

一般来说,尝试覆盖 Config.pm 中的设置是徒劳的。想要更改它们的更常见原因是更改使用非 GNU 编译器编译 Perl 但您想使用 GCC 的机器上的编译器。这是很难做到的,所以到目前为止,使用您选择的编译器重建 Perl,安装所有辅助模块,然后使用构建您选择的新模块而不是尝试对抗“系统”要简单得多。

因此,您可以执行以下两件事之一:使用 Perl 将使用的相同选项构建 GNU Readline 库,或者使用用于构建 GNU Readline 的选项构建 Perl。如果你珍视你的机器和你头上的头发,不建议尝试弯曲一个来满足另一个(请不要那么用力地敲打机器 - 这是你应该感到沮丧的软件,而不是硬件;Mac 很好!)。

在这两个选项中,重建 GNU Readline 可能更容易 - 它更小并且附加组件更少。

In general, trying to override the settings in Config.pm is an exercise in futility. The more normal reason for wanting to change them is to change the compiler on a machine where Perl was compiled with a non-GNU compiler but you want to use GCC. This is so hard to do that it is by far simpler to rebuild Perl with your chosen compiler, install all the auxilliary modules, and then use build your chosen new module rather than try to fight 'the system'.

You can therefore do one of two things - build your GNU Readline library with the same options that Perl would use, or build your Perl with the options used to build GNU Readline. Trying to bend one to meet the other is not recommended if you value your machine and the hair on your head (please don't hit the machine that hard - it is the software you should be frustrated with, not the hardware; Mac's are nice!).

Of the two options, rebuilding GNU Readline is probably the easier - it is smaller and has fewer add-ons.

红尘作伴 2024-08-15 02:12:03

尽管文档的 Hintsfile 支持 部分中提供的信息可能相关,但我没试过。

Information provided in the Hintsfile Support section of the docs might be relevant, although I have not tried it.

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