README for Xapian/Visual C++ Tools ================================== 2007-10-29 Make files, some extra headers and associated tools for compiling Xapian on Win32 using the Microsoft Visual C++ compilers. This is particularly useful if you're using the Python for Windows binary distribution as this is also compiled with Visual C++; otherwise the only way to make the Python bindings work is to recompile Python with Cygwin (Xapian compiles happily with Cygwin as standard). The project was started by Ulrik Petersen, and continued by Charlie Hull of Lemur Consulting who is now maintaining it. If you have any feedback, bug reports or comments about these files, please DO NOT contact Ulrik, but please contact us at Lemur Consulting www.lemurconsulting.com What works? =========== - The Python & PHP bindings - The quartz binaries quartzcheck, quartzcompact, quartzdump - The xapian-compact binary - The Xapian example binaries - The libtest.lib and libbtreecheck libraries - The various tests that use the above, which are run as part of the makefile in tests/ - Omega, Omindex and Scriptindex (although these may have difficulty parsing Windows directory paths). What doesn't work? ================== - Any other bindings. - Warning: unlike Unix, windows does not usually allow open files to be deleted. This caused a serious problem with releases of Xapian on Windows before version 0.9.10, potentially leading to database corruption. This is believed to be fixed in version 0.9.10, but there remains a restriction that you must close databases before deleting the folder (and the files in the folder) containing the database. We do not expect this restriction to be lifted in future releases - equally, we do not expect it to cause serious problems. TODOS ===== Other bindings How do I get the released sources? ================================== You will need an archive tool which can uncompress .zip and .tgz archives. A free tool which is suitable for this purpose is available from http://www.7-zip.org/. 1. Download and unpack Xapian, the Xapian bindings and Omega to the same folder. You should have a structure like this (the top level folder doesn't have to be called 'xapian'): xapian\ xapian\xapian-core-0.x.y xapian\xapian-bindings-0.x.y xapian\omega-0.x.y where x and y are revision numbers. 2. Download win32.zip for the appropriate Xapian release from Lemur Consulting and place in xapian\xapian-core-0.x.y. 3. Extract the files to the win32/ folder (usually, right click on the ZIP file and select Extract Here). 4. IMPORTANT - Edit config.mak to make sure the various individual mak files end up in the right folders, and add the correct paths for any other binding languages. You may also need to edit the win32_applications_omega.mak and win32_bindings_python.mak files, and the .mak files for any other bindings. Note that all the .mak files in the win32/ folder are automatically copied to the correct places at the beginning of the build process, so edit them here rather than where they end up. How do I get the latest development sources? ============================================ The development sources are held in a revision control system called subversion, so you will first need a subversion client installed to build the latest development sources. Details of how to access the xapian repository are available at http://xapian.org/bleeding.php When you check out the xapian sources, you will have a slightly different structure than that derived from the release tarballs: xapian\xapian-core xapian\xapian-bindings xapian\xapian-applications xapian\xapian-maintainer-tools After checking out the sources, copy the contents of the "xapian\xapian-maintainer-tools\win32msvc" directory to a new directory named "xapian\xapian-core\win32". Run the build from this latter directory. You will then need to edit "xapian\xapian-core\win32\config.mak" as described in step 4 in the previous section ("How do I get the released sources?"). You will also need to build the makedepend.exe program as this is only included as a binary with the released sources. To do this, install the tools below and do the following (assuming the directory structure above): cd \xapian\xapian-maintainer-tools\win32msvc\makedepend nmake -f makedepend.mak copy makedepend.exe \xapian\xapian-core\win32 What do I need to compile it? ============================= You will need: - Windows 2000 or later (NT-based; 95/98/ME won't work) - Visual C++ 7.0 (.Net 2003/2005). In particular: - cl.exe - link.exe - lib.exe - nmake.exe OR... - You can also compile with Visual C++ Express Edition available free from: http://msdn.microsoft.com/vstudio/express/visualc/default.aspx In this case you'll also need the Platforms SDK: http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ which contains headers, libs and NMAKE. Make sure once you have installed this that you create LIB and INCLUDE environment variables to point to the appropriate Platform SDK folders, and that the path to the SDK's BIN folder is in your PATH. - Perl is used to pre-build some of the source files. Install a Win32 binary from ActiveState (http://www.activestate.com/Products/ActivePerl/) and modify config.mak appropriately (PERL_DIR) - You will also need the ZLIB library. Download and unzip the binary Windows package http://www.zlib.net/zlib123-dll.zip and make sure the path to where you downloaded it matches the path in config.mak (ZLIB_DIR). - SWIG can be useful for recompiling the bindings, but this is done by the Xapian core maintainers, so you shouldn't need to do this unless you are building from the development sources, in which case you'll have to use the version of SWIG in the Xapian repository. To build this follow the instructions at http://www.swig.org/Doc1.3/Windows.html#swig_exe (you'll need to install MinGW). - To compile the Python bindings you need Python from www.python.org. Make sure the paths to this are set correctly in config.mak. - To compile the PHP bindings you need: a. the PHP sources from www.php.net (we have used PHP 4.4.6 & 5.2.1). b. the built sources from a Windows binary distribution c. to edit config.mak to use the correct paths to PHP and to select the right version of PHP to build. How do I compile it? ==================== 1a) Run vcvars32.bat or equivalent for the C compiler. This may be listed as 'Command Prompt' in the Programs menu entry. This will set up the appropriate paths. --OR-- 1b) Make sure you have the appropriate paths set up for your Visual C++ compiler. To build the Xapian core: 2) cd to xapian-core-0.x.y\win32 or the appropriate path on your system. 3) edit config.mak to suit your environment 4) nmake CLEAN either: 5a) nmake CHECK - to build and run the test suite 5b) nmake - to just build. To build the bindings (do steps 1-5 above first to make sure you have Xapian built): 6) cd to xapian-core-0.x.y\win32 or the appropriate path on your system. 7) edit win32_bindings_python.mak or win32_bindings_php.mak to suit your environment (XAPIAN_CORE_REL_PYTHON or similar) 8) nmake COPYMAKFILES - to make sure this change is copied to the build folder 9) cd to ..\..\xapian-bindings-0.x.y\python or ..\..\xapian-bindings-0.x.y\php 10) nmake CLEAN 11a) nmake CHECK - to build and run the test suite 11b) nmake - to just build. To build Omega (do steps 1-5 above first to make sure you have Xapian built): 12) edit win32_applications_omega.mak to suit your environment (XAPIAN_CORE_REL_OMEGA) 13) nmake COPYMAKFILES - to make sure this change is copied to the build folder 14) cd to ..\..\omega-0.x.y 15) nmake - to build. The binaries end up in xapian-core-0.x.y\win32\Release or \Debug if you are building a Debug build (see below) NOTE: currently you will see various warnings of the form: ..\win32\makedepend.exe: warning: .\error.cc (reading C:/Program Files/Microsoft Visual Studio 8/VC/INCLUDE/sys/stat.h), line 23: #error ERROR: Only Win32 target supported! These are caused by the Makedepend program and can safely be ignored. Debug builds =========== To compile Debug builds, run the build process with the following switch: nmake DEBUG=1 This affects some lines in config.mak. It is also possible to manually create a project in the Visual C++ Express Edition IDE. Please send any bugfixes to Charlie Hull at Lemur Consulting: www.lemurconsulting.com