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

Segmentation fault in embedding Parrot into Perl 5 #830

Closed
p6rt opened this issue Mar 23, 2009 · 6 comments
Closed

Segmentation fault in embedding Parrot into Perl 5 #830

p6rt opened this issue Mar 23, 2009 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Mar 23, 2009

Migrated from rt.perl.org#64124 (status was 'resolved')

Searchable as RT64124$

@p6rt
Copy link
Author

p6rt commented Mar 23, 2009

From @szabgab

I am not sure if this is a Parrot or Rakudo bug
or just a plain invalid usage on my side.

The following code runs, prints the prompt but when I
enter a response I get a Segmentation fault.

Gabor

#!/usr/bin/perl
use strict;
use warnings;

# Needs two environment variables​:
# PARROT_DIR needs to point to the directory where parrot was checked out
# export LD_LIBRARY_PATH=$PARROT_DIR/blib/lib/

# cwd still needs to be PARROT_DIR or I get the following error​:
#"load_bytecode" couldn't find file 'PCT.pbc'
#current instr.​: '' pc 743 (src/classes/Object.pir​:20)
#called from Sub 'myperl6' pc 3 (EVAL_1​:3)

# Before running I had to build Parrot​::Embed​:
# cd $ENV{PARROT_DIR}/ext/Parrot-Embed/
# perl Build.PL
# perl Build
# perl Build test

die "need PARROT_DIR" if not $ENV{PARROT_DIR};
unshift @​INC, (
  "$ENV{PARROT_DIR}/ext/Parrot-Embed/blib/lib",
  "$ENV{PARROT_DIR}/ext/Parrot-Embed/blib/arch",
  );
 
require Parrot​::Embed;
my $interp = Parrot​::Interpreter->new;

my $perl6 =<<"END_PIR";
.sub myperl6
  .param string in_string
  load_bytecode '$ENV{RAKUDO_DIR}/perl6.pbc'

  \$P0 = get_hll_global 'prompt'
  .tailcall \$P0('Enter your name​: ')
.end
END_PIR

my $eval = $interp->compile( $perl6 );
my $foo = $interp->find_global('myperl6');
my $pmc = $foo->invoke( 'PS', 'say "hello"' );
print $pmc->get_string(), "\n";

@p6rt
Copy link
Author

p6rt commented Aug 18, 2010

From @coke

On Mon Mar 23 13​:09​:56 2009, szabgab@​gmail.com wrote​:

I am not sure if this is a Parrot or Rakudo bug
or just a plain invalid usage on my side.

The following code runs, prints the prompt but when I
enter a response I get a Segmentation fault.

Gabor

#!/usr/bin/perl
use strict;
use warnings;

# Needs two environment variables​:
# PARROT_DIR needs to point to the directory where parrot was checked out
# export LD_LIBRARY_PATH=$PARROT_DIR/blib/lib/

# cwd still needs to be PARROT_DIR or I get the following error​:
#"load_bytecode" couldn't find file 'PCT.pbc'
#current instr.​: '' pc 743 (src/classes/Object.pir​:20)
#called from Sub 'myperl6' pc 3 (EVAL_1​:3)

# Before running I had to build Parrot​::Embed​:
# cd $ENV{PARROT_DIR}/ext/Parrot-Embed/
# perl Build.PL
# perl Build
# perl Build test

die "need PARROT_DIR" if not $ENV{PARROT_DIR};
unshift @​INC, (
"$ENV{PARROT_DIR}/ext/Parrot-Embed/blib/lib",
"$ENV{PARROT_DIR}/ext/Parrot-Embed/blib/arch",
);

require Parrot​::Embed;
my $interp = Parrot​::Interpreter->new;

my $perl6 =<<"END_PIR";
.sub myperl6
.param string in_string
load_bytecode '$ENV{RAKUDO_DIR}/perl6.pbc'

    \\$P0 = get\_hll\_global 'prompt'
    \.tailcall \\$P0\('Enter your name&#8203;: '\)

.end
END_PIR

my $eval = $interp->compile( $perl6 );
my $foo = $interp->find_global('myperl6');
my $pmc = $foo->invoke( 'PS', 'say "hello"' );
print $pmc->get_string(), "\n";

Gabor -

Sorry for the delay in responding. This ticket is over a year old - can you still reproduce this
problem?
--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Aug 18, 2010

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 23, 2010

From @szabgab

On Wed, Aug 18, 2010 at 8​:13 AM, Will Coleda via RT
<perl6-bugs-followup@​perl.org> wrote​:

On Mon Mar 23 13​:09​:56 2009, szabgab@​gmail.com wrote​:

