[ 
https://issues.apache.org/jira/browse/PYLUCENE-40?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16368076#comment-16368076
 ] 

Ryan J Ollos commented on PYLUCENE-40:
--------------------------------------

Thanks for the continue help despite my ignorance on Java technology. I have 
Java 9 installed, but I want to build with {{jdk1.8.0_141.jdk}}:
{code:java}
$ls /Library/Java/JavaVirtualMachines/
jdk-9.0.4.jdk           jdk1.8.0_141.jdk        jdk1.8.0_91.jdk
jdk1.7.0_80.jdk         jdk1.8.0_25.jdk
{code}
I looked at all the variables you listed, and only {{JCC_JAVAC}} and 
{{JCC_JAVADOC}} appear to be dependent on the JDK path. If we use the full path 
to the executables, derived from {{JCC_JDK}}, then the library appears to build 
correctly.

{code:java}
--- setup.py    (revision 1824083)
+++ setup.py    (working copy)
@@ -76,7 +76,7 @@
 }
 if 'JCC_JDK' in os.environ:
     JDK[platform] = os.environ['JCC_JDK']
-
+    print('using JDK = %s' % JDK[platform])

 if not JDK[platform]:
     raise RuntimeError('''
@@ -181,7 +181,7 @@
         LFLAGS['darwin'] = LFLAGS['darwin/frameworks']

 JAVAC = {
-    'darwin': ['javac', '-source', '1.5', '-target', '1.5'],
+    'darwin': ['%(darwin)s/bin/javac' %(JDK), '-source', '1.5', '-target', 
'1.5'],
     'ipod': ['jikes', '-cp', '/usr/share/classpath/glibj.zip'],
     'linux': ['javac'],
     'sunos5': ['javac'],
@@ -191,7 +191,7 @@
 }

 JAVADOC = {
-    'darwin': ['javadoc'],
+    'darwin': ['%(darwin)s/bin/javadoc' %(JDK)],
     'ipod': [],
     'linux': ['javadoc'],
     'sunos5': ['javadoc'],
{code}

To build I use:
{code}
$ JCC_JDK=`/usr/libexec/java_home -v 1.8` python setup.py
{code}

I've attached build output in [^jcc_build_output2.txt].

Side note: The patch probably needs to be modified using a python 2 and 3 
compatible {{print}}. I'm currently using Python2.7. Also, it would be good to 
print to stderr, like is done for the "found" statements in {{helpers2}} and 
{{helpers3}}. Maybe we could add a {{printerr}} function in each helpers module?

I will need to familiarize myself with the library in order to do testing and 
ensure everything is working.
 

> Document use of JCC_JDK
> -----------------------
>
>                 Key: PYLUCENE-40
>                 URL: https://issues.apache.org/jira/browse/PYLUCENE-40
>             Project: PyLucene
>          Issue Type: Improvement
>            Reporter: Ryan J Ollos
>            Priority: Minor
>         Attachments: jcc_build_output.txt, jcc_build_output2.txt
>
>
> I found two issues when trying to [help someone on Stack 
> Overflow|https://stackoverflow.com/questions/48711714/] build the library. 
> First, the [documentation on PyPI|https://pypi.python.org/pypi/JCC/] states:
> {quote}JCC’s setup.py file needs to be edited before building JCC to specify 
> the location of the Java Runtime Environment’s header files and libraries.
> {quote}
> However, it appears you have a better mechanism of setting {{JCC_JRE}}, but 
> it's not documented.
> Second, when setting {{JCC_JRE}} is appears to work correctly and use the 
> path to the specified {{JCC_JRE}} in the compilation, but the first line of 
> output might indicate that a different JRE is being used:
> {code:java}
> $JCC_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home 
> python setup.py install
> found JAVAHOME = 
> /Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home
> found JAVAFRAMEWORKS = /System/Library/Frameworks/JavaVM.framework
> ...
> {code}
> So maybe the found {{JAVAHOME}} should not be printed if {{JCC_JRE}} is set, 
> so it appears that {{JCC_JRE}} is successfully overriding the {{JAVAHOME}}. 
> I'll attach the full output from building on my platform.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to