[pylucene-dev] Building on OS X
Terry Jones
terry at jon.es
Fri Oct 6 16:07:52 PDT 2006
Hi Andi.
I've tried again to make PyLucene on intel OS X 10.4.7. Here's what I did:
1. Download sources for gcc-4.0.2
2. Patch these with http://gcc.gnu.org/ml/java/2006-05/msg00151.html
3. Build and install gcc-4.0.2
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
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
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:
5. rm -fr /usr/local/BerkeleyDB4.4
6. Reconfigure DB:
../dist/configure CC=/usr/local/gcc-4.0.2/bin/gcc \
CXX=/usr/local/gcc-4.0.2/bin/g++ \
{CXX,}CPP=/usr/local/gcc-4.0.2/bin/cpp
and install the result.
7. Remove & re-checkout PyLucene svn trunk
8. Uncomment gcc-4.0.2 block in the PyLucene Makefile
9. make all
And I wind up with the same /usr/local/BerkeleyDB.4.4/include/db.h error as
above.
u_int is defined in /usr/include/sys/types.h, but it's wrapped:
#ifndef _POSIX_C_SOURCE
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
#ifndef _U_LONG
typedef unsigned long u_long;
#define _U_LONG
#endif
typedef unsigned short ushort; /* Sys V compatibility */
typedef unsigned int uint; /* Sys V compatibility */
#endif
So somehow by the time db.h comes to include <sys/types.h>, _POSIX_C_SOURCE
is defined and those typedefs don't happen.
If you have any hints, I'm happy to dig more. Else I guess I'll take the
easier route - install PyLucene from binaries and back off on my other
stuff to use DB 4.3.29 (which I think you're saying I can do, despite this
"If you downloaded a pre-compiled PyLucene-db- binary, that version is
Berkeley DB 4.3.28." in the README of the PyLucene binary tarball). I.e.,
I'll install 4.3.29 and reinstall python bsddb (which may hurt, for reasons
I'll omit here).
Thanks again,
Terry
More information about the pylucene-dev
mailing list