Question

I ought to use 32-bit Python in 32-bit mode (due to oracle instantclient-10.2.0.4, which segfaults in 64bit in Mac OS X, but works in 32bit). Everything was fine so far, till I got zookeeper. Actually, ZooKeeper Python bindings (zkpython).

I tried to make zkpython to be 32bit, whilst keeping the client itself 64-bit as it is by default. But in this case I get and error when importing:

Python 2.6.7 (r267:88850, Jul 31 2011, 19:30:54) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
>>> import zookeeper
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(./zookeeper.so, 2): Symbol not found: _ZOO_ASSOCIATING_STATE
  Referenced from: /Users/nolar/Downloads/zoo/zookeeper.so
  Expected in: flat namespace
 in /Users/nolar/Downloads/zoo/zookeeper.so

Same for Python 2.7 (both 2.6 and 2.7 are 32-bit here, and sys.maxint==2147483647). And I guess it wants 32-bit zookeeper client here, since when compiling zkpython it says only one single meaningful warning:

ld: warning: ignoring file ../../..//src/c/.libs//libzookeeper_mt.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

So, I tried to make zookeeper client itself to be 32bit. But whatever I tried, I cannot build it in 32bit mode: libzookeeper_mt.2.dylib is always 64-bit (I tried ARCH_FLAGS="-arch i386", configure --build=i386 --host=i386, arch -i386 …, etc — the .dylib is always 64bit).

$ file libzookeeper_mt.2.dylib 
libzookeeper_mt.2.dylib: Mach-O 64-bit dynamically linked shared library x86_64

And the worst point here is that is has no i386 arch built in, so I cannot extract this i386 version with "lipo".

So, the primary question is: how to make ZooKeeper python bindings to work with 32-bit Python in 64-bit Mac OS X Lion (10.7)?

The secondary question is: How to build ZooKeeper in 32bit mode in 64bit Mac OS X Lion 10.7?

Was it helpful?

Solution

I've fixed that myself. Here is the solution: http://blog.nolar.info/building-32-bit-zookeeper-python-bindings-in-64-bit-mac-os-x/ (in a nutshell, hack your Makefile to add "-arch i386" to CC definition there).

OTHER TIPS

Pass CFLAGS to the configure script:

export CFLAGS="-pipe -O2 -arch i386"
./configure …
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top