Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

How to compile RPerl successfully?

by fuzzmonkey (Sexton)
on Apr 10, 2017 at 20:58 UTC ( [id://1187588]=perlquestion: print w/replies, xml ) Need Help??

fuzzmonkey has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I've been curious to try out Will Braswell's RPerl compiler. I've tried to compile it on various systems using cpanm. Although on many system I have forced a successfull install, I have not been able to compile the basic example given in Will's documentation. I get errors like:
/root/perl5/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1/RPerl/Data +Structure/Array.cpp:42:228: error: unable to find string literal oper +ator ‘operator"" INTEGER’ In file included from /root/perl5/perlbrew/perls/perl-5.24.1/lib/site_ +perl/5.24.1/rperltypes.h:13:0, from /root/perl5/perlbrew/perls/perl-5.24.1/lib/site_ +perl/5.24.1/RPerl.h:10, from /root/perl5/perlbrew/perls/perl-5.24.1/lib/site_ +perl/5.24.1/RPerl.cpp:4, from /root/perl5/perlbrew/perls/perl-5.24.1/lib/site_ +perl/5.24.1/rperlstandalone.h:22, from ./rperl_test2.cpp:6:
That error was when I used perl-5.24.1 built with perlbrew, and gcc-4.7.1. Should I try building RPerl with system Perl? Or do I need to upgrade some environment variable? Or maybe upgrade gcc? By the way the code I'm trying to compile with RPerl looks like this:
#!/usr/bin/perl # Foo Bar Arithmetic Example # [[[ HEADER ]]] use RPerl; use strict; use warnings; our $VERSION = 0.001_000; # [[[ CRITICS ]]] ## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCh +eckedSyscalls) # USER DEFAULT 1: allow numeric values & print operat +or ## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: al +low single-quoted control characters & sigils # [[[ OPERATIONS ]]] my integer $foo = 21 + 12; my integer $bar = 23 * 42 * 2; my number $baz = to_number($bar) / $foo; print 'have $foo = ', to_string($foo), "\n"; print 'have $bar = ', to_string($bar), "\n"; print 'have $baz = ', to_string($baz), "\n";
Thanks for the help, spintronic

Replies are listed 'Best First'.
Re: How to compile RPerl successfully?
by thanos1983 (Parson) on Apr 10, 2017 at 23:12 UTC

    Hello fuzzmonkey,

    First of all, thanks for the hint about RPerl I had no idea.

    To the question, I tried also to install RPerl on my LnuxOS and so far I was not successful. I found though that I need to install Package libgmp3-dev on Debian/derived systems.

    I also found out that I need to install m4, only after installing those packages I was able to install Math::BigInt::GMP as the Anonymous Monk pointed out.

    So far the process is compiling with no errors, I will keep you posted if I manage to install it.

    Update: Looks it is installed after the packages.

    Appending installation info to /home/tinyos/perl5/lib/perl5/x86_64-lin +ux-gnu-thread-multi/perllocal.pod WBRASWELL/RPerl-2.450000.tar.gz /usr/bin/make install -- O

    After installing the module RPerl I tried to execute the sample of code and I got the following error:

    /usr/bin/ld: cannot find -lperl collect2: error: ld returned 1 exit status

    So in case you are running Debian/derived system the solution is simply install libperl-dev.

    Finally running the script with debugger mode on it prints:

    $ rperl -D test.pl in rperl, have $RPerl::DEBUG = 1 in rperl, have $RPerl::VERBOSE = 0 g++ -pthread -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-a +liasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET +_BITS=64 -xc++ -I"/home/tinyos/perl5" -I"/home/tinyos/perl5/lib/perl5 +" -Ilib -Wno-unused-variable -DNO_XSLOCKS -Wno-deprecated -std=c++11 +-Wno-reserved-user-defined-literal -Wno-literal-suffix -D__CPP__TYPES + -D__TYPE__INTEGER__LONG -D__TYPE__NUMBER__DOUBLE -O3 -fomit-frame-po +inter -march=native -g -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\" -fPIC + "-I/usr/lib/x86_64-linux-gnu/perl/5.22/CORE" ./test.cpp -o ./test - +lperl have $foo = 33 have $bar = 1_932 have $baz = 58.545_454_545_454_5

    Hope this helps.

    Seeking for Perl wisdom...on the process of learning...not there...yet!
      Thanks Thanos this is exactly what I needed to do to get it working on my Debian box. Also needed some openssl development libraries.
Re: How to compile RPerl successfully?
by Anonymous Monk on Apr 10, 2017 at 22:24 UTC
    Couple moving parts here:
    1. make sure you have m4 installed (needed by gmp)
    2. make sure you have gmp installed (needed by Math::BigInt::Gmp)
    And as always ... use perlbrew!
Re: How to compile RPerl successfully?
by Anonymous Monk on Apr 10, 2017 at 21:43 UTC
Re: How to compile RPerl successfully?
by karlgoethebier (Abbot) on Apr 13, 2017 at 12:04 UTC

    BTW, isn't RPerl something like the Promised Land?

    «The Crux of the Biscuit is the Apostrophe»

    Furthermore I consider that Donald Trump must be impeached as soon as possible

        You remember the magic trick with the fish sandwiches AKA "Feeding the multitude" (Matthew 14:13-21)? See you at the next Auto-da-fé.

        «The Crux of the Biscuit is the Apostrophe»

        Furthermore I consider that Donald Trump must be impeached as soon as possible

      More info here www.i-programmer.info/news/222-perl/9637-rperl-running-perl-5-faster.html

        Thanks.

        «The Crux of the Biscuit is the Apostrophe»

        Furthermore I consider that Donald Trump must be impeached as soon as possible

      Is it?

        This was the question: "Promised Land" in the sense of "something that doesn't exist"

        «The Crux of the Biscuit is the Apostrophe»

        Furthermore I consider that Donald Trump must be impeached as soon as possible

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1187588]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found