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

编译出错 #10

Closed
shijianlau opened this issue Sep 2, 2016 · 8 comments
Closed

编译出错 #10

shijianlau opened this issue Sep 2, 2016 · 8 comments

Comments

@shijianlau
Copy link

系统:centos 6.5 x86_64, gcc升级到4.8.5, 在make phxsql时出现以下错误:
g++ phxrpc_phxbinlog_service.o phxrpc_phxbinlog_dispatcher.o phxbinlog_server_config.o phxbinlog_service_impl.o phxbinlog_server.o phxbinlog_main.o -o phxbinlogsvr_phxrpc -L/usr/local/src/phxsql-master/third_party/phxpaxos/lib -L/usr/local/src/phxsql-master/.lib -L/usr/local/src/phxsql-master/third_party/protobuf/lib -L/usr/local/src/phxsql-master/third_party/leveldb/lib/ -L/usr/local/src/phxsql-master/third_party/glog/lib -L -L -L/usr/local/src/phxsql-master/percona/libmysql -L/usr/local/src/phxsql-master/third_party/colib/lib -static-libgcc -static-libstdc++ -lphxbinlogsvrclient_phxrpc -lphxbinlogsvrlogic -lphxbinlogsvrclient_base -lclientproto -lagent -leventagent -lagentrepl -lagentmonitor -leventhandler -lagentstatus -lmasteragent -lpaxosagentbase -lmasterhandler -lnet -lagentmonitorcomm -lmysqlcommand -lagentstorage -lphxbinlogstat -lgtidhandler -lphxbinlogproto -lphxbinlogconfig -lphxconfig -lconfigparser -lphxutils -lphxlog -lphxglog /usr/local/src/phxsql-master/third_party/phxpaxos/lib/libphxpaxos_plugin.a /usr/local/src/phxsql-master/third_party/phxpaxos/lib/libphxpaxos.a /usr/local/src/phxsql-master/third_party/leveldb/lib//libleveldb.a /usr/local/src/phxsql-master/third_party/protobuf/lib/libprotobuf.a /usr/local/src/phxsql-master/percona/libmysql/libperconaserverclient.a -ldl -lrt -lz /usr/local/src/phxsql-master/third_party/glog/lib/libglog.a -lpthread /usr/local/src/phxsql-master/third_party/phxrpc/lib/libphxrpc.a
/usr/local/src/phxsql-master/third_party/leveldb/lib//libleveldb.a(table_builder.o): In function leveldb::TableBuilder::WriteBlock(leveldb::BlockBuilder*, leveldb::BlockHandle*)': table_builder.cc:(.text+0x698): undefined reference tosnappy::MaxCompressedLength(unsigned long)'
table_builder.cc:(.text+0x6d2): undefined reference to snappy::RawCompress(char const*, unsigned long, char*, unsigned long*)' /usr/local/src/phxsql-master/third_party/leveldb/lib//libleveldb.a(format.o): In functionleveldb::ReadBlock(leveldb::RandomAccessFile_, leveldb::ReadOptions const&, leveldb::BlockHandle const&, leveldb::BlockContents_)':
format.cc:(.text+0x5de): undefined reference to snappy::GetUncompressedLength(char const*, unsigned long, unsigned long*)' format.cc:(.text+0x64e): undefined reference tosnappy::RawUncompress(char const_, unsigned long, char_)'
/usr/local/src/phxsql-master/third_party/glog/lib/libglog.a(libglog_la-utilities.o): In function google::GetStackTrace(void**, int, int)': utilities.cc:(.text+0x73e): undefined reference to_Ux86_64_getcontext'
utilities.cc:(.text+0x757): undefined reference to _ULx86_64_init_local' utilities.cc:(.text+0x7af): undefined reference to_ULx86_64_get_reg'
utilities.cc:(.text+0x7f4): undefined reference to _ULx86_64_step' collect2: 错误:ld 返回 1 make[4]: *** [phxbinlogsvr_phxrpc] 错误 1 make[4]: Leaving directory/usr/local/src/phxsql-master/phxbinlogsvr/framework/phxrpc/svr'
make[3]: *** [sub_dir] 错误 1
make[3]: Leaving directory /usr/local/src/phxsql-master/phxbinlogsvr/framework/phxrpc' make[2]: *** [sub_dir] 错误 1 make[2]: Leaving directory/usr/local/src/phxsql-master/phxbinlogsvr/framework'
make[1]: *** [sub_dir] 错误 1
make[1]: Leaving directory `/usr/local/src/phxsql-master/phxbinlogsvr'
make: *** [sub_dir] 错误 1

@toontong
Copy link

toontong commented Sep 2, 2016

另一个编译错:
缺文件 : phxbinlogsvr/client/phxbinlog_client_factory_phxrpc.h: No such file or directory

make[3]: Entering directory /root/third_party/percona-server-5.6.31-77.0' [ 80%] Building CXX object plugin/phxsync_phxrpc/CMakeFiles/phxsync_master_phxrpc.dir/phxsync_master_phxrpc_plugin.cc.o /root/phxsql/phxsql-0.8.0/percona/plugin/phxsync_phxrpc/phxsync_master_phxrpc_plugin.cc:18:65: fatal error: phxbinlogsvr/client/phxbinlog_client_factory_phxrpc.h: No such file or directory #include "phxbinlogsvr/client/phxbinlog_client_factory_phxrpc.h" ^ compilation terminated. make[3]: *** [plugin/phxsync_phxrpc/CMakeFiles/phxsync_master_phxrpc.dir/phxsync_master_phxrpc_plugin.cc.o] Error 1 make[3]: Leaving directory/root/third_party/percona-server-5.6.31-77.0'
make[2]: *** [plugin/phxsync_phxrpc/CMakeFiles/phxsync_master_phxrpc.dir/all] Error 2
make[2]: Leaving directory /root/third_party/percona-server-5.6.31-77.0' make[1]: *** [all] Error 2 make[1]: Leaving directory/root/third_party/percona-server-5.6.31-77.0'
make: *** [mysql] Error 2

@toontong
Copy link

toontong commented Sep 2, 2016

另外,提个编译目录依赖的建议, 编译依赖库头文件查找目录是/usr/lcoal。 如glog使用 /usr/local/include/glog/.h ; leveldb使用 /usr/local/include/leveldb/.h
而.so与.a文件 应该全放到/usr/local/lib 目录下。 这样对编译过程中目录依赖更简单。
同理,对于贵司自编的phxrcp、libco也应该一致。这样就不存在第三方目录,对于重复编译phxrpc、phxpaxos都简单很多。

@lynncui00
Copy link
Collaborator

@shijianlau 您好,你的leveldb是不是之前编译过的并开启了snappy压缩?目前phxsql编译并未主动-lsnappy所以会有问题,建议重新编译一下leveldb并取消snappy压缩。第二个glog问题比较奇怪,尝试重新编译一下看看。

@zhibinliu
Copy link

我也是碰到了glog的问题,重编也不行。我的编译glog步骤是:
./configure CXXFLAGS=-fPIC --prefix=/apps/zhibin/weixin/phxsql/third_party/glog
make
make install

出错:
g++ phxrpc_phxbinlog_service.o phxrpc_phxbinlog_dispatcher.o phxbinlog_server_config.o phxbinlog_service_impl.o phxbinlog_server.o phxbinlog_main.o -o phxbinlogsvr_phxrpc -L/apps/zhibin/weixin/phxsql/third_party/phxpaxos/lib -L/apps/zhibin/weixin/phxsql/.lib -L/apps/zhibin/weixin/phxsql/third_party/protobuf/lib -L/apps/zhibin/weixin/phxsql/third_party/leveldb/lib/ -L/apps/zhibin/weixin/phxsql/third_party/glog/lib -L -L -L/apps/zhibin/weixin/phxsql/percona/libmysql -L/apps/zhibin/weixin/phxsql/third_party/colib/lib -static-libgcc -static-libstdc++ -lphxbinlogsvrclient_phxrpc -lphxbinlogsvrlogic -lphxbinlogsvrclient_base -lclientproto -lagent -leventagent -lagentrepl -lagentmonitor -leventhandler -lagentstatus -lmasteragent -lpaxosagentbase -lmasterhandler -lnet -lagentmonitorcomm -lmysqlcommand -lagentstorage -lphxbinlogstat -lgtidhandler -lphxbinlogproto -lphxbinlogconfig -lphxconfig -lconfigparser -lphxutils -lphxlog -lphxglog /apps/zhibin/weixin/phxsql/third_party/phxpaxos/lib/libphxpaxos_plugin.a /apps/zhibin/weixin/phxsql/third_party/phxpaxos/lib/libphxpaxos.a /apps/zhibin/weixin/phxsql/third_party/leveldb/lib//libleveldb.a /apps/zhibin/weixin/phxsql/third_party/protobuf/lib/libprotobuf.a /apps/zhibin/weixin/phxsql/percona/libmysql/libperconaserverclient.a -ldl -lrt -lz /apps/zhibin/weixin/phxsql/third_party/glog/lib/libglog.a -lpthread /apps/zhibin/weixin/phxsql/third_party/phxrpc/lib/libphxrpc.a
/apps/zhibin/weixin/phxsql/third_party/glog/lib/libglog.a(libglog_la-utilities.o): In function google::GetStackTrace(void**, int, int)': utilities.cc:(.text+0x77d): undefined reference to_Ux86_64_getcontext'
utilities.cc:(.text+0x796): undefined reference to _ULx86_64_init_local' utilities.cc:(.text+0x7ef): undefined reference to_ULx86_64_get_reg'
utilities.cc:(.text+0x83f): undefined reference to _ULx86_64_step' collect2: error: ld returned 1 exit status make[4]: *** [phxbinlogsvr_phxrpc] Error 1 make[4]: Leaving directory/apps/zhibin/weixin/phxsql/phxbinlogsvr/framework/phxrpc/svr'
make[3]: *** [sub_dir] Error 1
make[3]: Leaving directory /apps/zhibin/weixin/phxsql/phxbinlogsvr/framework/phxrpc' make[2]: *** [sub_dir] Error 1 make[2]: Leaving directory/apps/zhibin/weixin/phxsql/phxbinlogsvr/framework'
make[1]: *** [sub_dir] Error 1
make[1]: Leaving directory `/apps/zhibin/weixin/phxsql/phxbinlogsvr'
make: *** [sub_dir] Error 1

@lynncui00
Copy link
Collaborator

@zhibinliu glog的问题是由于我们的submodule设置的版本有误,我们已经做出更新,并且附带了详细的编译手册,请查看WIKI重新获取源码进行编译,希望能帮助到您。

@jingyihome
Copy link

@shijianlau 我之前编译glog的时候也是各种报错,在CentOS下用cmake编译可以,我在CentOS6 和Centos7 下编译成功。文章地址

@jos666
Copy link

jos666 commented Oct 23, 2016

centos 6.x 以下命令安装phxsql 完美编译, 速度快, devtools 2 项目 gcc 4.8 (参考https://segmentfault.com/a/1190000004193587)

yum install gcc gcc-c++ gcc-devel cmake epel-release -y
yum install autoconf268 automake libtool libcxx readline-devel zlib-devel curses-devel ncurses-devel -y
cd /etc/yum.repo.d/
http://people.centos.org/tru/devtools-2/devtools-2.repo 
cd -
yum install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils-y
export PATH=/opt/rh/devtoolset-2/root/usr/bin:$PATH
cd phxsql/third_party
./autoinstall.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

8 participants
@toontong @cjcchen @jos666 @shijianlau @lynncui00 @zhibinliu @jingyihome and others