HDolev
HDolev

Reputation: 413

Pylucene installation on MacOs with adoptopenjdk / Java8

I am trying to install JCC (as part of the installation of PyLucene) and I encountered several issues with it. The python version I use is 3.7, and I have installed adoptopenjdk-8.jdk using brew cask (since Java-8 is no longer available without specific license (read it somewhere)). After this didn't really worked I manually installed Java-8

The error I am receiving while trying to run setup.py in shell (using either java8 or adoptopenjdk) is:

OSError: warning: [options] bootstrap class path not set in conjunction with -source 5 
error: Source option 5 is no longer supported. Use 7 or later. 
error: Target option 5 is no longer supported. Use 7 or later.

Please help me install PyLucene!

It is related to these (but they are outdated and doesn't work):

pyLucene Installation

https://medium.com/@michaelaalcorn/how-to-use-pylucene-e2e2f540024c

EDIT: I realized this is related to javac versions but idk how to solve it. This site looks helpful (from the code) but I can't understand whats written here: https://www.jianshu.com/p/dcd149a65eb0

Upvotes: 0

Views: 390

Answers (2)

Clem Wang
Clem Wang

Reputation: 739

After much gnashing of teeth, I found that this works to build pylucene

My configuration:

  • Mac OSX 10.15.7

  • Powerbook Intel core i7 (I note this, because I got the weird error "gcc: error: this compiler does not support arm64" when trying to compile with gcc)

  • Python 2.7.16 (Python 3.8.2 doesn't seem to work... lots of compile errors with bad types.)

  • Apple clang version 12.0.0 (clang-1200.0.32.29)

  • gcc (Homebrew GCC 10.2.0_3) 10.2.0

I used clang instead of gcc (which doesn't seem to work at all) by doing this:

export CC=/usr/bin/clang
export CXX=/usr/bin/clang++

In the file setup.py, I removed -ljava and -ljvm flags from the LFLAG dictionary where darwin is in the key. Otherwise, ld complains.

I've managed only to build pylucene. I have no idea (yet) whether it will work with Python 2.7 or Python 3.x

I will update with details.

Upvotes: 0

HDolev
HDolev

Reputation: 413

So,

Changing the the setup.py file in 2 locations solved it:

line 185:

JAVAC = {
'darwin': ['/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/bin/javac', '-source', '1.5', '-target', '1.5'],

and adding one line here (line 68):

JAVAHOME = '/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home'

JDK = {
'darwin': JAVAHOME,
'ipod': '/usr/include/gcc',

Upvotes: 0

Related Questions