JNI Perl Parse Problems on Linux

[email protected] ("Marc A. Lepage") Thu, 01 Aug 2002 15:10:25 -0400
Newsgroups perl.jpl
Organization Molecular Mining Corporation
Message-ID <[email protected]>
I'm not using JPL directly, but I am using the same basic approach of perlembed 
from C via JNI from Java.

I have made the basic perlembed programs as detailed here:

     http://www.perldoc.com/perl5.6/pod/perlembed.html

and they do work fine for me on their own. I am using Perl 5.6.1 on Debian Linux 
(kernel 2.4.3).

However, I find that I do not get through perl_parse when the same .o is used 
from JNI. I find this using either JDK 1.3.1 or JDK 1.4.0.

This seems to be the same basic problem documented here:

 
http://www.rosat.mpe-garching.mpg.de/mailing-lists/perl-xs/2001-12/msg00024.html
 
http://www.rosat.mpe-garching.mpg.de/mailing-lists/perl-xs/2001-06/msg00003.html

I understand that the reason is due to threading and other conflicts between 
Java and Perl. I found some suggestions for resolving these issues at the above 
URLs and here:

     http://inline.perl.org/java/faq.html
     http://www.oreilly.com/catalog/prkunix/excerpt/UGch03.html

Basically, they involve building a Perl with these options:

     not building a threading Perl
     not building a multiplicity Perl
     ensuring that pthread library is linked first
     not using Perl's own malloc
     defining -DNEED_ENVIRON_DUP_FOR_MODIFY (via -DJPL)

I tried this, and it did not help for me. I'm pretty sure that I selected the 
correct build options, and am using the built headers/objects/libraries. But it 
does seem strange that the suggested fixes are not working for me, so I do 
wonder if I am doing something incorrectly.

So I am inquiring as to the current state of using embedded Perl via JNI on 
Linux. Which environments work? What must I do to make them work? Are there more 
detailed sources of information besides the URLs I provided above?

Any insight you can provide is much appreciated. I can provide further info as 
required. Again I'd just like to get the basic six-line perlembed program 
working from JNI; I'm not actually using JPL; we just share the same issues.

-- 
Marc A. Lepage
Senior Software Developer
Molecular Mining - The Power of Prediction
http://www.molecularmining.com/