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

dependency not complete #2

Closed
shgxwxl opened this issue Sep 12, 2017 · 4 comments
Closed

dependency not complete #2

shgxwxl opened this issue Sep 12, 2017 · 4 comments

Comments

@shgxwxl
Copy link

shgxwxl commented Sep 12, 2017

build by build.sh

in phxqueue/makefile.mk should link gflags or it will report
more undefined references to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
and ohter missing link as
table_builder.cc:(.text+0x8ff):对‘snappy::MaxCompressedLength(unsigned long)’未定义的引用
table_builder.cc:(.text+0x93d):对‘snappy::RawCompress(char const*, unsigned long, char*, unsigned long*)’未定义的引用
/data/wangxiaolei-s/3rd/phxqueue//third_party/leveldb/lib/libleveldb.a(format.o):在函数‘leveldb::ReadBlock(leveldb::RandomAccessFile*, leveldb::ReadOptions const&, leveldb::BlockHandle const&, leveldb::BlockContents*)’中:
format.cc:(.text+0x4d9):对‘snappy::GetUncompressedLength(char const*, unsigned long, unsigned long*)’未定义的引用
format.cc:(.text+0x5ae):对‘snappy::RawUncompress(char const*, unsigned long, char*)’未定义的引用

@unixliang
Copy link
Collaborator

unixliang commented Sep 12, 2017

The default compilation option for LevelDB does not require snappy, maybe you have compiled the LevelDB depends on snappy and link it into the phxqueue/third_party. Try run build.sh in pure origin master.
In PhxQueue, LevelDB writes very little, and snappy optimization is small. If you still want LevelDB with snappy, you can modify makefile.mk as follows:

--- a/makefile.mk
+++ b/makefile.mk
@@ -43,7 +43,7 @@ endif
 CXXFLAGS := -std=c++11 -Wall -D_REENTRANT -D_GNU_SOURCE -D_XOPEN_SOURCE -fPIC -m64 -I$(PROTOBUF_INCLUDE_DIR) $(OPT)
 LDFLAGS := -L$(PHXRPC_LIB_DIR) -lphxrpc \
            -L$(PHXPAXOS_LIB_DIR) -lphxpaxos \
-                  -L$(LEVELDB_LIB_DIR) -lleveldb \
+                  -L$(LEVELDB_LIB_DIR) -lleveldb -L$(SNAPPY_LIB_DIR) -lsnappy \
                   -L$(LIBCO_LIB_DIR) -lcolib \
                   $(PROTOBUF_LIB_DIR)/libprotobuf.a \
                   $(GLOG_LIB_DIR)/libglog.a \
@@ -52,5 +52,5 @@ LDFLAGS := -L$(PHXRPC_LIB_DIR) -lphxrpc \
 #PBFLAGS = --proto_path=$(PROTOBUF_INCLUDE_DIR) --proto_path=$(PHXQUEUE_INCLUDE_DIR) --cpp_out=.
 PBFLAGS := --proto_path=$(PROTOBUF_INCLUDE_DIR) --proto_path=. --cpp_out=.
 INC_COMM := -I$(PHXQUEUE_INCLUDE_DIR) -I$(GLOG_INCLUDE_DIR) -I$(PROTOBUF_INCLUDE_DIR) -I$(LEVELDB_INCLUDE_DIR) -I$(LIBCO_INCLUDE_DIR) -I$(PHXPAXOS_INCLUDE_DIR) \
-               -I$(PHXPAXOS_INCLUDE_DIR) -I$(PHXRPC_INCLUDE_DIR) -I$(PHXPAXOS_PLUGIN_INCLUDE_DIR)
+               -I$(PHXPAXOS_INCLUDE_DIR) -I$(PHXRPC_INCLUDE_DIR) -I$(PHXPAXOS_PLUGIN_INCLUDE_DIR) -I$(SNAPPY_INCLUDE_DIR)

@unixliang
Copy link
Collaborator

unixliang commented Sep 12, 2017

And I found a issue of glog compilation errors caused by gflags.
google/glog#140 (comment)

@shgxwxl
Copy link
Author

shgxwxl commented Sep 13, 2017

thanks for your help .
I compiled PhxQueue by build.sh, and all dependency come from the phxqueue/third_party, the third_party generated automaticly.
but I found that LevelDB compiled automaticly with snappy when you have installed snappy and snappy-devel
and when PhxQueue use libleveldb.a not use libleveldb.so ,it'll need link snappy

so, is PhxQueue in your real production environment used so-lib, not used a-lib, this problem is caused by the a-lib, because so-lib will link the dependency automaticly

@unixliang
Copy link
Collaborator

I see. Using a dynamic library is a solution, but it requires that the online environment need to deploy leveldb.so, as same as the compiled environment. So, this has higher requirements of the maintenance on the online environment.
In addition, I looked at LevelDB's Makefile, and there seems to be no good way to remove snappy dependencies during process build.sh...

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

No branches or pull requests

2 participants