perl - How to build Perl with PERL_IMPLICIT_CONTEXT?
问题描述
According to perlguts:
When Perl is built with PERL_IMPLICIT_CONTEXT, extensions that call any functions in the Perl API will need to pass the initial context argument somehow. The kicker is that you will need to write it in such a way that the extension still compiles when Perl hasn't been built with PERL_IMPLICIT_CONTEXT enabled.
How can I build Perl with PERL_IMPLICIT_CONTEXT
? And how can I later check if an installed Perl has been compiled with PERL_IMPLICIT_CONTEXT
?
解决方案
正如@Dada 所指出的,perl 5 的构建和安装指南中提供了有关如何使用PERL_IMPLICIT_CONTEXT
. 该-A
选项与要添加到 的Configure
脚本一起使用。例如,要构建 5.28.0并安装在:
-DPERL_IMPLICIT_CONTEXT
ccflags
PERL_IMPLICIT_CONTEXT
$HOME/localperl
wget https://www.cpan.org/src/5.0/perl-5.28.0.tar.gz
tar -xzf perl-5.28.0.tar.gz
cd perl-5.28.0
./Configure -des -Dprefix=$HOME/localperl -Accflags="-DPERL_IMPLICIT_CONTEXT"
make
make test
make install
或者,您可以使用perlbrew
:
perlbrew install perl-5.28.0 --as=5.28.0ic -Accflags="-DPERL_IMPLICIT_CONTEXT"
perlbrew switch 5.28.0ic
问题的第二部分:如何检查已安装的 Perl 是否已使用 PERL_IMPLICIT_CONTEXT 编译?正如@JGNI 所指出的,perl -V
可以使用:
$ perl -V | grep PERL_IMPLICIT_CONTEXT
config_args='-de -Dprefix=/home/hakon/perlbrew/perls/5.28.0ic -Dusedevel -Accflags=-DPERL_IMPLICIT_CONTEXT -Aeval:scriptdir=/home/hakon/perlbrew/perls/5.28.0ic/bin'
ccflags ='-DPERL_IMPLICIT_CONTEXT -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
cppflags='-DPERL_IMPLICIT_CONTEXT -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
PERL_IMPLICIT_CONTEXT
或者,您可以使用Config模块访问 Perl 配置信息。
推荐阅读
- neural-network - 我想用 Numpy 模拟一个量化的 MobileNet V2 网络的推理过程,但是结果与 pytorch 实现的不同
- android - 反应原生:滚动视图刷新控制拉刷新不从顶部刷新
- c# - .NET Standard 的 AllowHtmlAttribute 替代品,因为它已被删除?
- javascript - 如何从 ReactJs 中的输入类型文件中获取音乐信息
- quasar-framework - 叶子和严格的q-treetick策略组合?
- r - 车包Anova“下标越界”
- javascript - 如何跟踪和收集特定字段的所有使用过的依赖 JavaScript
- c - 输入两个字符串a和b,请计算b在a中出现的次数
- javascript - 如何使用表格标题的弹出窗口中的按钮对表格进行排序
- ios - Xcode cocoa pods pod install Sentry 导致“找不到模块'Sentry'”