[pylucene-dev] Building on OS X

Andi Vajda vajda at osafoundation.org
Fri Oct 6 16:40:42 PDT 2006


On Sat, 7 Oct 2006, Terry Jones wrote:

>  4. Try to build PyLucene with the following Makefile block
>
>     # Mac OS X (Darwin with gcj 4.0.2 and libgcj dynamically linked)
>     PREFIX=/usr/local
>     PREFIX_FRAMEWORKS=/Library/Frameworks
>     PREFIX_PYTHON=$(PREFIX_FRAMEWORKS)/Python.framework/Versions/$(PYTHON_VER)
>     GCJ_HOME=/usr/local/gcc-4.0.2
>     GCJ_LIBDIR=$(GCJ_HOME)/lib
>     GCJ_STATIC=0
>     LIB_INSTALL=libgcj.6.dylib libstdc++.6.dylib libgcc_s.1.0.dylib
>     DB=$(PYLUCENE)/db-$(DB_VER)
>     PREFIX_DB=/usr/local/BerkeleyDB.$(DB_LIB_VER)
>     ANT=ant
>     PYTHON=$(PREFIX_PYTHON)/bin/python

The block above implies that you have the DB sources installed in the PyLucene 
directory, which is my setup but not necessarily yours...

> I still get this error:
>
>    /usr/local/gcc-4.0.2/bin/g++ -c -o release/lucene.o -O2  -DPYLUCENE_VER="\"2.0.0-2\"" -DLUCENE_VER="\"2.0.0-434148\"" -D_WITH_DB_DIRECTORY=1 -DDB_LIB_VER="\"4.4\"" -DDB_VER=44 -I/usr/local/BerkeleyDB.4.4/include -I/Users/terry/s/svn/PyLucene/trunk/db-4.4.20 -I/Users/terry/s/svn/PyLucene/trunk/db-4.4.20/build_unix -Ilucene-java-2.0.0-434148/build/classes/java -Ilucene-java-2.0.0-434148/build/contrib/highlighter/classes/java -Ilucene-java-2.0.0-434148/build/contrib/snowball/classes/java -Ilucene-java-2.0.0-434148/build/contrib/analyzers/classes/java -Ilucene-java-2.0.0-434148/build/contrib/regex/classes/java -Irelease/classes -Ilucene-java-2.0.0-434148/build/contrib/db/bdb/classes/java -I/Library/Frameworks/Python.framework/Versions/2.4/Headers -I/usr/local/gcc-4.0.2/include lucene.cpp
>    /usr/local/BerkeleyDB.4.4/include/db.h:1376: error: 'u_int' does not name a type
>    /usr/local/BerkeleyDB.4.4/include/db.h:1742: error: 'u_int' does not name a type
>    /usr/local/BerkeleyDB.4.4/include/db.h:1930: error: 'u_int' does not name a type
>    /usr/local/BerkeleyDB.4.4/include/db.h:1931: error: 'u_int' does not name a type
>    /usr/local/BerkeleyDB.4.4/include/db.h:1951: error: 'u_int' does not name a type
>    /usr/local/BerkeleyDB.4.4/include/db.h:2016: error: 'u_int' does not name a type
>    /usr/local/BerkeleyDB.4.4/include/db.h:2063: error: ISO C++ forbids declaration of 'u_long' with no type
>    /usr/local/BerkeleyDB.4.4/include/db.h:2063: error: expected ';' before '*' token
>    /usr/local/BerkeleyDB.4.4/include/db.h:2399: error: expected primary-expression before 'int'
>    make: *** [release/lucene.o] Error 1

I don't get this error and I build with Berkeley DB.

The problem may stem from the fact that you didn't install the Berkeley DB 
sources in the right place (that is the place named by the DB var in the block 
above) and that the PyLucene build then doesn't find the proper db.h file. If 
you look in PyLucene's Makefile, it adds -I$(DB) and -I$(DB)/build_unix to the 
include path to find the include files produced by Berkeley DB's config. This 
is to build (and patch) the libjava JNI part of Berkeley DB which needs to be 
built against the gcj header files (incompatible with the Java header files in 
their JNI interface).

> To try to make sure there's no problem with the DB header files, I then
> rebuild DB 4.4.20 with gcc-4.0.2:

Which version of gcc you use to build Berkeley DB shouldn't matter.

Andi..



More information about the pylucene-dev mailing list