我有一个简单的rperl程序:
#!/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";请参见Learning RPerl中的练习1。我在Ubuntu19.04上,使用带有perl版本5.28.1的perlbrew。我使用以下命令安装了RPerl:
$ cpanm RPerl然后我尝试编译上面的程序:
$ 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,
[...]发布于 2019-08-13 07:07:55
显然,rperl需要链接到libperl.so,但是我用来安装rperl的perl并不是用共享库libperl.so构建的。解决方案是使用配置选项-Duseshrplib安装新的perl:
$ 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 Perlhttps://stackoverflow.com/questions/57469236
复制相似问题