I am not sure if this is a Parrot or Rakudo bug
or just a plain invalid usage on my side.

The following code runs, prints the prompt but when I
enter a response I get a Segmentation fault.

Gabor

#!/usr/bin/perl
use strict;
use warnings;

# Needs two environment variables​:
# PARROT_DIR needs to point to the directory where parrot was checked out
# export LD_LIBRARY_PATH=$PARROT_DIR/blib/lib/

# cwd still needs to be PARROT_DIR or I get the following error​:
#"load_bytecode" couldn't find file 'PCT.pbc'
#current instr.​: '' pc 743 (src/classes/Object.pir​:20)
#called from Sub 'myperl6' pc 3 (EVAL_1​:3)

# Before running I had to build Parrot​::Embed​:
# cd $ENV{PARROT_DIR}/ext/Parrot-Embed/
# perl Build.PL
# perl Build
# perl Build test

die "need PARROT_DIR" if not $ENV{PARROT_DIR};
unshift @​INC, (
              "$ENV{PARROT_DIR}/ext/Parrot-Embed/blib/lib",
              "$ENV{PARROT_DIR}/ext/Parrot-Embed/blib/arch",
              );

require Parrot​::Embed;
my $interp = Parrot​::Interpreter->new;

my $perl6 =<<"END_PIR";
.sub myperl6
        .param string    in_string
        load_bytecode '$ENV{RAKUDO_DIR}/perl6.pbc'

        \$P0 = get_hll_global 'prompt'
        .tailcall \$P0('Enter your name​: ')
.end
END_PIR

my $eval = $interp->compile( $perl6 );
my $foo = $interp->find_global('myperl6');
my $pmc = $foo->invoke( 'PS', 'say "hello"' );
print $pmc->get_string(), "\n";

Gabor -

Sorry for the delay in responding. This ticket is over a year old - can you still reproduce this
problem?

Yes, this still gives me segmentation fault but now the test suit of
Parrot​::Embed also fails with

gabor@​localhost​:~/work/rakudo/parrot/ext/Parrot-Embed$ perl Build test
t/00-load.t .... ok
t/interp.t ..... 1/23 Parrot VM​: Can't stat no file here, code 2.
/usr/bin/perl​: symbol lookup error​:
/home/gabor/work/rakudo/parrot/ext/Parrot-Embed/blib/arch/auto/Parrot/Embed/Embed.so​:
undefined symbol​: Parrot_PMC_get_cstring
t/interp.t ..... Dubious, test returned 127 (wstat 32512, 0x7f00)
Failed 5/23 subtests

Gabor

@p6rt
Copy link
Author

p6rt commented Feb 12, 2012

From @coke

On Mon Mar 23 13​:09​:56 2009, szabgab@​gmail.com wrote​:

I am not sure if this is a Parrot or Rakudo bug
or just a plain invalid usage on my side.

The following code runs, prints the prompt but when I
enter a response I get a Segmentation fault.

Gabor

#!/usr/bin/perl
use strict;
use warnings;

# Needs two environment variables​:
# PARROT_DIR needs to point to the directory where parrot was checked
out
# export LD_LIBRARY_PATH=$PARROT_DIR/blib/lib/

# cwd still needs to be PARROT_DIR or I get the following error​:
#"load_bytecode" couldn't find file 'PCT.pbc'
#current instr.​: '' pc 743 (src/classes/Object.pir​:20)
#called from Sub 'myperl6' pc 3 (EVAL_1​:3)

# Before running I had to build Parrot​::Embed​:
# cd $ENV{PARROT_DIR}/ext/Parrot-Embed/
# perl Build.PL
# perl Build
# perl Build test

die "need PARROT_DIR" if not $ENV{PARROT_DIR};
unshift @​INC, (
"$ENV{PARROT_DIR}/ext/Parrot-Embed/blib/lib",
"$ENV{PARROT_DIR}/ext/Parrot-Embed/blib/arch",
);

require Parrot​::Embed;
my $interp = Parrot​::Interpreter->new;

my $perl6 =<<"END_PIR";
.sub myperl6
.param string in_string
load_bytecode '$ENV{RAKUDO_DIR}/perl6.pbc'

    \\$P0 = get\_hll\_global 'prompt'
    \.tailcall \\$P0\('Enter your name&#8203;: '\)

.end
END_PIR

my $eval = $interp->compile( $perl6 );
my $foo = $interp->find_global('myperl6');
my $pmc = $foo->invoke( 'PS', 'say "hello"' );
print $pmc->get_string(), "\n";

Parrot​::Embed is no longer bundled with parrot, so closing this ticket,
sorry.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Feb 12, 2012

@coke - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Feb 12, 2012
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

1 participant