views:

406

answers:

2

Greetings, I'm trying to install Pylucene on my 32-bit python running on Snow Leopard. I compiled JCC with success. But I get warnings while making pylucene:

ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/__init__.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/__wrap01__.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/__wrap02__.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/__wrap03__.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/functions.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/JArray.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/JObject.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/lucene.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/types.o, file is not of required architecture
ld: warning: in /Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/JCC-2.3-py2.6-macosx-10.3-fat.egg/libjcc.dylib, file is not of required architecture
ld: warning: in /Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/JCC-2.3-py2.6-macosx-10.3-fat.egg/libjcc.dylib, file is not of required architecture
build of complete

Then I try to import lucene:

MacBookPro:~/tmp/trunk python
Python 2.6.3 (r263:75184, Oct  2 2009, 07:56:03) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylucene
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pylucene
>>> import lucene
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/lucene-2.9.0-py2.6-macosx-10.6-i386.egg/lucene/__init__.py", line 7, in <module>
    import _lucene
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/lucene-2.9.0-py2.6-macosx-10.6-i386.egg/lucene/_lucene.so, 2): Symbol not found: __Z8getVMEnvP7_object
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/lucene-2.9.0-py2.6-macosx-10.6-i386.egg/lucene/_lucene.so
  Expected in: flat namespace
 in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/lucene-2.9.0-py2.6-macosx-10.6-i386.egg/lucene/_lucene.so
>>>

Any hints?

A: 

Hard to say for sure, but could be as simple as jcc not being installed in the same python location. To troubleshoot I would try using jcc directly first. These commands should work even without lucene:

>>> import jcc
>>> jcc.initVM(jcc.CLASSPATH)
<jcc.JCCEnv object at 0x1004730d8>
>>> jcc._jcc.getVMEnv()
<jcc.JCCEnv object at 0x1004730f0>

And the module name is lucene, btw, not pylucene.

Coady
JCC works, lucene doesn't:Python 2.6.3 (r263:75184, Oct 2 2009, 07:56:03) [GCC 4.0.1 (Apple Inc. build 5493)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> import jcc>>> jcc.initVM(jcc.CLASSPATH)<jcc.JCCEnv object at 0x333080>>>> MacBookPro:~/tmp/trunk
jbastos
sorry about the formatting in the comment above.
jbastos
I forgot to list getVMEnv() >>> jcc._jcc.getVMEnv() <jcc.JCCEnv object at 0x333090>
jbastos
A: 

I reinstalled everything and now I get a different error:

sudo make
...
gcc-4.0 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -DPYTHON=1 -D_jcc_shared=1 -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers -Ibuild/_lucene -I/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/JCC-2.3-py2.6-macosx-10.3-fat.egg/jcc/sources -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c build/_lucene/lucene.cpp -o build/temp.macosx-10.3-i386-2.6/build/_lucene/lucene.o -fno-strict-aliasing -Wno-write-strings
c++ -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-i386-2.6/build/_lucene/__init__.o build/temp.macosx-10.3-i386-2.6/build/_lucene/__wrap01__.o build/temp.macosx-10.3-i386-2.6/build/_lucene/__wrap02__.o build/temp.macosx-10.3-i386-2.6/build/_lucene/__wrap03__.o build/temp.macosx-10.3-i386-2.6/build/_lucene/functions.o build/temp.macosx-10.3-i386-2.6/build/_lucene/JArray.o build/temp.macosx-10.3-i386-2.6/build/_lucene/JObject.o build/temp.macosx-10.3-i386-2.6/build/_lucene/lucene.o build/temp.macosx-10.3-i386-2.6/build/_lucene/types.o -L/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/JCC-2.3-py2.6-macosx-10.3-fat.egg -ljcc -o build/lib.macosx-10.3-i386-2.6/lucene/_lucene.so -framework JavaVM -Wl,-S -Wl,-rpath /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/JCC-2.3-py2.6-macosx-10.3-fat.egg
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: ld returned 1 exit status
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccgMHbaE.out (No such file or directory)
error: command 'c++' failed with exit status 1
make: *** [compile] Error 1
jbastos