views:

385

answers:

3

Hi all, There is a problem when I used the pylibmc. When I "import pylibmc", then I'll get some error following:

ImportError: /usr/local/python2.6/lib/python2.6/site-packages/_pylibmc.so: undefined symbol: memcached_server_list.

My enviroment are Python 2.6.5, libmemcached 0.39, memcached 1.4.5

So, how can I solve it?

Thanks very much.

UPDATE 1: I read the pylibmc doc again, and found this: libmemcached 0.32 or later (last test with 0.38). Then I guest maybe my libmemcached is too newer to avaliable.

UPDATE 2: I test the libmemcached 0.38, there is another error in _pylibmc.so: Undefined symbol: memcached_server_count.

A: 

Sounds like linker issues. What system is this on? How is _pylibmc.so linked to libmemcached.so? Can you provide the commands run by your build phase, and perhaps the ldd output?

lericson
As @Andrew said below, the dynamic linker needs to be able to find libmemcached. I forgot how you add stuff permanently to the linker path in OS X, but for Linux add a line saying `/usr/local/lib` to `/etc/ld.so.conf` (or whatever your distro prefers)
lericson
A: 

I was having the same problem and I got it working by using libmemcached 0.34 and then setting the environment variable LD_LIBRARY_PATH to /usr/local/lib (where the libmemcache library was stored).

Andrew
+1  A: 

There appears to be some confusion about the symbol memcached_server_list: libmemcached 0.38 exposes it, but 0.39 does not. The symbol has even been removed from the documentation. pylibmc relies on memcached_server_list for its get_stats() method. I suspect pylibmc should be using memcached_server_cursor instead.

So I think we can say that pylibmc 1.0 requires libmemcached <= 0.38.

Shane Hathaway