twmht / python-rocksdb

Python bindings for RocksDB
BSD 3-Clause "New" or "Revised" License
276 stars 90 forks source link

Compiling issues #17

Closed welchr closed 6 years ago

welchr commented 7 years ago

I ran into a few hiccups while trying to install and had a few questions/comments -

  1. It only seems to work when compiling rocksdb using the cmake + make approach (as per your instructions.) If I try make shared_lib as the rocksdb INSTALL file suggests, and make that my lib directory, it doesn't work. Any idea what the difference is between the two methods of compiling?

  2. I ended up setting the path to the rocksdb.so by including CFLAGS="-Wl,-rpath,$ROCKSDB_LIB" before pip installing python-rocksdb. That will add the path to the rocksdb lib into the RPATH of your shared library. Then you don't need to constantly set LD_LIBRARY_PATH. Even better would be a way to statically include the rocksdb.a file but I didn't have luck there.

  3. It seems if I compile with gcc 4.9 it will fail with undefined symbol errors, such as undefined symbol: _ZTIN7rocksdb10ComparatorE. When I upgraded my gcc (via linuxbrew) to gcc 5.4 I was able to get rid of those types of errors. Maybe something changed with name mangling from 4 to 5 but I really don't know.

Wish I could help further. If it turns out gcc 5+ is truly needed, would be a good idea to add that to the docs.

Thanks for your work in supporting this package!

jucor commented 7 years ago

Dear @twmht,

Thanks for maintaining python-rocksdb. I have the same questions as welchr, in particular his point 1: do you know what is the difference between the cmake + make and the make shared_libs approach?

I fail to get make install-shared work with the cmake + make approach, to get the library installed system-wide, which is why I am trying to figure out the above.

twmht commented 7 years ago

it looks like that using different versions of gcc when compiling both rocksdb and python-rocksdb may cause this issue.

thanks @welchr , this is very helpful since I am trying to fix the compiling issue.

fozzold commented 6 years ago

I met the same issue "_ZTIN7rocksdb10ComparatorE" with up-to-date rocksdb(make shared_lib). Finally fix the error by specify extra_compile_args '-fno-rtti' in setup.py. Hope it works on your env.

gcp commented 6 years ago

I think the cause is that rocksdb by default builds with -fno-rtti in release mode (but not in debug mode). This can be changed by setting USE_RTTI=1 when doing the "make" in rocksdb.

Probably, this settings change isn't done in the CMake version of rocksdb's build system, which is why that works as a a workaround too. People who just run "make", have built rocksdb in debug mode. So you won't get this problem but performance will be bad.

@fozzold's suggestion is probably most useful for python-rocksdb, i.e. don't rely on rtti being present.

twmht commented 6 years ago

now this problem can be solved by rocksdb 0.6.9