On 7/5/13 10:47 AM, Andi Vajda wrote:
On Jul 5, 2013, at 1:34, Johan Jonkers <jo...@seecr.nl> wrote:

On 7/5/13 10:16 AM, Andi Vajda wrote:
On Jul 5, 2013, at 0:11, Johan Jonkers <jo...@seecr.nl> wrote:

Hi Andi,

I was able to compile it all into one module and that worked perfectly.

I then tried to compile it again into two seperate modules and compared the 
generated wrappers. What I saw was that all methods in the SumWrapper class 
that had a reference to the Sum class were not wrapped (didn't see them in 
SumWrapper.h). I also checked the output to see if there was some sort of 
notification/warning saying there was a problem with these methods but didn't 
see anything.
I am thinking that they aren't being wrapped because they somehow can't be 
resolved. I tried looking in the JCC code where that happens but haven't been 
very successful at that so far.
Please, list the commands you used. It's easier to debug this way.
Did you list the Sum class on the second jcc command line ?
Below is part of the script I use to compile the modules.

javac nl/seecr/freestyle/Sum.java -d build_seecr
(cd build_seecr; jar -c nl > ../seecr.jar)
javac org/cq2/freestyle/SumWrapper.java -d build_cq2 -cp ./seecr.jar
(cd build_cq2; jar -c org > ../cq2.jar)

JCC="python -m jcc.__main__"

echo '#
# Building CQ2 module
#
'

${JCC} \
    --root ${ROOT} \
    --use_full_names \
    --shared \
    --arch x86_64 \
    --jar cq2.jar \
    --classpath ./seecr.jar \
Why are you listing seecr.jar here ?
Thank you so much for pointing this out, it triggered me looking more close at the compile statement and realize that I had it all backwards. The cq2 package should have an import for seecr package and not the other way around. By adding a seecr import to the jcc statement compiling the cq2 package it works:

${JCC} \
    --root ${ROOT} \
    --use_full_names \
    --shared \
    --arch x86_64 \
    --jar seecr.jar \
    --python seecr \
    --build \
    --install

export PYTHONPATH=$(find ${ROOT} -type d -name "site-packages" | head -n 1)
${JCC} \
    --root ${ROOT} \
    --use_full_names \
    --import seecr \
    --shared \
    --arch x86_64 \
    --jar cq2.jar \
    --python cq2 \
    --build \
    --install

Although this does put an order in which to compile things; the seecr package has to be present now before the cq2 package can be compiled but that won't be an problem.

There now also seems to be an order in which things have to be imported in python:
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cq2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
File "/home/zp/zandbak_jj/playwithjcc/root/usr/lib64/python2.6/site-packages/cq2/__init__.py", line 28, in <module>
    from seecr._seecr import *
File "/home/zp/zandbak_jj/playwithjcc/root/usr/lib64/python2.6/site-packages/seecr/__init__.py", line 29, in <module>
    from java.io import PrintWriter, StringWriter
ImportError: No module named java.io
>>>

versus

Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import seecr
>>> from java.io import PrintWriter, StringWriter
>>>

But that is something we can live with.


Thank you for all help

Johan

Reply via email to