Re: AW: Building PyLucene on Windows
On May 3, 2012, at 14:35, Jeremy Michels wrote: > Thanks again for your help. I got the latest JCC and this seemed to > solve the problem, as Andi suggested. However, running 'make' then > gave me the error: > > Traceback (most recent call last): > File "C:\Program Files\Python\lib\runpy.py", line 162, in _run_module_as_main >"__main__", fname, loader, pkg_name) > File "C:\Program Files\Python\lib\runpy.py", line 72, in _run_code >exec code in run_globals > File "C:\Program > Files\Python\lib\site-packages\jcc-2.12-py2.7-win-amd64.egg\j > cc\__main__.py", line 104, in >cpp.jcc(sys.argv) > File "C:\Program > Files\Python\lib\site-packages\jcc-2.12-py2.7-win-amd64.egg\j > cc\cpp.py", line 644, in jcc >raise ValueError, (cls, 'python class name already in use, use --rename', > na > me, pythonNames[name]) > ValueError: (, > 'python > class name already in use, use --rename', u'GermanStemmer', org.t > artarus.snowball.ext.GermanStemmer>) > Makefile:312: recipe for target `compile' failed > make: *** [compile] Error 127 > > I couldn't figure out how to correctly add the rename argument in the > Makefile. > Eventually I got frustrated, and just edited out the line > (line 644) raising the exception in the cpp.py file, adding a 'pass' > statement instead. That's going to be causing random failures and crashes. You should instead use the latest PyLucene code in the branch_3x branch. This is turning into the 3.6 release shortly. Andi.. > Then the installation seemed to go ahead fine. > However, the wisdom of my workaround seemed questionable, at best. > What are your thoughts? What is the appropriate syntax for 'rename' ? > > Thanks again, > > Jeremy > > > On Thu, May 3, 2012 at 7:45 AM, Andi Vajda wrote: >> Hi Jeremy, >> >> On Apr 30, 2012, at 9:19, Jeremy Michels wrote: >> >>> Thank you for sharing your expertise on this matter. I was unable to >>> use the pre-built binaries as I am using a 64-bit system (attempting >>> to do so would results in the error: ImportError: DLL load failed: %1 >>> is not a valid Win32 application). >>> >>> This is my setup: >>> Windows 7 (64-bit) >>> Python 2.7.2 (64 bit) >>> Java 1.7 (jdk1.7.0) >>> Ant 1.8.3 >>> Windows SDK C/C++ compiler (v7.0) >>> Cygwin >>> >>> I was able to build JCC without any apparent problems. Below are my >>> Makefile settings: >>> >>> ANT=/cygdrive/c/Program\ Files/Ant/apache-ant-1.8.3/bin/ant >>> JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0 >>> PREFIX_PYTHON=/cygdrive/c/Program\ Files/Python >>> PYTHON=$(PREFIX_PYTHON)/python.exe >>> JCC=$(PYTHON) -m jcc --shared >>> NUM_FILES=4 >>> >>> Previously I had the "--find-jvm-dll" option included on the "JCC" >>> line, but this gave me the error "ValueError: jvm.dll could not be >>> found," so I removed the option and added the location of the jvm.dll >>> file to my path and I no longer received this error. >>> >>> However, running "make" with the specifications given above results in >>> the error: >>> >>> c:\users\jeremy\downloads\pylucene-3.5.0-3\build\_lucene\[F.h(1) : fatal >>> error C >> >> I've seen that error and it seems to be a bug in JCC related to using Java 7 >> and generics (which is fine). >> >> I fixed that bug a couple of weeks ago. You should get the latest sources >> from the branch_3_x jcc sources or wait for the PyLucene 3.6 release which >> should happen within a week. >> >> Andi.. >> >>> 1016: #if[n]def expected an identifier >>> error: command 'cl.exe' failed with exit status 2 >>> Makefile:312: recipe for target `compile' failed >>> make: *** [compile] Error 1 >>> >>> To be honest, I don't really know what this means and am feeling a bit >>> out of my league at this point. However, any further guidance you >>> might have would be appreciated. >>> >>> Best Regards, >>> >>> Jeremy
Re: AW: Building PyLucene on Windows
Thanks again for your help. I got the latest JCC and this seemed to solve the problem, as Andi suggested. However, running 'make' then gave me the error: Traceback (most recent call last): File "C:\Program Files\Python\lib\runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "C:\Program Files\Python\lib\runpy.py", line 72, in _run_code exec code in run_globals File "C:\Program Files\Python\lib\site-packages\jcc-2.12-py2.7-win-amd64.egg\j cc\__main__.py", line 104, in cpp.jcc(sys.argv) File "C:\Program Files\Python\lib\site-packages\jcc-2.12-py2.7-win-amd64.egg\j cc\cpp.py", line 644, in jcc raise ValueError, (cls, 'python class name already in use, use --rename', na me, pythonNames[name]) ValueError: (, 'python class name already in use, use --rename', u'GermanStemmer', ) Makefile:312: recipe for target `compile' failed make: *** [compile] Error 127 I couldn't figure out how to correctly add the rename argument in the Makefile. Eventually I got frustrated, and just edited out the line (line 644) raising the exception in the cpp.py file, adding a 'pass' statement instead. Then the installation seemed to go ahead fine. However, the wisdom of my workaround seemed questionable, at best. What are your thoughts? What is the appropriate syntax for 'rename' ? Thanks again, Jeremy On Thu, May 3, 2012 at 7:45 AM, Andi Vajda wrote: > Hi Jeremy, > > On Apr 30, 2012, at 9:19, Jeremy Michels wrote: > >> Thank you for sharing your expertise on this matter. I was unable to >> use the pre-built binaries as I am using a 64-bit system (attempting >> to do so would results in the error: ImportError: DLL load failed: %1 >> is not a valid Win32 application). >> >> This is my setup: >> Windows 7 (64-bit) >> Python 2.7.2 (64 bit) >> Java 1.7 (jdk1.7.0) >> Ant 1.8.3 >> Windows SDK C/C++ compiler (v7.0) >> Cygwin >> >> I was able to build JCC without any apparent problems. Below are my >> Makefile settings: >> >> ANT=/cygdrive/c/Program\ Files/Ant/apache-ant-1.8.3/bin/ant >> JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0 >> PREFIX_PYTHON=/cygdrive/c/Program\ Files/Python >> PYTHON=$(PREFIX_PYTHON)/python.exe >> JCC=$(PYTHON) -m jcc --shared >> NUM_FILES=4 >> >> Previously I had the "--find-jvm-dll" option included on the "JCC" >> line, but this gave me the error "ValueError: jvm.dll could not be >> found," so I removed the option and added the location of the jvm.dll >> file to my path and I no longer received this error. >> >> However, running "make" with the specifications given above results in >> the error: >> >> c:\users\jeremy\downloads\pylucene-3.5.0-3\build\_lucene\[F.h(1) : fatal >> error C > > I've seen that error and it seems to be a bug in JCC related to using Java 7 > and generics (which is fine). > > I fixed that bug a couple of weeks ago. You should get the latest sources > from the branch_3_x jcc sources or wait for the PyLucene 3.6 release which > should happen within a week. > > Andi.. > >> 1016: #if[n]def expected an identifier >> error: command 'cl.exe' failed with exit status 2 >> Makefile:312: recipe for target `compile' failed >> make: *** [compile] Error 1 >> >> To be honest, I don't really know what this means and am feeling a bit >> out of my league at this point. However, any further guidance you >> might have would be appreciated. >> >> Best Regards, >> >> Jeremy
Re: AW: Building PyLucene on Windows
Hi Jeremy, On Apr 30, 2012, at 9:19, Jeremy Michels wrote: > Thank you for sharing your expertise on this matter. I was unable to > use the pre-built binaries as I am using a 64-bit system (attempting > to do so would results in the error: ImportError: DLL load failed: %1 > is not a valid Win32 application). > > This is my setup: > Windows 7 (64-bit) > Python 2.7.2 (64 bit) > Java 1.7 (jdk1.7.0) > Ant 1.8.3 > Windows SDK C/C++ compiler (v7.0) > Cygwin > > I was able to build JCC without any apparent problems. Below are my > Makefile settings: > > ANT=/cygdrive/c/Program\ Files/Ant/apache-ant-1.8.3/bin/ant > JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0 > PREFIX_PYTHON=/cygdrive/c/Program\ Files/Python > PYTHON=$(PREFIX_PYTHON)/python.exe > JCC=$(PYTHON) -m jcc --shared > NUM_FILES=4 > > Previously I had the "--find-jvm-dll" option included on the "JCC" > line, but this gave me the error "ValueError: jvm.dll could not be > found," so I removed the option and added the location of the jvm.dll > file to my path and I no longer received this error. > > However, running "make" with the specifications given above results in > the error: > > c:\users\jeremy\downloads\pylucene-3.5.0-3\build\_lucene\[F.h(1) : fatal > error C I've seen that error and it seems to be a bug in JCC related to using Java 7 and generics (which is fine). I fixed that bug a couple of weeks ago. You should get the latest sources from the branch_3_x jcc sources or wait for the PyLucene 3.6 release which should happen within a week. Andi.. > 1016: #if[n]def expected an identifier > error: command 'cl.exe' failed with exit status 2 > Makefile:312: recipe for target `compile' failed > make: *** [compile] Error 1 > > To be honest, I don't really know what this means and am feeling a bit > out of my league at this point. However, any further guidance you > might have would be appreciated. > > Best Regards, > > Jeremy
Re: AW: Building PyLucene on Windows
Tom - Thank you for sharing your expertise on this matter. I was unable to use the pre-built binaries as I am using a 64-bit system (attempting to do so would results in the error: ImportError: DLL load failed: %1 is not a valid Win32 application). This is my setup: Windows 7 (64-bit) Python 2.7.2 (64 bit) Java 1.7 (jdk1.7.0) Ant 1.8.3 Windows SDK C/C++ compiler (v7.0) Cygwin I was able to build JCC without any apparent problems. Below are my Makefile settings: ANT=/cygdrive/c/Program\ Files/Ant/apache-ant-1.8.3/bin/ant JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0 PREFIX_PYTHON=/cygdrive/c/Program\ Files/Python PYTHON=$(PREFIX_PYTHON)/python.exe JCC=$(PYTHON) -m jcc --shared NUM_FILES=4 Previously I had the "--find-jvm-dll" option included on the "JCC" line, but this gave me the error "ValueError: jvm.dll could not be found," so I removed the option and added the location of the jvm.dll file to my path and I no longer received this error. However, running "make" with the specifications given above results in the error: c:\users\jeremy\downloads\pylucene-3.5.0-3\build\_lucene\[F.h(1) : fatal error C 1016: #if[n]def expected an identifier error: command 'cl.exe' failed with exit status 2 Makefile:312: recipe for target `compile' failed make: *** [compile] Error 1 To be honest, I don't really know what this means and am feeling a bit out of my league at this point. However, any further guidance you might have would be appreciated. Best Regards, Jeremy
AW: Building PyLucene on Windows
Jeremy, (and Chris) note that there are some pre-built binaries of PyLucene/JCC available for Windows and other platforms in the pylucene extras project: http://code.google.com/a/apache-extras.org/p/pylucene-extra/ Anyway, I can shortly describe my setup for the build process : I am currently using - pylucene-3.x with Python 2.6 and Pyrthon 2.7 on windows (win7-32) with the following tools: - Java 1.6 (jdk1.6.0_06) - Ant 1.8.0 - MS-Visual-Studio9 compiler (Microsoft Visual C++ 2008 Express Edition) - Cygwin (for make basically) I also tried a different toolchain with MinGW and GNU Make on windows once, but had some problems so I'm currently happy with the above setup. Here are the instructions for the step-by-step build process: I. download the sources II. build JCC 0. make sure to set JAVAHOME (or edit jcc/setup.py ...) e.g. JAVA_HOME=C:\Program Files\Java\jdk1.6.0_06 1. cd jcc 2. python setup.py build 3. python setup.py install III. build PyLucene 0. make sure you have Python, Java and Ant installed (I also use cygwin for make process) 1. edit the Makefile and adapt to your configuration/environment - there are some pre-set sample configs you may choose (i.e. uncomment) - you may need to change path details and version numbers ... e.g. (my env) # Windows (Win32, Python 2.7, Java 1.6, ant 1.8.0 - all 32-Bit!) ANT=/cygdrive/f/devel/apache-ant-1.8.0/bin/ant JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_06 PREFIX_PYTHON=/cygdrive/c/Python27 PYTHON=$(PREFIX_PYTHON)/python.exe JCC=$(PYTHON) -m jcc --shared --find-jvm-dll NUM_FILES=4 2. (in cygwin) run make i.e. make make install make test Hope that helps! kind regards Thomas -- OrbiTeam Software GmbH & Co. KG, Germany http://www.orbiteam.de > -Ursprüngliche Nachricht- > Von: Jeremy Michels [mailto:jeremy.d.mich...@gmail.com] > Gesendet: Samstag, 28. April 2012 20:14 > An: pylucene-dev@lucene.apache.org > Betreff: Building PyLucene on Windows > > Would you be willing to share your makefile? I am having quite a bit of > trouble with this as well.
Re: Building PyLucene on Windows
Andi Vajda wrote: > The patch to setuptools is for Linux only unless I'm mistaken. Yes, you'll see if you look at that script that I don't apply any patches to setuptools before I install it. I do have to apply a patch to jcc's setup.py to generate the appropriate .lib file, though. http://uplib.parc.com/hg/uplib/file/2013b08512fa/patches/jcc-2.9-mingw-PATCH Not sure if that's still necessary. Bill
Re: Building PyLucene on Windows
On Apr 28, 2012, at 16:35, Bill Janssen wrote: > Jeremy Michels wrote: > >> Would you be willing to share your makefile? I am having quite a bit >> of trouble with this as well. > > I build PyLucene on Windows regularly. I use mingw to compile and link. > My build script is at > http://uplib.parc.com/hg/uplib/file/2013b08512fa/win32/build-windows-prereqs.sh; > look for "-- jcc --". Note that you must have an appropriately patched > setuptools installed, first. The patch to setuptools is for Linux only unless I'm mistaken. Andi.. > > Rather than editing the Makefile for PyLucene, I just override the > appropriate make variables in the build environment. > > Bill
Re: Building PyLucene on Windows
Jeremy Michels wrote: > Would you be willing to share your makefile? I am having quite a bit > of trouble with this as well. I build PyLucene on Windows regularly. I use mingw to compile and link. My build script is at http://uplib.parc.com/hg/uplib/file/2013b08512fa/win32/build-windows-prereqs.sh; look for "-- jcc --". Note that you must have an appropriately patched setuptools installed, first. Rather than editing the Makefile for PyLucene, I just override the appropriate make variables in the build environment. Bill
Building PyLucene on Windows
Would you be willing to share your makefile? I am having quite a bit of trouble with this as well.
Re: Building PyLucene on Windows
On Mar 9, 2010, at 20:18, Roman Chyla wrote: Hi, I would also like to thank to Andi (and others?) for the great tool and the samples, it is really excellent. I am using MSVC7.1 on win xp, it builds fine, but it was quite difficult at the beginning (especially, because I tried with mingw before falling back to msvc). And indeed, is gnu make indispensable? Yes, unless someone writes something else for windows. In some previous posts it was said that Ant is not an option (makes Python programmers scream and run away) and 'make' is there because nobody provided something else. Right. This naturally brings us to the practical problem: it can be done, but somebody has to DO IT, right? ;-) Exactly. What would you think about scons? http://www.scons.org/ I'm not near my computer this week so I can't take a look at this now but, in principle, if a windows user came forward with a better build solution for windows (or better yet, in general) and is prepared to maintain it, that would be a big plus. Andi.. roman On Tue, Mar 9, 2010 at 3:50 PM, Andi Vajda wrote: On Mar 9, 2010, at 13:13, "Thomas Koch" wrote: Dear PyLucene-fans, I just managed to build pylucene-2.9.1-1 on Windows with Python 2.6 and Java 1.6 and like to tell my 'story' - just in case anyone else runs into similar problems... First I should mention that I'm using PyLucene for quite a while now - just never needed to build it on windows - there used to be binary distributions on the net (here: http://code.google.com/p/pylucene-win32-binary/ - however it's out-of-date). Also I am a bit familiar with Makefiles, Ant and other toolchains... Next it should be said that not only PyLucene is great piece of software but also Documentation (and samples / test-suite) is very well maintained. The only thing that's missing from my point of view is clear advise on requirements for building PyLucene on specific platforms. Maybe that's also the cause of the trouble I had in building it ... I knew I need a C ++ compiler, ANT, Java and Python. Also as Makefile is used some kind of make-utitilty would be needed. So here's the setup I've choosen: - Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) - Java 1.6 (jdk1.6.0_06) - compiler: MS-Visual-Studio9 (Microsoft Visual C++ 2008 Express Edition) - mingw32-make from MinGW-5.1.6 - see http://www.mingw.org/ (GNU Make 3.81 built for i386-pc-mingw32) - ANT 1.8.0 - pylucene-2.9.1-1 / lucene-java-2.9.1 - Windows7 The building of JCC was no problem. The first issues came up when entering the make-toolchain: apparently there are some differences on Windows that either my windows binary GNU make couldn't handle very well or need to be fixed for windows anyway... This especially holds for path separators and command separators. For example I had to change $(LUCENE_JAR): $(LUCENE) cd $(LUCENE) ; $(ANT) -Dversion=$(LUCENE_VER) to $(LUCENE_JAR): $(LUCENE) cd $(LUCENE) && $(ANT) -Dversion=$(LUCENE_VER) (took me a while to figure this out ,-) PYLUCENE:=$(shell pwd) to PYLUCENE:=$(shell cd) BUILD_TEST:=$(PYLUCENE)/build/test to BUILD_TEST:=$(PYLUCENE)\build\test (note: cd may work with "/" but when it comes to mkdir this fails - e.h. mingw32-make test mkdir -p pylucene-2.9.1-1/build/test Syntaxfehler. mingw32-make: *** [install-test] Error 1 ) Finally herer are my Makefile settings: # Windows (Win32, Python 2.6, Java 1.6, ant 1.8) SHELL=cmd.exe PYLUCENE:=$(shell cd) ANT=F:\devel\apache-ant-1.8.0\bin\ant JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_06 PREFIX_PYTHON=C:\\Python26 PYTHON=$(PREFIX_PYTHON)\python.exe JCC=$(PYTHON) -m jcc.__main__ NUM_FILES=3 So either I've choosen the wrong tools or there should be others with similar problems. If my toolchain is wrong or unsupported please advise. Is it recommended/required to use Cygwin on Windows? Yes, cygwin is required so that you have a functional gnu make. Note that you still need to use a MS compiler or mingw, which some people have been able to use. I test build pylucene every now and then on an old win2k system with cygwin (for make and shell) and msvc 7.1. Not a setup with the most recent software but that's all I've got for windows. Andi.. If anyone is interested I can offer to - post my adapted Makefile here (or on the web) - provide binary version of PyLucene (on the web) Finally some suggestion: wouldn't it be possible to skip the Makefile completely? I'm not that familiar with ANT but know it has been developed to provide platform independant built processes - and it includes shell-tasks for anything that is not java... (I know this could be some work, just wanted to know if this question has been raised before or if this is a no-go option ?) best regards Thomas Koch -- OrbiTeam Software GmbH & Co. KG Endenicher Allee 35 53121 Bonn Germany i...@orbiteam.de http://www.orbiteam.de
Re: Building PyLucene on Windows
Hi, I would also like to thank to Andi (and others?) for the great tool and the samples, it is really excellent. I am using MSVC7.1 on win xp, it builds fine, but it was quite difficult at the beginning (especially, because I tried with mingw before falling back to msvc). And indeed, is gnu make indispensable? In some previous posts it was said that Ant is not an option (makes Python programmers scream and run away) and 'make' is there because nobody provided something else. This naturally brings us to the practical problem: it can be done, but somebody has to DO IT, right? ;-) What would you think about scons? http://www.scons.org/ roman On Tue, Mar 9, 2010 at 3:50 PM, Andi Vajda wrote: > > On Mar 9, 2010, at 13:13, "Thomas Koch" wrote: > >> Dear PyLucene-fans, >> >> I just managed to build pylucene-2.9.1-1 on Windows with Python 2.6 and >> Java >> 1.6 and like to tell my 'story' - just in case anyone else runs into >> similar >> problems... >> >> First I should mention that I'm using PyLucene for quite a while now - >> just >> never needed to build it on windows - there used to be binary >> distributions >> on the net (here: http://code.google.com/p/pylucene-win32-binary/ - >> however >> it's out-of-date). Also I am a bit familiar with Makefiles, Ant and other >> toolchains... >> >> Next it should be said that not only PyLucene is great piece of software >> but >> also Documentation (and samples / test-suite) is very well maintained. >> >> The only thing that's missing from my point of view is clear advise on >> requirements for building PyLucene on specific platforms. Maybe that's >> also >> the cause of the trouble I had in building it ... I knew I need a C++ >> compiler, ANT, Java and Python. Also as Makefile is used some kind of >> make-utitilty would be needed. So here's the setup I've choosen: >> >> - Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) >> - Java 1.6 (jdk1.6.0_06) >> - compiler: MS-Visual-Studio9 (Microsoft Visual C++ 2008 Express Edition) >> - mingw32-make from MinGW-5.1.6 - see http://www.mingw.org/ >> (GNU Make 3.81 built for i386-pc-mingw32) >> - ANT 1.8.0 >> - pylucene-2.9.1-1 / lucene-java-2.9.1 >> - Windows7 >> >> The building of JCC was no problem. The first issues came up when entering >> the make-toolchain: apparently there are some differences on Windows that >> either my windows binary GNU make couldn't handle very well or need to be >> fixed for windows anyway... >> >> This especially holds for path separators and command separators. For >> example I had to change >> >> >> $(LUCENE_JAR): $(LUCENE) >> cd $(LUCENE) ; $(ANT) -Dversion=$(LUCENE_VER) >> to >> $(LUCENE_JAR): $(LUCENE) >> cd $(LUCENE) && $(ANT) -Dversion=$(LUCENE_VER) >> >> (took me a while to figure this out ,-) >> >> PYLUCENE:=$(shell pwd) >> to >> PYLUCENE:=$(shell cd) >> >> BUILD_TEST:=$(PYLUCENE)/build/test >> to >> BUILD_TEST:=$(PYLUCENE)\build\test >> >> (note: cd may work with "/" but when it comes to mkdir this fails - e.h. >> mingw32-make test >> mkdir -p pylucene-2.9.1-1/build/test >> Syntaxfehler. >> mingw32-make: *** [install-test] Error 1 >> ) >> >> >> Finally herer are my Makefile settings: >> >> # Windows (Win32, Python 2.6, Java 1.6, ant 1.8) >> SHELL=cmd.exe >> PYLUCENE:=$(shell cd) >> ANT=F:\devel\apache-ant-1.8.0\bin\ant >> JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_06 >> PREFIX_PYTHON=C:\\Python26 >> PYTHON=$(PREFIX_PYTHON)\python.exe >> JCC=$(PYTHON) -m jcc.__main__ >> NUM_FILES=3 >> >> >> So either I've choosen the wrong tools or there should be others with >> similar problems. If my toolchain is wrong or unsupported please advise. >> Is >> it recommended/required to use Cygwin on Windows? > > Yes, cygwin is required so that you have a functional gnu make. > Note that you still need to use a MS compiler or mingw, which some people > have been able to use. > > I test build pylucene every now and then on an old win2k system with cygwin > (for make and shell) and msvc 7.1. Not a setup with the most recent software > but that's all I've got for windows. > > Andi.. > >> >> If anyone is interested I can offer to >> - post my adapted Makefile here (or on the web) >> - provide binary version of PyLucene (on the web) >> >> Finally some suggestion: wouldn't it be possible to skip the Makefile >> completely? I'm not that familiar with ANT but know it has been developed >> to >> provide platform independant built processes - and it includes shell-tasks >> for anything that is not java... (I know this could be some work, just >> wanted to know if this question has been raised before or if this is a >> no-go >> option ?) >> >> best regards >> >> Thomas Koch >> -- >> OrbiTeam Software GmbH & Co. KG >> Endenicher Allee 35 >> 53121 Bonn Germany >> i...@orbiteam.de >> http://www.orbiteam.de >> >> >> >
Building PyLucene on Windows
Dear PyLucene-fans, I just managed to build pylucene-2.9.1-1 on Windows with Python 2.6 and Java 1.6 and like to tell my 'story' - just in case anyone else runs into similar problems... First I should mention that I'm using PyLucene for quite a while now - just never needed to build it on windows - there used to be binary distributions on the net (here: http://code.google.com/p/pylucene-win32-binary/ - however it's out-of-date). Also I am a bit familiar with Makefiles, Ant and other toolchains... Next it should be said that not only PyLucene is great piece of software but also Documentation (and samples / test-suite) is very well maintained. The only thing that's missing from my point of view is clear advise on requirements for building PyLucene on specific platforms. Maybe that's also the cause of the trouble I had in building it ... I knew I need a C++ compiler, ANT, Java and Python. Also as Makefile is used some kind of make-utitilty would be needed. So here's the setup I've choosen: - Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) - Java 1.6 (jdk1.6.0_06) - compiler: MS-Visual-Studio9 (Microsoft Visual C++ 2008 Express Edition) - mingw32-make from MinGW-5.1.6 - see http://www.mingw.org/ (GNU Make 3.81 built for i386-pc-mingw32) - ANT 1.8.0 - pylucene-2.9.1-1 / lucene-java-2.9.1 - Windows7 The building of JCC was no problem. The first issues came up when entering the make-toolchain: apparently there are some differences on Windows that either my windows binary GNU make couldn't handle very well or need to be fixed for windows anyway... This especially holds for path separators and command separators. For example I had to change $(LUCENE_JAR): $(LUCENE) cd $(LUCENE) ; $(ANT) -Dversion=$(LUCENE_VER) to $(LUCENE_JAR): $(LUCENE) cd $(LUCENE) && $(ANT) -Dversion=$(LUCENE_VER) (took me a while to figure this out ,-) PYLUCENE:=$(shell pwd) to PYLUCENE:=$(shell cd) BUILD_TEST:=$(PYLUCENE)/build/test to BUILD_TEST:=$(PYLUCENE)\build\test (note: cd may work with "/" but when it comes to mkdir this fails - e.h. mingw32-make test mkdir -p pylucene-2.9.1-1/build/test Syntaxfehler. mingw32-make: *** [install-test] Error 1 ) Finally herer are my Makefile settings: # Windows (Win32, Python 2.6, Java 1.6, ant 1.8) SHELL=cmd.exe PYLUCENE:=$(shell cd) ANT=F:\devel\apache-ant-1.8.0\bin\ant JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_06 PREFIX_PYTHON=C:\\Python26 PYTHON=$(PREFIX_PYTHON)\python.exe JCC=$(PYTHON) -m jcc.__main__ NUM_FILES=3 So either I've choosen the wrong tools or there should be others with similar problems. If my toolchain is wrong or unsupported please advise. Is it recommended/required to use Cygwin on Windows? If anyone is interested I can offer to - post my adapted Makefile here (or on the web) - provide binary version of PyLucene (on the web) Finally some suggestion: wouldn't it be possible to skip the Makefile completely? I'm not that familiar with ANT but know it has been developed to provide platform independant built processes - and it includes shell-tasks for anything that is not java... (I know this could be some work, just wanted to know if this question has been raised before or if this is a no-go option ?) best regards Thomas Koch -- OrbiTeam Software GmbH & Co. KG Endenicher Allee 35 53121 Bonn Germany i...@orbiteam.de http://www.orbiteam.de
Re: Building PyLucene on Windows
On Mar 9, 2010, at 13:13, "Thomas Koch" wrote: Dear PyLucene-fans, I just managed to build pylucene-2.9.1-1 on Windows with Python 2.6 and Java 1.6 and like to tell my 'story' - just in case anyone else runs into similar problems... First I should mention that I'm using PyLucene for quite a while now - just never needed to build it on windows - there used to be binary distributions on the net (here: http://code.google.com/p/pylucene-win32-binary/ - however it's out-of-date). Also I am a bit familiar with Makefiles, Ant and other toolchains... Next it should be said that not only PyLucene is great piece of software but also Documentation (and samples / test-suite) is very well maintained. The only thing that's missing from my point of view is clear advise on requirements for building PyLucene on specific platforms. Maybe that's also the cause of the trouble I had in building it ... I knew I need a C++ compiler, ANT, Java and Python. Also as Makefile is used some kind of make-utitilty would be needed. So here's the setup I've choosen: - Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) - Java 1.6 (jdk1.6.0_06) - compiler: MS-Visual-Studio9 (Microsoft Visual C++ 2008 Express Edition) - mingw32-make from MinGW-5.1.6 - see http://www.mingw.org/ (GNU Make 3.81 built for i386-pc-mingw32) - ANT 1.8.0 - pylucene-2.9.1-1 / lucene-java-2.9.1 - Windows7 The building of JCC was no problem. The first issues came up when entering the make-toolchain: apparently there are some differences on Windows that either my windows binary GNU make couldn't handle very well or need to be fixed for windows anyway... This especially holds for path separators and command separators. For example I had to change $(LUCENE_JAR): $(LUCENE) cd $(LUCENE) ; $(ANT) -Dversion=$(LUCENE_VER) to $(LUCENE_JAR): $(LUCENE) cd $(LUCENE) && $(ANT) -Dversion=$(LUCENE_VER) (took me a while to figure this out ,-) PYLUCENE:=$(shell pwd) to PYLUCENE:=$(shell cd) BUILD_TEST:=$(PYLUCENE)/build/test to BUILD_TEST:=$(PYLUCENE)\build\test (note: cd may work with "/" but when it comes to mkdir this fails - e.h. mingw32-make test mkdir -p pylucene-2.9.1-1/build/test Syntaxfehler. mingw32-make: *** [install-test] Error 1 ) Finally herer are my Makefile settings: # Windows (Win32, Python 2.6, Java 1.6, ant 1.8) SHELL=cmd.exe PYLUCENE:=$(shell cd) ANT=F:\devel\apache-ant-1.8.0\bin\ant JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_06 PREFIX_PYTHON=C:\\Python26 PYTHON=$(PREFIX_PYTHON)\python.exe JCC=$(PYTHON) -m jcc.__main__ NUM_FILES=3 So either I've choosen the wrong tools or there should be others with similar problems. If my toolchain is wrong or unsupported please advise. Is it recommended/required to use Cygwin on Windows? Yes, cygwin is required so that you have a functional gnu make. Note that you still need to use a MS compiler or mingw, which some people have been able to use. I test build pylucene every now and then on an old win2k system with cygwin (for make and shell) and msvc 7.1. Not a setup with the most recent software but that's all I've got for windows. Andi.. If anyone is interested I can offer to - post my adapted Makefile here (or on the web) - provide binary version of PyLucene (on the web) Finally some suggestion: wouldn't it be possible to skip the Makefile completely? I'm not that familiar with ANT but know it has been developed to provide platform independant built processes - and it includes shell- tasks for anything that is not java... (I know this could be some work, just wanted to know if this question has been raised before or if this is a no-go option ?) best regards Thomas Koch -- OrbiTeam Software GmbH & Co. KG Endenicher Allee 35 53121 Bonn Germany i...@orbiteam.de http://www.orbiteam.de