aerospike-client-python icon indicating copy to clipboard operation
aerospike-client-python copied to clipboard

Linking error on Arch Linux: ImportError: undefined symbol: ev_io_start

Open 0xabe-io opened this issue 8 years ago • 2 comments

I am on a up-to-date Arch Linux install with python 3.6.3 and libev 4.24. I cloned the repositories and checked out the 2.2.3 tag. The build and installation went fine either when I build my own aerospike-client-c or I build the one provided in AUR, both with libev.

However when I launch python and import aerospike, I end up with an ImportError:

$ python
Python 3.6.3 (default, Oct 24 2017, 14:48:20) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aerospike
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /usr/lib/python3.6/site-packages/aerospike.cpython-36m-x86_64-linux-gnu.so: undefined symbol: ev_io_start

I can see that the shared object is not linked with libev:

$ ldd /usr/lib/python3.6/site-packages/aerospike.cpython-36m-x86_64-linux-gnu.so
	linux-vdso.so.1 (0x00007ffd9adbd000)
	libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007f5e669d0000)
	libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007f5e66553000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f5e66335000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f5e65fe9000)
	libz.so.1 => /usr/lib/libz.so.1 (0x00007f5e65dd2000)
	librt.so.1 => /usr/lib/librt.so.1 (0x00007f5e65bca000)
	libpython3.6m.so.1.0 => /usr/lib/libpython3.6m.so.1.0 (0x00007f5e6566d000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f5e652b5000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f5e66f42000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f5e650b1000)
	libutil.so.1 => /usr/lib/libutil.so.1 (0x00007f5e64eae000)

During the build, there is no -lev in the gcc command (there are the -lpthread, -lssl and so on). To fix that, I added ev in the libraries list in setup.py:

$ git diff setup.py
diff --git a/setup.py b/setup.py
index a750c74..345be59 100644
--- a/setup.py
+++ b/setup.py
@@ -175,7 +175,8 @@ libraries = [
   'crypto',
   'pthread',
   'm',
-  'z'
+  'z',
+  'ev',
   ]
 
 ################################################################################

After a rebuild all is fine:

$ ldd /usr/lib/python3.6/site-packages/aerospike.cpython-36m-x86_64-linux-gnu.so
[snip]
	libev.so.4 => /usr/lib/libev.so.4 (0x00007f6171d99000)
[snip]
$ python
Python 3.6.3 (default, Oct 24 2017, 14:48:20) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aerospike
>>>

I don't think it is a correct fix for everyone, as it is possible to build aerospike-client-c with libev, libevent or libuv.

0xabe-io avatar Nov 24 '17 12:11 0xabe-io

Apologies for the delayed response. The Aerospike Python client doesn't actually use any of the async features or event frameworks provided with the Async C client. So I would suggest building a C client without the optional event loop support, and using that as the basis for the Python Client.

I will add a note about that to our documentation for building the Python client with a pre-existing C client.

Thanks for bringing this to our attention.

aerospikerobertmarks avatar Nov 28 '17 01:11 aerospikerobertmarks

With pip (>=19.0) and latest python client (>=3.8.0), you should be able to install on linux without needing to clone the c client or install any other dependencies anymore.

marknaero avatar Sep 03 '19 20:09 marknaero