perl - How can I use rperl with perlbrew?
问题描述
I have this simple rperl
program:
#!/usr/bin/env perl
use RPerl;
use strict;
use warnings;
our $VERSION = 0.001_000;
# [[[ CRITICS ]]]
## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print operator
## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils
## no critic qw(ProhibitInterpolationOfLiterals) # USER DEFAULT 3: allow anything
print 'Hello Perl', "\n";
See Exercise 1 in Learning RPerl. I am on Ubuntu 19.04, using perlbrew
with perl
version 5.28.1. I installed RPerl
using:
$ cpanm RPerl
Then I tried to compile the above program:
$ rperl -D p.pl
[...]
[[[ SUBCOMPILE STDERR ]]]
/bin/ld: cannot find -lperl
collect2: error: ld returned 1 exit status
ERROR ECOCOSU04, COMPILER, SUBCOMPILE: C++ compiler returned error code,
[...]
解决方案
Apparently, rperl
needs to link against libperl.so
, but the perl
I installed rperl
with was not built with a shared library libperl.so
. The solution was to install a new perl
using configure option -Duseshrplib
:
$ perlbrew install perl-5.30.0 --notest --noman --as=5.30.0-reloc -Duseshrplib
$ perbrew use 5.30.0-reloc
$ cpanm RPerl
$ rperl -V p.pl
[...]
$ ./p
Hello Perl
推荐阅读
- javascript - React 中的 event.preventDefault 给出 TypeError: event is undefined
- python - 如何从没有逗号且键中没有值的字典中提取记录
- global-variables - 如何在 Emacs Lisp 中保持全局状态,而不使用动态范围?
- java - MapBox Place Picker 导致致命信号 6
- c# - c# CefSharp Flash 问题
- python - 动态创建实例时如何调用函数?
- html - aria-busy 和 aria-tomic 是干什么用的?
- regex - 在 Google Apps 脚本中;使用正则表达式和条件格式 - 创建 IPv4 地址验证器/检查器
- checkbox - Q 关于 Vuetify 复选框对齐
- java - Apache POI Word Table Cell 不更新颜色 (XWPFTableCell)