i want to test pyrocksdb follwoing these steps. After building the shared_lib and setting up pyrocksb (without major problems and strictly following the steps), i try to load rocksdb from python and get the following error:
>>>import rocksdb
Traceback (most recent call last):
File "", line 1, in
File "/home/user/virtualenv/pyrocks/local/lib/python2.7/site-packages/rocksdb/__init__.py", line 1, in
from ._rocksdb import *
ImportError: /usr/local/lib/librocksdb.so: undefined symbol: clock_gettime
The issue is already reported and described in more detail here but in my mind not solved yet. Has someone already worked out a fix?
EDIT:
I got it working. The final hint was on this rocksdb github discussion. Somehow the usage of the -lrt flag for the g++ compiler seems to cause the bug leading to a missing link. A quick fix as mentioned there is to add the --no-as-needed flag directly as option for the g++ compiler. See here for more details.
I just runned make, stopped copied the options and flag list of the screen printout. Insertet the above optional flag command at the beginning. That made it working :-)
For me the g++ command looked like this: see the "-Wl, --no-as-needed"
g++ -shared -Wl,--no-as-needed,-soname -Wl,librocksdb.so -g -Wall -Werror -Wno-sign-compare -I. -I./include -std=c++11 -DROCKSDB_PLATFORM_POSIX -DOS_LINUX -fno-builtin-memcmp -DROCKSDB_ATOMIC_PRESENT -DROCKSDB_FALLOCATE_PRESENT -DSNAPPY -DGFLAGS -DZLIB -DBZIP2 -DHAVE_JEMALLOC -O2 -fno-omit-frame-pointer -momit-leaf-frame-pointer -Woverloaded-virtual -fPIC -lpthread -lrt -lsnappy -lgflags -lz -lbz2 and so on ....
Thanks PlagTag. We have added the "-Wl, --no-as-needed" to our Makefile: https://github.com/facebook/rocksdb/commit/d03f110904682a340137af07264eb8e148e3477d