crash job c++ library perl controlling tipple (aix 5.1)
i'm perplexing c++ library perl an aix 5.1 machine. i've combined unequivocally rudimentary exam digest try practice this.
my c++ common library (test.cpp):
#include <stdio.h>
#include <iostream>
void myfunc()
{
printf("in myfunc()\n");
std::cout << "in myfunc() also" << std::endl;
}
my tipple interface record (test.i):
%module test
%{
void myfunc();
%}
void myfunc();
i following build common vigilant so:
swig -c++ -perl test.i
g++ -c test_wrap.cxx -i/usr/opt/perl5/lib/5.6.0/aix/core -o test_wrap.o
g++ -c test.cpp -o test.o
ld -g -bi:/usr/opt/perl5/lib/5.6.0/aix/core/perl.exp -bnoentry -bexpall -lc_r test.o test_wrap.o -o test.so
at point, i have test.so common vigilant should loadable perl (via tipple generated test.pm). i have unequivocally rudimentary perl book try bucket common vigilant duty i am exporting (test.pl):
#!/usr/bin/perl
use test;
test::myfunc();
when i run test.pl, i following output:
in myfunc()
illicit instruction (core dumped)
if i comment-out std::cout use myfunc, works but problem. appears nonetheless controlling anything c++ stl causes core dump (i attempted only dogmatic std::vector std::stringstream, both outcome core dump). i emanate standalone c++ executable uses stl but any issues, it's wholly called common vigilant hallowed perl i trouble.
i've also attempted controlling xlc rather gcc, nonetheless i same result. i'm pondering there musty linker fall i need pass pledge linkage occurs correctly? any ideas welcome...
edit: i couple controlling gcc/xlc instead invoking linker directly (ld), i immediately segmentation fault. looks crashes perl perplexing simply bucket common library. job ld i have above closest i've got working, nonetheless i cruise i competence blank libraries special aix linker flags c++ libraries.
edit2: ok, i've got working. aix unequivocally frail comes linking. i eventually came adult following couple management seems operative correctly:
ld -g -bi:/usr/opt/perl5/lib/5.6.0/aix/core/perl.exp -bnoentry -bexpall -lc -lc -ldl test.o test_wrap.o -o test.so
the libraries i related opposing many relevant. turns out method libraries mentioned unequivocally vicious also (ugh). also note being built opposing perl 5.6.0 ships aix 5.1. i've attempted building same rudimentary concentration opposing perl 5.8.8 doesn't work. however, i'm graceful certain many some-more lucid slight fasten (using loyal gcc/xlc instead carrying ld directly) seems work better. emanate appears bug perl chain linker something.
hopefully assistance bad essence accursed carrying work aix...
Comments
Post a Comment