Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem using Smart::Comments:from<Perl5> in a Raku program #182

Open
deoac opened this issue Apr 8, 2023 · 6 comments
Open

Problem using Smart::Comments:from<Perl5> in a Raku program #182

deoac opened this issue Apr 8, 2023 · 6 comments

Comments

@deoac
Copy link

deoac commented Apr 8, 2023

#!/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
@raiph
Copy link

raiph commented Apr 9, 2023

@deoac

Can you please provide links to gists of the output of raku -V and perl -V. Thanks!

@deoac
Copy link
Author

deoac commented Apr 9, 2023 via email

@raiph
Copy link

raiph commented Apr 9, 2023

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 -fPIC option (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.

@deoac
Copy link
Author

deoac commented Apr 10, 2023 via email

@niner
Copy link
Owner

niner commented Apr 10, 2023

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.

@lizmat
Copy link
Collaborator

lizmat commented Apr 10, 2023

To be 100% clear: Perl modules consisting of source-filters, will NEVER work with Inline::Perl5. Right, @niner?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants