Inline-Perl5
Inline-Perl5 copied to clipboard
Problem using Smart::Comments:from<Perl5> in a Raku program
#!/usr/bin/env raku
use Inline::Perl5;
use Smart::Comments:from<Perl5>;
my $foo = 42;
### $foo
say "Done";
Expected output:
### $foo: 42
Done
Actual output:
Done
zsh: segmentation fault raku sc-test.raku
@deoac
Can you please provide links to gists of the output of raku -V and perl -V. Thanks!
Hi niner!
They are both at https://gist.github.com/deoac/734c0f51b8bf2d6555cd64ee0de818fe .
Thanks,
Shimon
On Apr 8, 2023, at 9:14 PM, raiph @.***> wrote:
@deoac https://github.com/deoac Can you please provide links to gists of the output of raku -V and perl -V. Thanks!
— Reply to this email directly, view it on GitHub https://github.com/niner/Inline-Perl5/issues/182#issuecomment-1501012558, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEI7VNDXJ2W6YLME7Z5JQLXAIEP7ANCNFSM6AAAAAAWXXMK5Q. You are receiving this because you were mentioned.
Hi @deoac
BTW, I'm not niner, and I'm no expert in these matters, and don't have a Mac, but I'll try to keep moving things along.
I did a search for -fPIC in the Perl build info and didn't get a match. Quoting the BUILDING section of Inline::Perl5's README:
You will need a perl 5 built with the
-fPICoption (position independent code). Most distributions build their Perl 5 that way.
Wikipedia suggests Macs support it but call it "position independent executables" (PIE).
Anyhow, whatever it's called, and however it's built that way, my initial presumption at this point is that your perl was not built as a PIC/PIE binary and that's the problem.
An SO answer says most systems support a tool to run on the perl binary to find out whether it was built with or without a position independent option: otool -hv <file_path>. So please try that, or whatever else you find that works like it, and/or follow the instructions in the above linked section to rebuild your perl which begin:
When you use perlbrew, you have to build it as:
perlbrew install perl-stable -Duseshrplib...
So please try that and report back. Thanks.
Hi not-niner!
% otool -hv which perl
/usr/local/bin/perl:
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC_64 X86_64 ALL 0x00 EXECUTE 18 1384 NOUNDEFS DYLDLINK TWOLEVEL PIE
It looks like it was compiled with PIE .
I’ll reinstall perl and try again.
Thanks for all the research,
Shimon
On Apr 9, 2023, at 4:27 PM, raiph @.***> wrote:
t
Anyway using Smart::Comments will never work like that. It's a source filter. It actually parses your Perl code and changes your comments to real code. It will fail when faced with Raku code.
To be 100% clear: Perl modules consisting of source-filters, will NEVER work with Inline::Perl5. Right, @niner?