Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求助:如何让gorocks支持lz4 #96

Open
guileen opened this issue Nov 3, 2015 · 3 comments
Open

求助:如何让gorocks支持lz4 #96

guileen opened this issue Nov 3, 2015 · 3 comments

Comments

@guileen
Copy link

guileen commented Nov 3, 2015

我阅读了qdb的代码后发现,qdb强制使用 Lz4 作为rocksdb的压缩策略。但我实际测试中总是遇到“Invalid argument: Compression type LZ4 is not linked with the binary.” 错误。

在各种文档中包括rocksdb官方文档中,也未描述,如何在编译中加入lz4的支持,已向rocksdb提issue尚未得到解答。且与gorocks相关,可能问题会有所不同,所以只能来此求助,还望大神解答。

@siddontang
Copy link
Contributor

is lz4 in system path, like /usr/local/lib? maybe youcan add lz4 lib path in LD_LIBRARY_PATH.

@guileen
Copy link
Author

guileen commented Nov 3, 2015

也就是说rocksdb会自动检测系统有没有lz4,来自动进行编译。

lz4在/usr/local/lib中。之前系统没有设置 LD_LIBRARY_PATH,所以可能是/usr/lib 路径。现在使用 cd extern/rocksdb && LD_LIBRARY_PATH=/usr/local/lib make -j4 install-shared 进行编译,编译成功。

但是,在编译gorocks时无法通过,哪怕没有llz4 。

    cd extern/gorocks && go clean -i ./ && LD_LIBRARY_PATH=$(LIBRARY_PATH) CGO_CFLAGS="-I$(ROCKS_INCLUDE) -I$(LZ4_INCLUDE)" CGO_LDFLAGS="-L$(ROCKS_LIB) -L$(LZ4_PATH) -L/usr/local/lib -lz -llz4" go install ./

报如信息很长,最后一段如下:

      bool std::__1::__insertion_sort_incomplete<rocksdb::(anonymous namespace)::CompareLogByPointer&, std::__1::unique_ptr<rocksdb::LogFile, std::__1::default_delete<rocksdb::LogFile> >*>(std::__1::unique_ptr<rocksdb::LogFile, std::__1::default_delete<rocksdb::LogFile> >*, std::__1::unique_ptr<rocksdb::LogFile, std::__1::default_delete<rocksdb::LogFile> >*, rocksdb::(anonymous namespace)::CompareLogByPointer&) in librocksdb.a(wal_manager.o)
  "___gxx_personality_v0", referenced from:
      _rocksdb_open in librocksdb.a(c.o)
      _rocksdb_open_for_read_only in librocksdb.a(c.o)
      _rocksdb_backup_engine_open in librocksdb.a(c.o)
      _rocksdb_backup_engine_create_new_backup in librocksdb.a(c.o)
      _rocksdb_backup_engine_restore_db_from_latest_backup in librocksdb.a(c.o)
      _rocksdb_open_column_families in librocksdb.a(c.o)
      _rocksdb_open_for_read_only_column_families in librocksdb.a(c.o)
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [install_golibs] Error 2

我的系统是mac OSX,很奇怪,现在无论我如何尝试,都无法编译gorocks了,总是报ld错误。甚至无法恢复到以前的情况。

哪怕我删掉liblz4,去掉LD_LIBRARY_PATH环境变量。

@siddontang
Copy link
Contributor

LD_LIBRARY_PATH is not for mac osx, but for linux.
Btw, you should use make shared_lib to build rocksdb in mac osx, not static lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants