RocksDB 报错
Rocksdb make error
我想按照 these 步骤测试 pyrocksdb。在构建 shared_lib 并设置 pyrocksb 之后(没有重大问题并严格按照步骤进行),我尝试从 python 加载 rocksdb 并得到以下错误:
>>>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
这个问题已经被报告和更详细地描述 here 但在我看来还没有解决。有人已经解决了吗?
编辑:
我成功了。最终提示在 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 上以获取更多详细信息。
我刚刚运行 make,停止复制屏幕打印输出的选项和标志列表。在开头插入上面的可选标志命令。这使它工作:-)
对我来说,g++ 命令看起来像这样:参见“-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 ....
感谢 PlagTag。我们在 Makefile 中添加了“-Wl, --no-as-needed”:https://github.com/facebook/rocksdb/commit/d03f110904682a340137af07264eb8e148e3477d
我想按照 these 步骤测试 pyrocksdb。在构建 shared_lib 并设置 pyrocksb 之后(没有重大问题并严格按照步骤进行),我尝试从 python 加载 rocksdb 并得到以下错误:
>>>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
这个问题已经被报告和更详细地描述 here 但在我看来还没有解决。有人已经解决了吗?
编辑:
我成功了。最终提示在 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 上以获取更多详细信息。
我刚刚运行 make,停止复制屏幕打印输出的选项和标志列表。在开头插入上面的可选标志命令。这使它工作:-)
对我来说,g++ 命令看起来像这样:参见“-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 ....
感谢 PlagTag。我们在 Makefile 中添加了“-Wl, --no-as-needed”:https://github.com/facebook/rocksdb/commit/d03f110904682a340137af07264eb8e148e3477d