[ https://issues.apache.org/jira/browse/PYLUCENE-13?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13162273#comment-13162273 ]
Andi Vajda commented on PYLUCENE-13: ------------------------------------ I got this to work by relying on the implementation of JArray in the 'jcc' module. This is broken, though, as jcc itself is not built shared. In other words, it does not link to the libjcc shared library but links that code statically. This makes importing it at runtime - to reuse its JArray implementation - broken currently because the libjcc code is loaded twice, once static, once shared and sharing is defeated. For this bug to be fixed, jcc itself has to be built shared. For jcc to be built shared, the libjcc shared library has to be built and installed before jcc itself is built. Currently, there is a bit of a chicken/egg problem with this because libjcc is built at the same time as jcc, in setup.py. If libjcc's build were moved to a regular configure; make; make install kind of build then all the above problems would resolve themselves and we'd be able to get rid of the setuptools patching hackery for this Library build as well. Another sizable benefit would be that shared mode would be supported everywhere and become the default. I don't see this happening for the 3.5 release, though. > JArray not shared - TypeError > ----------------------------- > > Key: PYLUCENE-13 > URL: https://issues.apache.org/jira/browse/PYLUCENE-13 > Project: PyLucene > Issue Type: Bug > Reporter: roman > Labels: build, jcc, pylucene > > JCC has the option to build module in a shared mode. However > JArray....objects are never shared > This works when using only lucene, but fails when the other module is linked > against lucene > # create array of string objects > x = j.JArray_object(5) > for i in range(5): > x[i] = j.JArray_string(['x', 'z']) > In [7]: for i in range(5): > x[i] = j.JArray_string(['x', 'z']) > ...: > ...: > --------------------------------------------------------------------------- > TypeError Traceback (most recent call last) > /dvt/workspace/montysolr/src/python/<ipython console> in <module>() > TypeError: JArray<string>[u'x', u'z'] > The JArray functions/objects are different: > In [9]: id(lucene.JArray_string) > Out[9]: 140313957671376 > In [10]: id(solr_java.JArray_string) > Out[10]: 140313919877648 > In [11]: id(montysolr_java.JArray_string) > Out[11]: 140313909254704 > In [12]: id(j.JArray_string) > Out[12]: 140313909254704 > Other objects are shared: > In [18]: id(lucene.Weight) > Out[18]: 140313957203040 > In [19]: id(solr_java.Weight) > Out[19]: 140313957203040 > In [20]: id(j.Weight) > Out[20]: 140313957203040 > The module 'j' is built with: > -m jcc --shared --import lucene --import solr_java --package > org.apache.solr.request --classpath ... --include > ../build/jar/montysolr_java-0.1.jar --python montysolr_java --build > --bdist -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira